Skip to content

Propagate Step Function Trace Context through Managed Services #667

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

ryanstrat
Copy link

@ryanstrat ryanstrat commented Jul 15, 2025

What does this PR do?

This PR adds support for extracting step function trace context in the following cases:

  1. SFN -> EventBridge -> Lambda
  2. SFN -> EventBridge -> SQS -> Lambda
  3. SFN -> SQS -> Lambda
  4. SFN -> SNS -> Lambda
  5. SFN -> SNS -> SQS -> Lambda

Motivation

This PR adds feature parity to the JS libraries to match functionality in the python tracing library: DataDog/datadog-lambda-python#573

Testing Guidelines

I published a private layer to the ddserverless account and verified that all cases produced the intended traces. The resulting traces are below.

  1. SFN -> EventBridge -> Lambda
SFN-EVB-Lambda
  1. SFN -> EventBridge -> SQS -> Lambda
SFN-EVB-SQS-Lambda
  1. SFN -> SQS -> Lambda
SFN-SQS-Lambda
  1. SFN -> SNS -> Lambda
SFN-SNS-Lambda
  1. SFN -> SNS -> SQS -> Lambda
SFN-SNS-SQS-Lambda

Additional Notes

Minor update to the publish script follows a patter from other layers to allow adding a suffix for test layer releases.

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)

Comment on lines +11 to +18
if (stepFunctionContext !== undefined) {
const spanContext = stepFunctionInstance.spanContext;
if (spanContext !== null) {
return spanContext;
}
}

return instance.spanContext;
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel like this code is exactly the same

@ryanstrat ryanstrat force-pushed the ryan.strat/sfn-managed-services branch from c5130af to a813a29 Compare July 24, 2025 15:02
@ryanstrat ryanstrat marked this pull request as ready for review July 24, 2025 15:59
@ryanstrat ryanstrat requested review from a team as code owners July 24, 2025 15:59
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