-
Notifications
You must be signed in to change notification settings - Fork 67
Support Trace Context extraction from Lambda Context object, and respect user-configured OTEL_PROPAGATORS #1191
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
Support Trace Context extraction from Lambda Context object, and respect user-configured OTEL_PROPAGATORS #1191
Conversation
…ect user-configured OTEL_PROPAGATORS
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1191 +/- ##
=============================================
- Coverage 85.71% 67.07% -18.64%
- Complexity 19 525 +506
=============================================
Files 3 54 +51
Lines 49 2694 +2645
Branches 5 376 +371
=============================================
+ Hits 42 1807 +1765
- Misses 3 750 +747
- Partials 4 137 +133 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
wangzlei
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…Muzzle Check (#1218) *Issue #, if available:* - https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/17954879038/job/51066448865 AWS Lambda Environment may or may not have the `getXrayTraceId` method in Lambda Context (from Lambda Core dependency). This will cause OTel's Muzzle Check to disable the AWS Lambda Instrumentation in the event that it isn't present, causing no Lambda Function Handler Span to appear Fix of previous PR: #1191 *Description of changes:* - Use `@NoMuzzle` annotation when accessing `getXrayTraceId` in Lambda Context Object, which avoids OTel's muzzle check. If `NoSuchMethodError` is caught, we do not try this logic again. - Add unit test for when `getXrayTraceId` throws `NoSuchMethodError`. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ect user-configured OTEL_PROPAGATORS (#1191) *Issue #, if available:* - In latest `com.amazonaws:aws-lambda-java-core:1.4.0`, Lambda Context has a new `lambdaContext.getXrayTraceId()` method. We need to use this over SystemProperty/EnvVar to support multi-concurrency in Lambda. *Description of changes:* - respect OTEL_PROPAGATORS Env Var priority - Priority logic BEFORE: - Create `carrierA` to contain headers from Lambda request http headers and the custom client context - get X-Ray Trace ID from (in order or priority) SystemProperty or EnvVar, add it to new `carrierB` - Use Global Propagator to extract trace context from `carrierB` (trace extraction only works if xray propagator is configured) - If above trace extraction results in a context that is not valid&sampled, try again with Global Propagator using `carrierA` - Priority logic AFTER: - Create `carrierA` to contain headers from Lambda request http headers and the custom client context - get X-Ray Trace ID from (in order or priority) Lambda Context, SystemProperty, or EnvVar, add it to `carrierA` (will overwrite x-ray header value if present from Lambda request http headers). - Use Global Propagator to extract trace context from `carrierA` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…Muzzle Check (#1218) *Issue #, if available:* - https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/17954879038/job/51066448865 AWS Lambda Environment may or may not have the `getXrayTraceId` method in Lambda Context (from Lambda Core dependency). This will cause OTel's Muzzle Check to disable the AWS Lambda Instrumentation in the event that it isn't present, causing no Lambda Function Handler Span to appear Fix of previous PR: #1191 *Description of changes:* - Use `@NoMuzzle` annotation when accessing `getXrayTraceId` in Lambda Context Object, which avoids OTel's muzzle check. If `NoSuchMethodError` is caught, we do not try this logic again. - Add unit test for when `getXrayTraceId` throws `NoSuchMethodError`. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ect user-configured OTEL_PROPAGATORS (#1191) *Issue #, if available:* - In latest `com.amazonaws:aws-lambda-java-core:1.4.0`, Lambda Context has a new `lambdaContext.getXrayTraceId()` method. We need to use this over SystemProperty/EnvVar to support multi-concurrency in Lambda. *Description of changes:* - respect OTEL_PROPAGATORS Env Var priority - Priority logic BEFORE: - Create `carrierA` to contain headers from Lambda request http headers and the custom client context - get X-Ray Trace ID from (in order or priority) SystemProperty or EnvVar, add it to new `carrierB` - Use Global Propagator to extract trace context from `carrierB` (trace extraction only works if xray propagator is configured) - If above trace extraction results in a context that is not valid&sampled, try again with Global Propagator using `carrierA` - Priority logic AFTER: - Create `carrierA` to contain headers from Lambda request http headers and the custom client context - get X-Ray Trace ID from (in order or priority) Lambda Context, SystemProperty, or EnvVar, add it to `carrierA` (will overwrite x-ray header value if present from Lambda request http headers). - Use Global Propagator to extract trace context from `carrierA` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…Muzzle Check (#1218) *Issue #, if available:* - https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/17954879038/job/51066448865 AWS Lambda Environment may or may not have the `getXrayTraceId` method in Lambda Context (from Lambda Core dependency). This will cause OTel's Muzzle Check to disable the AWS Lambda Instrumentation in the event that it isn't present, causing no Lambda Function Handler Span to appear Fix of previous PR: #1191 *Description of changes:* - Use `@NoMuzzle` annotation when accessing `getXrayTraceId` in Lambda Context Object, which avoids OTel's muzzle check. If `NoSuchMethodError` is caught, we do not try this logic again. - Add unit test for when `getXrayTraceId` throws `NoSuchMethodError`. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available:
com.amazonaws:aws-lambda-java-core:1.4.0, Lambda Context has a newlambdaContext.getXrayTraceId()method. We need to use this over SystemProperty/EnvVar to support multi-concurrency in Lambda.Description of changes:
carrierAto contain headers from Lambda request http headers and the custom client contextcarrierBcarrierB(trace extraction only works if xray propagator is configured)carrierAcarrierAto contain headers from Lambda request http headers and the custom client contextcarrierA(will overwrite x-ray header value if present from Lambda request http headers).carrierABy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.