Added support for Lambda lineage in X-Ray trace header #2480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CHANGELOG.md
files updated for non-trivial changes