NodeJS Lambda Layer: X-Ray propagation not working
Describe the bug
After following https://aws-otel.github.io/docs/getting-started/lambda/lambda-js to add a layer to my lambda function I can see traces being generated, and showing up in X-Ray. However, no HTTP services that this function calls are connected to the trace. Looking at the HTTP headers received by a downstream I see Traceparent: set correctly, but no X-Amzn-Trace-Id: - indicating that auto-instrumentation & propagation is working, but not with the X-Ray propagator.
Looking at the logs I see the lines:
Registering OpenTelemetry
Propagator "xray" requested through environment variable is unavailable.
I know opentelemetry-js currently doesn't support setting the propagator via the OTEL_PROPAGATORS environment variable (https://github.com/open-telemetry/opentelemetry-js/pull/4727) - but I saw you have in place something that looks like it could be workaround, manually intialising an X-Ray propagator: https://github.com/aws-observability/aws-otel-lambda/blob/b685c99d626e6e71034c69369bda00317665602f/nodejs/wrapper-adot/src/adot-extension.ts
By changing that code to always set global.configureSdkRegistration, rather than only do it when OTEL_PROPAGATORS is falsey results in trace propagation working correctly. I confirmed this by making the change, running build.sh and using the resulting lambda layer with my function.
What version of collector/language SDK version did you use?
Collector: v0.39.0
Lambda instrumentation: v0.41.0
OpenTelemetry for Javascript: v1.18.1
What language layer did you use?
Config: NodeJS
This issue is stale because it has been open 90 days with no activity. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled
This issue was closed because it has been marked as stale for 30 days with no activity.