From 20b00544e335e44a1cd741f8e06082fabb3a6cec Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Wed, 6 May 2026 15:18:29 -0400 Subject: [PATCH 01/11] durable: extract trace context from checkpoints and input payload --- datadog_lambda/tracing.py | 161 +++++++++++++++++++++++++++++++++----- tests/test_tracing.py | 66 ++++++++++++++++ 2 files changed, 207 insertions(+), 20 deletions(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index 3c7d9f11..c9b268db 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -61,6 +61,7 @@ DD_TRACE_JAVA_TRACE_ID_PADDING = "00000000" HIGHER_64_BITS = "HIGHER_64_BITS" LOWER_64_BITS = "LOWER_64_BITS" +_TRACE_CHECKPOINT_PREFIX = "_datadog_" def _dsm_set_checkpoint(context_json, event_type, arn): @@ -546,6 +547,121 @@ def extract_context_from_step_functions(event, lambda_context): return extract_context_from_lambda_context(lambda_context) +def _durable_operations(event): + if not isinstance(event, dict): + return [] + + operations = event.get("InitialExecutionState", {}).get("Operations") + if isinstance(operations, list): + return operations + if not isinstance(operations, dict): + return [] + + numeric_keys = [] + other_keys = [] + for key, value in operations.items(): + if not isinstance(value, dict): + continue + try: + numeric_keys.append((int(key), value)) + except (TypeError, ValueError): + other_keys.append((str(key), value)) + + numeric_keys.sort(key=lambda item: item[0]) + other_keys.sort(key=lambda item: item[0]) + return [value for _, value in numeric_keys + other_keys] + + +def _extract_context_from_durable_checkpoint(operation): + if not isinstance(operation, dict): + return None + + step_details = operation.get("StepDetails") + if not isinstance(step_details, dict): + return None + + result = step_details.get("Result") + if isinstance(result, str): + try: + result = json.loads(result) + except Exception: + return None + + if not isinstance(result, dict): + return None + + return propagator.extract(result) + + +def _extract_context_from_durable_input_payload(operation): + if not isinstance(operation, dict): + return None + + execution_details = operation.get("ExecutionDetails") + if not isinstance(execution_details, dict): + return None + + input_payload = execution_details.get("InputPayload") + if isinstance(input_payload, str): + try: + input_payload = json.loads(input_payload) + except Exception: + return None + + if not isinstance(input_payload, dict): + return None + + headers = input_payload.get("headers") + if isinstance(headers, dict): + return propagator.extract(headers) + + dd_data = input_payload.get("_datadog") + if isinstance(dd_data, dict): + return propagator.extract(dd_data) + + return None + + +def extract_context_from_durable_execution(event): + if not isinstance(event, dict): + return None + if not isinstance(event.get("DurableExecutionArn"), str): + return None + + operations = _durable_operations(event) + if not operations: + return None + + best_context = None + best_number = -1 + for operation in operations: + if not isinstance(operation, dict): + continue + name = operation.get("Name") + if not isinstance(name, str) or not name.startswith(_TRACE_CHECKPOINT_PREFIX): + continue + suffix = name[len(_TRACE_CHECKPOINT_PREFIX) :] + try: + number = int(suffix) + except (TypeError, ValueError): + continue + if number < best_number: + continue + context = _extract_context_from_durable_checkpoint(operation) + if _is_context_complete(context): + best_context = context + best_number = number + + if best_context is not None: + return best_context + + upstream_context = _extract_context_from_durable_input_payload(operations[0]) + if _is_context_complete(upstream_context): + return upstream_context + + return None + + def extract_context_custom_extractor(extractor, event, lambda_context): """ Extract Datadog trace context using a custom trace extractor function @@ -633,29 +749,34 @@ def extract_dd_trace_context( global dd_trace_context trace_context_source = None event_source = parse_event_source(event) + context = None if extractor is not None: context = extract_context_custom_extractor(extractor, event, lambda_context) - elif isinstance(event, (set, dict)) and "request" in event: - context = extract_context_from_request_header_or_context( - event, lambda_context, event_source - ) - elif isinstance(event, (set, dict)) and "headers" in event: - context = extract_context_from_http_event_or_context( - event, lambda_context, event_source, decode_authorizer_context - ) - elif event_source.equals(EventTypes.SNS) or event_source.equals(EventTypes.SQS): - context = extract_context_from_sqs_or_sns_event_or_context( - event, lambda_context, event_source - ) - elif event_source.equals(EventTypes.EVENTBRIDGE): - context = extract_context_from_eventbridge_event(event, lambda_context) - elif event_source.equals(EventTypes.KINESIS): - context = extract_context_from_kinesis_event(event, lambda_context) - elif event_source.equals(EventTypes.STEPFUNCTIONS): - context = extract_context_from_step_functions(event, lambda_context) - else: - context = extract_context_from_lambda_context(lambda_context) + elif isinstance(event, (set, dict)) and "DurableExecutionArn" in event: + context = extract_context_from_durable_execution(event) + + if context is None: + if isinstance(event, (set, dict)) and "request" in event: + context = extract_context_from_request_header_or_context( + event, lambda_context, event_source + ) + elif isinstance(event, (set, dict)) and "headers" in event: + context = extract_context_from_http_event_or_context( + event, lambda_context, event_source, decode_authorizer_context + ) + elif event_source.equals(EventTypes.SNS) or event_source.equals(EventTypes.SQS): + context = extract_context_from_sqs_or_sns_event_or_context( + event, lambda_context, event_source + ) + elif event_source.equals(EventTypes.EVENTBRIDGE): + context = extract_context_from_eventbridge_event(event, lambda_context) + elif event_source.equals(EventTypes.KINESIS): + context = extract_context_from_kinesis_event(event, lambda_context) + elif event_source.equals(EventTypes.STEPFUNCTIONS): + context = extract_context_from_step_functions(event, lambda_context) + else: + context = extract_context_from_lambda_context(lambda_context) if _is_context_complete(context): logger.debug("Extracted Datadog trace context from event or context") diff --git a/tests/test_tracing.py b/tests/test_tracing.py index 986bc9e4..f7945118 100644 --- a/tests/test_tracing.py +++ b/tests/test_tracing.py @@ -394,6 +394,72 @@ def test_with_w3c_trace_headers(self): headers, {"headers": headers} ) + @with_trace_propagation_style("datadog") + def test_extracts_durable_trace_context_from_latest_checkpoint_operation_map(self): + lambda_ctx = get_mock_context() + headers = { + TraceHeader.TRACE_ID: "123", + TraceHeader.PARENT_ID: "321", + TraceHeader.SAMPLING_PRIORITY: "1", + } + + event = { + "DurableExecutionArn": "arn:aws:lambda:us-east-2:123456789012:function:demo:1/durable-execution/demo/abc", + "CheckpointToken": "token", + "InitialExecutionState": { + "Operations": { + "0": { + "Type": "EXECUTION", + "ExecutionDetails": { + "InputPayload": {"order_id": "ORD-300"} + }, + }, + "1": { + "Name": "_datadog_0", + "StepDetails": {"Result": {TraceHeader.TRACE_ID: "999"}}, + }, + "2": { + "Name": "_datadog_1", + "StepDetails": {"Result": headers}, + }, + } + }, + } + + ctx, source, _ = extract_dd_trace_context(event, lambda_ctx) + + self.assertEqual(source, "event") + self.assertEqual(ctx, Context(trace_id=123, span_id=321, sampling_priority=1)) + + @with_trace_propagation_style("datadog") + def test_extracts_durable_trace_context_from_input_payload_when_no_checkpoint(self): + lambda_ctx = get_mock_context() + headers = { + TraceHeader.TRACE_ID: "777", + TraceHeader.PARENT_ID: "888", + TraceHeader.SAMPLING_PRIORITY: "1", + } + + event = { + "DurableExecutionArn": "arn:aws:lambda:us-east-2:123456789012:function:demo:1/durable-execution/demo/first", + "CheckpointToken": "token", + "InitialExecutionState": { + "Operations": { + "0": { + "Type": "EXECUTION", + "ExecutionDetails": { + "InputPayload": json.dumps({"headers": headers}) + }, + } + } + }, + } + + ctx, source, _ = extract_dd_trace_context(event, lambda_ctx) + + self.assertEqual(source, "event") + self.assertEqual(ctx, Context(trace_id=777, span_id=888, sampling_priority=1)) + @with_trace_propagation_style("datadog") def test_with_extractor_function(self): def extractor_foo(event, context): From 4db58eddca9f1aff44509d222b08c98c966044c4 Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Tue, 12 May 2026 09:49:31 -0400 Subject: [PATCH 02/11] reorganize the code --- datadog_lambda/tracing.py | 42 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index c9b268db..26f6c6c5 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -755,28 +755,26 @@ def extract_dd_trace_context( context = extract_context_custom_extractor(extractor, event, lambda_context) elif isinstance(event, (set, dict)) and "DurableExecutionArn" in event: context = extract_context_from_durable_execution(event) - - if context is None: - if isinstance(event, (set, dict)) and "request" in event: - context = extract_context_from_request_header_or_context( - event, lambda_context, event_source - ) - elif isinstance(event, (set, dict)) and "headers" in event: - context = extract_context_from_http_event_or_context( - event, lambda_context, event_source, decode_authorizer_context - ) - elif event_source.equals(EventTypes.SNS) or event_source.equals(EventTypes.SQS): - context = extract_context_from_sqs_or_sns_event_or_context( - event, lambda_context, event_source - ) - elif event_source.equals(EventTypes.EVENTBRIDGE): - context = extract_context_from_eventbridge_event(event, lambda_context) - elif event_source.equals(EventTypes.KINESIS): - context = extract_context_from_kinesis_event(event, lambda_context) - elif event_source.equals(EventTypes.STEPFUNCTIONS): - context = extract_context_from_step_functions(event, lambda_context) - else: - context = extract_context_from_lambda_context(lambda_context) + elif isinstance(event, (set, dict)) and "request" in event: + context = extract_context_from_request_header_or_context( + event, lambda_context, event_source + ) + elif isinstance(event, (set, dict)) and "headers" in event: + context = extract_context_from_http_event_or_context( + event, lambda_context, event_source, decode_authorizer_context + ) + elif event_source.equals(EventTypes.SNS) or event_source.equals(EventTypes.SQS): + context = extract_context_from_sqs_or_sns_event_or_context( + event, lambda_context, event_source + ) + elif event_source.equals(EventTypes.EVENTBRIDGE): + context = extract_context_from_eventbridge_event(event, lambda_context) + elif event_source.equals(EventTypes.KINESIS): + context = extract_context_from_kinesis_event(event, lambda_context) + elif event_source.equals(EventTypes.STEPFUNCTIONS): + context = extract_context_from_step_functions(event, lambda_context) + else: + context = extract_context_from_lambda_context(lambda_context) if _is_context_complete(context): logger.debug("Extracted Datadog trace context from event or context") From 2aedd7756b9177a7e7aa25a801257fd80b70f915 Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Tue, 12 May 2026 14:55:56 -0400 Subject: [PATCH 03/11] further simplify --- datadog_lambda/tracing.py | 61 +++++++++------------------------------ 1 file changed, 13 insertions(+), 48 deletions(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index 26f6c6c5..76c19ab1 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -547,31 +547,6 @@ def extract_context_from_step_functions(event, lambda_context): return extract_context_from_lambda_context(lambda_context) -def _durable_operations(event): - if not isinstance(event, dict): - return [] - - operations = event.get("InitialExecutionState", {}).get("Operations") - if isinstance(operations, list): - return operations - if not isinstance(operations, dict): - return [] - - numeric_keys = [] - other_keys = [] - for key, value in operations.items(): - if not isinstance(value, dict): - continue - try: - numeric_keys.append((int(key), value)) - except (TypeError, ValueError): - other_keys.append((str(key), value)) - - numeric_keys.sort(key=lambda item: item[0]) - other_keys.sort(key=lambda item: item[0]) - return [value for _, value in numeric_keys + other_keys] - - def _extract_context_from_durable_checkpoint(operation): if not isinstance(operation, dict): return None @@ -623,17 +598,14 @@ def _extract_context_from_durable_input_payload(operation): def extract_context_from_durable_execution(event): - if not isinstance(event, dict): - return None - if not isinstance(event.get("DurableExecutionArn"), str): - return None - - operations = _durable_operations(event) - if not operations: + operations = event.get("InitialExecutionState", {}).get("Operations") + if isinstance(operations, dict): + operations = list(operations.values()) + if not isinstance(operations, list) or not operations: return None - best_context = None - best_number = -1 + highest = -1 + best_operation = None for operation in operations: if not isinstance(operation, dict): continue @@ -645,21 +617,14 @@ def extract_context_from_durable_execution(event): number = int(suffix) except (TypeError, ValueError): continue - if number < best_number: - continue - context = _extract_context_from_durable_checkpoint(operation) - if _is_context_complete(context): - best_context = context - best_number = number + if number > highest: + highest = number + best_operation = operation - if best_context is not None: - return best_context + if best_operation is not None: + return _extract_context_from_durable_checkpoint(best_operation) - upstream_context = _extract_context_from_durable_input_payload(operations[0]) - if _is_context_complete(upstream_context): - return upstream_context - - return None + return _extract_context_from_durable_input_payload(operations[0]) def extract_context_custom_extractor(extractor, event, lambda_context): @@ -753,7 +718,7 @@ def extract_dd_trace_context( if extractor is not None: context = extract_context_custom_extractor(extractor, event, lambda_context) - elif isinstance(event, (set, dict)) and "DurableExecutionArn" in event: + elif isinstance(event, dict) and "DurableExecutionArn" in event: context = extract_context_from_durable_execution(event) elif isinstance(event, (set, dict)) and "request" in event: context = extract_context_from_request_header_or_context( From 499aa4568c57a11032bef37073c67a3298e5cea0 Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Tue, 12 May 2026 15:53:50 -0400 Subject: [PATCH 04/11] separate out the cross-execution case --- datadog_lambda/tracing.py | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index 76c19ab1..4ea2f187 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -568,35 +568,6 @@ def _extract_context_from_durable_checkpoint(operation): return propagator.extract(result) -def _extract_context_from_durable_input_payload(operation): - if not isinstance(operation, dict): - return None - - execution_details = operation.get("ExecutionDetails") - if not isinstance(execution_details, dict): - return None - - input_payload = execution_details.get("InputPayload") - if isinstance(input_payload, str): - try: - input_payload = json.loads(input_payload) - except Exception: - return None - - if not isinstance(input_payload, dict): - return None - - headers = input_payload.get("headers") - if isinstance(headers, dict): - return propagator.extract(headers) - - dd_data = input_payload.get("_datadog") - if isinstance(dd_data, dict): - return propagator.extract(dd_data) - - return None - - def extract_context_from_durable_execution(event): operations = event.get("InitialExecutionState", {}).get("Operations") if isinstance(operations, dict): @@ -621,10 +592,7 @@ def extract_context_from_durable_execution(event): highest = number best_operation = operation - if best_operation is not None: - return _extract_context_from_durable_checkpoint(best_operation) - - return _extract_context_from_durable_input_payload(operations[0]) + return _extract_context_from_durable_checkpoint(best_operation) def extract_context_custom_extractor(extractor, event, lambda_context): From f11ab2af20bb54e23a6093a42eae4d3124ef77cb Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Tue, 12 May 2026 16:06:06 -0400 Subject: [PATCH 05/11] clean up tests --- tests/test_tracing.py | 45 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/tests/test_tracing.py b/tests/test_tracing.py index f7945118..f62bd97e 100644 --- a/tests/test_tracing.py +++ b/tests/test_tracing.py @@ -408,15 +408,16 @@ def test_extracts_durable_trace_context_from_latest_checkpoint_operation_map(sel "CheckpointToken": "token", "InitialExecutionState": { "Operations": { - "0": { - "Type": "EXECUTION", - "ExecutionDetails": { - "InputPayload": {"order_id": "ORD-300"} - }, - }, + "0": {"Type": "EXECUTION"}, "1": { "Name": "_datadog_0", - "StepDetails": {"Result": {TraceHeader.TRACE_ID: "999"}}, + "StepDetails": { + "Result": { + TraceHeader.TRACE_ID: "999", + TraceHeader.PARENT_ID: "888", + TraceHeader.SAMPLING_PRIORITY: "1", + } + }, }, "2": { "Name": "_datadog_1", @@ -431,35 +432,7 @@ def test_extracts_durable_trace_context_from_latest_checkpoint_operation_map(sel self.assertEqual(source, "event") self.assertEqual(ctx, Context(trace_id=123, span_id=321, sampling_priority=1)) - @with_trace_propagation_style("datadog") - def test_extracts_durable_trace_context_from_input_payload_when_no_checkpoint(self): - lambda_ctx = get_mock_context() - headers = { - TraceHeader.TRACE_ID: "777", - TraceHeader.PARENT_ID: "888", - TraceHeader.SAMPLING_PRIORITY: "1", - } - - event = { - "DurableExecutionArn": "arn:aws:lambda:us-east-2:123456789012:function:demo:1/durable-execution/demo/first", - "CheckpointToken": "token", - "InitialExecutionState": { - "Operations": { - "0": { - "Type": "EXECUTION", - "ExecutionDetails": { - "InputPayload": json.dumps({"headers": headers}) - }, - } - } - }, - } - - ctx, source, _ = extract_dd_trace_context(event, lambda_ctx) - - self.assertEqual(source, "event") - self.assertEqual(ctx, Context(trace_id=777, span_id=888, sampling_priority=1)) - + @with_trace_propagation_style("datadog") def test_with_extractor_function(self): def extractor_foo(event, context): From b3f83df36a72bdb382875cff3e1d42b9bfb0f7ef Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Tue, 12 May 2026 19:59:25 -0400 Subject: [PATCH 06/11] format --- tests/test_tracing.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_tracing.py b/tests/test_tracing.py index f62bd97e..e3fe2f03 100644 --- a/tests/test_tracing.py +++ b/tests/test_tracing.py @@ -432,7 +432,6 @@ def test_extracts_durable_trace_context_from_latest_checkpoint_operation_map(sel self.assertEqual(source, "event") self.assertEqual(ctx, Context(trace_id=123, span_id=321, sampling_priority=1)) - @with_trace_propagation_style("datadog") def test_with_extractor_function(self): def extractor_foo(event, context): From 62d8b69d9d6c51a04957fb4f0736bbf6007e559b Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Thu, 14 May 2026 20:09:26 -0400 Subject: [PATCH 07/11] the extraction part of the simplification done by dd-trace-py side injection --- datadog_lambda/tracing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index 4ea2f187..b5344ccb 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -31,7 +31,7 @@ from ddtrace import patch from ddtrace import __version__ as ddtrace_version -from ddtrace.propagation.http import HTTPPropagator +from ddtrace.propagation.http import HTTPPropagator, _DatadogMultiHeader from ddtrace.trace import Context, Span, tracer from datadog_lambda.config import config @@ -565,7 +565,9 @@ def _extract_context_from_durable_checkpoint(operation): if not isinstance(result, dict): return None - return propagator.extract(result) + # Checkpoints are written by dd-trace-py as x-datadog-* headers, so extract + # directly and bypass DD_TRACE_PROPAGATION_STYLE_EXTRACT on purpose. + return _DatadogMultiHeader._extract(result) def extract_context_from_durable_execution(event): From 42247d000e1d5166549f75433748a3e73de48326 Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Thu, 14 May 2026 20:14:07 -0400 Subject: [PATCH 08/11] format --- datadog_lambda/tracing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index b5344ccb..ee2592f2 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -585,7 +585,7 @@ def extract_context_from_durable_execution(event): name = operation.get("Name") if not isinstance(name, str) or not name.startswith(_TRACE_CHECKPOINT_PREFIX): continue - suffix = name[len(_TRACE_CHECKPOINT_PREFIX) :] + suffix = name[len(_TRACE_CHECKPOINT_PREFIX):] try: number = int(suffix) except (TypeError, ValueError): From 958daf04185a0d24665e343cfaea262a7a93d551 Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Thu, 14 May 2026 23:17:18 -0400 Subject: [PATCH 09/11] format --- datadog_lambda/tracing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index ee2592f2..b5344ccb 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -585,7 +585,7 @@ def extract_context_from_durable_execution(event): name = operation.get("Name") if not isinstance(name, str) or not name.startswith(_TRACE_CHECKPOINT_PREFIX): continue - suffix = name[len(_TRACE_CHECKPOINT_PREFIX):] + suffix = name[len(_TRACE_CHECKPOINT_PREFIX) :] try: number = int(suffix) except (TypeError, ValueError): From bb9e643be08c02268ccc590a463c588e0d066871 Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Thu, 14 May 2026 23:23:00 -0400 Subject: [PATCH 10/11] reformat again --- datadog_lambda/tracing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index b5344ccb..ee2592f2 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -585,7 +585,7 @@ def extract_context_from_durable_execution(event): name = operation.get("Name") if not isinstance(name, str) or not name.startswith(_TRACE_CHECKPOINT_PREFIX): continue - suffix = name[len(_TRACE_CHECKPOINT_PREFIX) :] + suffix = name[len(_TRACE_CHECKPOINT_PREFIX):] try: number = int(suffix) except (TypeError, ValueError): From 9c4e70cb2b15a60c803a70110396c94cd30a8ce0 Mon Sep 17 00:00:00 2001 From: Joey Zhao <5253430+joeyzhao2018@users.noreply.github.com> Date: Fri, 15 May 2026 12:42:50 -0400 Subject: [PATCH 11/11] update .flake8 to be compatible with black per black doc https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8 Co-Authored-By: Claude Opus 4.7 --- .flake8 | 3 ++- datadog_lambda/tracing.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 51b50a04..179ca301 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,3 @@ [flake8] -max-line-length = 100 \ No newline at end of file +max-line-length = 100 +extend-ignore = E203,E701 \ No newline at end of file diff --git a/datadog_lambda/tracing.py b/datadog_lambda/tracing.py index ee2592f2..b5344ccb 100644 --- a/datadog_lambda/tracing.py +++ b/datadog_lambda/tracing.py @@ -585,7 +585,7 @@ def extract_context_from_durable_execution(event): name = operation.get("Name") if not isinstance(name, str) or not name.startswith(_TRACE_CHECKPOINT_PREFIX): continue - suffix = name[len(_TRACE_CHECKPOINT_PREFIX):] + suffix = name[len(_TRACE_CHECKPOINT_PREFIX) :] try: number = int(suffix) except (TypeError, ValueError):