You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
OpenTelemetry auto-instrumentation for AWS Lambda is not correctly propagating parent span IDs when using the AWS Lambda Layer (otel-nodejs) in a TypeScript-based Lambda.
JavaScript Lambdas work correctly.
TypeScript Lambdas drop parent spans, causing traces to appear disconnected in the tracing backend.
What did you expect to see?
The parent span ID should be propagated correctly.
Traces should be connected to the parent spans.
What did you see instead?
No parent span ID is retained.
The trace appears disconnected in the tracing backend.
This is a single lambda invocation with no parent ID and every span is seperated.
Additional context
If I manually propagate a parent trace through the lambda we'll be able to preserve the parent ID and trace continuity, I expect the lambda layer to autoinstrument the parent ID.
// Propagate traceparent if available
let ctx = context.active();
if (traceparentHeader) {
ctx = propagation.extract(ctx, { traceparent: traceparentHeader });
}
`
This forces a parent span and connects the traces, but shouldn't be necessary if the OpenTelemetry AWS Lambda layer is functioning correctly.
We've ruled out
lambda layer configuration
node versioning
layer version
secretsmanager lambda layer
custom logging packages
potential async issues
Questions for Maintainers
Is this a known issue with OpenTelemetry auto-instrumentation in TypeScript-based AWS Lambdas?
Is there a recommended workaround to ensure traces remain linked without requiring manual propagation?
Could ESBuild bundling or Lambda execution order interfere with OpenTelemetry’s automatic instrumentation?
The text was updated successfully, but these errors were encountered:
As far as I see from your example (listed spans), there is no AWS Lambda invocation span for the TypeScript Lambda. So it thinks me that your Lambda handler is not auto instrumented (wrapped) and it might be caused by ESBuild.
So, can you be sure that when you build your TypeScript Lambda with ESBuild, the handler name you set to Lambda configuration points to the valid point in the built/generated JS file by the ESBuild?
Describe the Bug
OpenTelemetry auto-instrumentation for AWS Lambda is not correctly propagating parent span IDs when using the AWS Lambda Layer (otel-nodejs) in a TypeScript-based Lambda.
What did you expect to see?
What did you see instead?
This is a single lambda invocation with no parent ID and every span is seperated.
What version of collector/language SDK version did you use?
What language layer did you use?
nodejs
Additional context
If I manually propagate a parent trace through the lambda we'll be able to preserve the parent ID and trace continuity, I expect the lambda layer to autoinstrument the parent ID.
` // Extract traceparent from headers
const headers = event.headers || {};
const traceparentHeader = headers['traceparent'];
// Propagate traceparent if available
let ctx = context.active();
if (traceparentHeader) {
ctx = propagation.extract(ctx, { traceparent: traceparentHeader });
}
`
This forces a parent span and connects the traces, but shouldn't be necessary if the OpenTelemetry AWS Lambda layer is functioning correctly.
We've ruled out
Questions for Maintainers
The text was updated successfully, but these errors were encountered: