DataDog / datadog-lambda-js

The Datadog AWS Lambda Library for Node
Apache License 2.0
109 stars 35 forks source link

Step Functions Legacy Lambda Span Linking #567

Closed avedmala closed 1 month ago

avedmala commented 1 month ago

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

Additional Notes

Types of Changes

Check all that apply