Skip to content
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

Added support for Lambda lineage in X-Ray trace header #2480

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ezhang6811
Copy link
Contributor

@ezhang6811 ezhang6811 commented Jan 24, 2025

Update: will hold off on merging this PR until we have confirmed with Lambda that they are ready for this change in all of the OTel language SDKs. Please still provide review in the meantime.

Changes

For Lambda invocations, OpenTelemetry language SDK's are expected to support Lambda Lineage in the X-Ray trace header via W3C baggage. See this Java PR for similar solution in Java.

This PR updates X-Ray Propagator to extract Lineage attribute from X-Ray trace header and add it to baggage in context, as well as inject Lineage from baggage into trace header if it exists. Updated unit tests to verify Lineage is validated and propagated as expected.

There is currently little to no public documentation on the new V2 lineage header, though it has already been utilized for Lambda invocations for a few months. The existing available documentation tends to reference the V1 lineage format, which looks something like Lineage=a87bd80c:1|68fd508a:5|c512fbe3:2 in the X-Ray trace header. This format tracks up to 16 resource IDs with their respective counters to detect recursive Lambda calls, causing size issues with trace header storage in the past. The V2 Lineage follows the format <Counter><HashedString><Counter>, i.e. Lineage=200:e65a2c4d:11. The updated algorithm only tracks a single resource, preventing the header from ever exceeding 18 characters. We've confirmed via E2E tests that this is the Lineage format actively used for Lambda calls.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@ezhang6811 ezhang6811 requested a review from a team as a code owner January 24, 2025 23:42
@github-actions github-actions bot requested review from ppittle and srprash January 24, 2025 23:42
@github-actions github-actions bot added the comp:extensions.aws Things related to OpenTelemetry.Extensions.AWS label Jan 24, 2025
@ezhang6811 ezhang6811 force-pushed the zhaez/lineage-trace-propagation branch from 0e04e72 to 84abfca Compare January 27, 2025 18:57
@ppittle
Copy link
Member

ppittle commented Jan 27, 2025

@AsakerMohd - given your familiarity with the code, can you also review?

@ezhang6811 ezhang6811 marked this pull request as draft January 28, 2025 19:54
@ezhang6811 ezhang6811 marked this pull request as ready for review January 29, 2025 22:24
@ezhang6811 ezhang6811 marked this pull request as draft January 29, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:extensions.aws Things related to OpenTelemetry.Extensions.AWS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants