Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion datadog_lambda/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ def is_legacy_lambda_step_function(event):
"""
Check if the event is a step function that called a legacy lambda
"""
event = event.get("Payload", {})
if not isinstance(event, dict) or "Payload" not in event:
return False

event = event.get("Payload")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Quality Violation

variable name is the same as a function parameter (...read more)

A function parameter should only be read and not be modified. If your intent is to modify the value of the parameter, return the value in the function and handle the new value in the caller of the function.

View in Datadog  Leave us feedback  Documentation

return "Execution" in event and "StateMachine" in event and "State" in event


Expand Down
3 changes: 3 additions & 0 deletions tests/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ def test_is_legacy_lambda_step_function(self):
}
self.assertFalse(is_legacy_lambda_step_function(sf_event))

other_event = ["foo", "bar"]
self.assertFalse(is_legacy_lambda_step_function(other_event))


class TestXRayContextConversion(unittest.TestCase):
def test_convert_xray_trace_id(self):
Expand Down
Loading