Skip to content

Commit 0b0ef90

Browse files
committed
lint and other fixes
1 parent 41d49ef commit 0b0ef90

File tree

2 files changed

+4
-32
lines changed

2 files changed

+4
-32
lines changed

datadog_lambda/tracing.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ def extract_context_custom_extractor(extractor, event, lambda_context):
155155
Extract Datadog trace context using a custom trace extractor function
156156
"""
157157
try:
158-
(
159-
trace_id,
160-
parent_id,
161-
sampling_priority,
162-
) = extractor(event, lambda_context)
158+
(trace_id, parent_id, sampling_priority,) = extractor(event, lambda_context)
163159
return trace_id, parent_id, sampling_priority
164160
except Exception as e:
165161
logger.debug("The trace extractor returned with error %s", e)
@@ -181,11 +177,9 @@ def extract_dd_trace_context(event, lambda_context, extractor=None):
181177
global dd_trace_context
182178

183179
if extractor is not None:
184-
(
185-
trace_id,
186-
parent_id,
187-
sampling_priority,
188-
) = extract_context_custom_extractor(extractor, event, lambda_context)
180+
(trace_id, parent_id, sampling_priority,) = extract_context_custom_extractor(
181+
extractor, event, lambda_context
182+
)
189183
elif "headers" in event:
190184
(
191185
trace_id,

tests/test_wrapper.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,6 @@ def lambda_handler(event, context):
105105
self.mock_inject_correlation_ids.assert_called()
106106
self.mock_patch_all.assert_called()
107107

108-
def test_datadog_lambda_wrapper_with_extractor(self):
109-
@datadog_lambda_wrapper
110-
def lambda_handler(event, context):
111-
lambda_metric("test.metric", 100)
112-
113-
lambda_event = {}
114-
115-
lambda_context = get_mock_context()
116-
117-
lambda_handler(lambda_event, lambda_context)
118-
119-
self.mock_metric_lambda_stats.distribution.assert_has_calls(
120-
[call("test.metric", 100, timestamp=None, tags=ANY)]
121-
)
122-
self.mock_wrapper_lambda_stats.flush.assert_called()
123-
self.mock_extract_dd_trace_context.assert_called_with(
124-
lambda_event, lambda_context, extractor=None
125-
)
126-
self.mock_set_correlation_ids.assert_called()
127-
self.mock_inject_correlation_ids.assert_called()
128-
self.mock_patch_all.assert_called()
129-
130108
def test_datadog_lambda_wrapper_flush_to_log(self):
131109
os.environ["DD_FLUSH_TO_LOG"] = "True"
132110

0 commit comments

Comments
 (0)