feat: Add XRayExtractor to obtain Trace ID from environment (#494). - #510
Conversation
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #510 +/- ##
=======================================
+ Coverage 76.4% 77.0% +0.5%
=======================================
Files 127 130 +3
Lines 24255 24795 +540
=======================================
+ Hits 18539 19093 +554
+ Misses 5716 5702 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@jj22ee Could you review? |
cijothomas
left a comment
There was a problem hiding this comment.
Not an AWS expert to formally review. There isn't anyone from AWS reviewing either.
All comments addressed and |
|
After some more work with X-Ray Trace ID (based off SQS messages, to come) I decided to restructure the logic around Trace ID - instead of using the environment variable as basis and overwriting it with the header value, the map with values will now contain both values and it's the responsibility of the propagator to select which value is used (preferable the header and using the environment variable as fallback). This will pave the way for the next step which will add the Trace ID based off SQS message attributes as a third source of Trace ID. |
|
Please update the branch to resolve merge conflicts |
|
@johannesfloriangeiger Can you rebase and resolve conflicts please? This is good to merge then. |
…-lambda-trace-id # Conflicts: # opentelemetry-aws/CHANGELOG.md # opentelemetry-aws/Cargo.toml
|
Apologies @chinmaychahar and @cijothomas, as this has been sitting around for some time I forgot to check in! |
No worries. We are still sorting out this repo's processes and @chinmaychahar has stepped up to own AWS components recently! |
Fixes #494
Changes
See title: Adds an XRayExtractor to obtain the Trace ID from an environment variable.
With the XRayPropagator looking for the
x-amzn-trace-idfield in the extractor, setting the context based on a Lambda invocation alone required extracting the Trace ID via the environment variable_X_AMZN_TRACE_IDwhen wanting to set the correct context. The XRayExtractor combines the extraction of the Trace ID from an HTTP header or, as a fallback, from the aforementioned environment variable.Example use:
main.rs
Start with
OTEL_SERVICE_NAME=HTTPRustLambda cargo lambda watch, invoke withcargo lambda invoke --data-ascii '{}', see how the initial Trace ID differs from the environment variable and how after attaching the context the Trace ID is correct then.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changes