Skip to content

Step Functions Legacy Lambda Span Linking #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 12, 2024

Conversation

avedmala
Copy link
Contributor

@avedmala avedmala commented Aug 8, 2024

What does this PR do?

Step Function events that are from Legacy Lambda enter the layer wrapped in a Payload: {}. Here's an example

{'Payload': {'Execution': {'Id': 'arn:aws:states:sa-east-1:425362996713:execution:abhinav-legacy-lam-sf:ca7383bc-e370-4a85-a266-a4686bd7d00f', 'Input': {}, 'StartTime': '2024-08-08T18:55:03.805Z', 'Name': 'ca7383bc-e370-4a85-a266-a4686bd7d00f', 'RoleArn': 'arn:aws:iam::425362996713:role/service-role/StepFunctions-abhinav-test-1-role-4u48d0717', 'RedriveCount': 0}, 'StateMachine': {'Id': 'arn:aws:states:sa-east-1:425362996713:stateMachine:abhinav-legacy-lam-sf', 'Name': 'abhinav-legacy-lam-sf'}, 'State': {'Name': 'Lambda Invoke', 'EnteredTime': '2024-08-08T18:55:03.847Z', 'RetryCount': 0}}}

This change will check if events fall into this case and parse them accordingly so that we can extract the trace context and infer a span link between the Step Function and the downstream Legacy Lambda

Motivation

https://github.com/DataDog/logs-backend/pull/78707

Testing Guidelines

  • Added unit test case that will use the legacy lambda payload parsing logic

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@avedmala avedmala changed the title [SVLS-5052] Step Functions Legacy Lambda Span Linking Step Functions Legacy Lambda Span Linking Aug 8, 2024
@avedmala avedmala marked this pull request as ready for review August 12, 2024 12:27
@avedmala avedmala requested a review from a team as a code owner August 12, 2024 12:27
@@ -647,6 +648,33 @@ def test_step_function_trace_data(self):
expected_context,
)

def test_is_legacy_lambda_step_function(self):
sqs_event = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it doesn't matter much, but do we want to use the name sqs_event when we've written this for Step Functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I just copied this over from another test

Will update this

@avedmala avedmala merged commit d97d9bb into main Aug 12, 2024
51 checks passed
@avedmala avedmala deleted the avedmala/sf-legacy-lambda-span-link branch August 12, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants