Skip to content

Commit 86cf5ff

Browse files
changed to explicit check of dsm context
1 parent f533c09 commit 86cf5ff

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

datadog_lambda/tracing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _extract_context_with_data_streams(context_json, event_type, arn):
7878
if not config.data_streams_enabled:
7979
return context
8080

81-
if not _is_context_complete(context):
81+
if "dd-pathway-ctx-base64" not in context_json:
8282
return context
8383
try:
8484
carrier_get = _create_carrier_get(context_json)

tests/test_dsm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ def test_extract_context_data_streams_enabled_complete_context(self):
6464
self.assertEqual(kwargs["manual_checkpoint"], False)
6565
self.assertEqual(result, mock_context)
6666

67-
def test_extract_context_data_streams_enabled_incomplete_context(self):
67+
def test_extract_context_data_streams_enabled_invalid_context(self):
6868
with patch.dict(os.environ, {"DD_DATA_STREAMS_ENABLED": "true"}):
69-
context_json = {"dd-pathway-ctx-base64": "12345"}
69+
context_json = {"something-malformed": "12345"}
7070
event_type = "sqs"
7171
arn = "arn:aws:sqs:us-east-1:123456789012:test-queue"
7272

73-
mock_context = Context(trace_id=12345, span_id=None, sampling_priority=1)
73+
mock_context = Context(trace_id=12345, span_id=12345, sampling_priority=1)
7474
self.mock_extract.return_value = mock_context
7575

7676
result = _extract_context_with_data_streams(context_json, event_type, arn)

0 commit comments

Comments
 (0)