diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/doc/lambda.md b/plugins/node/opentelemetry-instrumentation-aws-sdk/doc/lambda.md index dbccf3365f..5e091c4439 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/doc/lambda.md +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/doc/lambda.md @@ -9,4 +9,4 @@ The following methods are automatically enhanced: ### Invoke - Attributes are added by this instrumentation according to the [spec for Outgoing Invocations of a FaaS from a client](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/faas.md#outgoing-invocations) . -- OpenTelemetry trace context is injected into the `ClientContext` parameter, allowing functions to extract this using the `Custom` property within the function. +- OpenTelemetry trace context is injected into the `ClientContext` parameter, allowing functions to extract this using the `custom` property within the function. diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts index 3970c3c098..d07712beeb 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts @@ -109,8 +109,8 @@ const injectLambdaPropagationContext = ( const updatedClientContext = { ...parsedClientContext, - Custom: { - ...parsedClientContext.Custom, + custom: { + ...parsedClientContext.custom, ...propagatedContext, }, }; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/lambda.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/lambda.test.ts index e7857aeabf..111f732eee 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/lambda.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/lambda.test.ts @@ -148,7 +148,7 @@ describe('Lambda', () => { 'base64' ).toString() ) as Record; - expect(clientContext.Custom).toHaveProperty('traceparent'); + expect(clientContext.custom).toHaveProperty('traceparent'); }); it('should skip context propagation in the event it would push the ClientContext over 3583 bytes', async () => { @@ -168,7 +168,7 @@ describe('Lambda', () => { const existingClientContext = Buffer.from( JSON.stringify({ - Custom: { + custom: { text: [...Array(2600)] .map(x => String.fromCharCode(48 + Math.random() * 74)) .join(''), @@ -221,7 +221,7 @@ describe('Lambda', () => { ), ClientContext: Buffer.from( JSON.stringify({ - Custom: { + custom: { existing: 'data', }, }) @@ -238,8 +238,8 @@ describe('Lambda', () => { 'base64' ).toString() ) as Record; - expect(clientContext.Custom).toHaveProperty('existing', 'data'); - expect(clientContext.Custom).toHaveProperty('traceparent'); + expect(clientContext.custom).toHaveProperty('existing', 'data'); + expect(clientContext.custom).toHaveProperty('traceparent'); }); it('should maintain any existing top-level fields in the client context', async () => { @@ -265,7 +265,7 @@ describe('Lambda', () => { platform: 'Symbian', platformVersion: '9.2', }, - Custom: { + custom: { existing: 'data', }, }; @@ -293,7 +293,7 @@ describe('Lambda', () => { ).toString() ) as Record; expect(updatedClientContext.env).toStrictEqual(clientContext.env); - expect(updatedClientContext.Custom).toHaveProperty('traceparent'); + expect(updatedClientContext.custom).toHaveProperty('traceparent'); }); // It probably should be valid JSON, and I'm not sure what the lambda internals make of it if