Skip to content

Lambda PassThrough trace header support #660

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 1 commit into from
Jun 10, 2024
Merged

Conversation

majanjua-amzn
Copy link
Contributor

@majanjua-amzn majanjua-amzn commented Jun 7, 2024

Lambda trace header with passthrough will be missing parent and sampled attributes, we should be able to support this.

Description of changes:

  • Detect lambda trace context and mark segments with noOp attribute, signifying passthrough mode
  • Propagate this attribute to subsegments when they are added
  • Detect noOp attribute to stop trace context propagation in passthrough mode
  • Unit test checking if segment generated with passthrough behaviour (segment.noOp == true) results in the trace header not being propagated as expected

Testing:
Tested appropriate behaviour using two lambda functions:

  • Lambda A (passthrough) calls Lambda B (active): [x]
  • Lambda A (active) calls Lambda B (active):

And tested combinations of the following:

  • Lambda function with old passthrough behaviour
  • Lambda function with new passthrough behaviour
  • Lambda function with AWS SDK v2
  • Lambda function with AWS SDK v3

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@majanjua-amzn majanjua-amzn requested a review from a team as a code owner June 7, 2024 23:19
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.57%. Comparing base (1502470) to head (5cc208c).

Current head 5cc208c differs from pull request most recent head dd12415

Please upload reports for the commit dd12415 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #660      +/-   ##
==========================================
+ Coverage   83.49%   83.57%   +0.07%     
==========================================
  Files          37       37              
  Lines        1806     1814       +8     
==========================================
+ Hits         1508     1516       +8     
  Misses        298      298              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@wangzlei wangzlei left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jj22ee jj22ee left a comment

Choose a reason for hiding this comment

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

There is one more patcher (fetch) that is introduced in sdk_contrib folder, can we confirm if your changes need to be applied to this one as well.
https://github.com/aws/aws-xray-sdk-node/blob/master/sdk_contrib/fetch/lib/fetch_p.js#L107-L110

Copy link
Contributor

@jj22ee jj22ee left a comment

Choose a reason for hiding this comment

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

Thanks!

@jj22ee jj22ee merged commit e7152b8 into aws:master Jun 10, 2024
13 checks passed
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.

4 participants