File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
aws-distro-opentelemetry-node-autoinstrumentation/src/patches Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -106,11 +106,9 @@ export function applyInstrumentationPatches(instrumentations: Instrumentation[])
106106
107107/*
108108 * This function `customExtractor` is used to extract SpanContext for AWS Lambda functions.
109- * It first attempts to extract the trace context from the Lambda Handler Context object (_handlerContext.xRayTraceId)
110- * If above approach fails, attempt to extract the trace context from the AWS X-Ray header, which is stored in the Lambda environment variables.
111- * If a valid span context is extracted from the environment, it uses this as the parent context for the function's tracing.
112- * If the X-Ray header is missing or invalid, it falls back to extracting trace context from the Lambda handler's event headers.
113- * If neither approach succeeds, it defaults to using the root Otel context, ensuring the function is still instrumented for tracing.
109+ * It extracts the X-Ray trace ID from the Lambda environment variable (_X_AMZN_TRACE_ID) and adds it to the event headers.
110+ * It then uses OpenTelemetry propagation to extract trace context from both the event headers and Lambda context.
111+ * If a valid span context is extracted, it returns that context; otherwise, it returns the root context.
114112 */
115113const lambdaContextXrayTraceIdKey = 'xRayTraceId' ;
116114export const customExtractor = ( event : any , _handlerContext : Context ) : OtelContext => {
You can’t perform that action at this time.
0 commit comments