Commit 551937d
authored
Support Trace Context extraction from Lambda Context object, and respect 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.1 parent d236d79 commit 551937d
File tree
3 files changed
+366
-53
lines changed- lambda-layer
- patches
3 files changed
+366
-53
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments