Skip to content

Commit e0858f9

Browse files
smokepichlermarc
andauthored
fix(aws-sdk): use custom client_context prop (#2718)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
1 parent 6cce92b commit e0858f9

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

plugins/node/opentelemetry-instrumentation-aws-sdk/doc/lambda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ The following methods are automatically enhanced:
99
### Invoke
1010

1111
- 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) .
12-
- OpenTelemetry trace context is injected into the `ClientContext` parameter, allowing functions to extract this using the `Custom` property within the function.
12+
- OpenTelemetry trace context is injected into the `ClientContext` parameter, allowing functions to extract this using the `custom` property within the function.

plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/lambda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ const injectLambdaPropagationContext = (
109109

110110
const updatedClientContext = {
111111
...parsedClientContext,
112-
Custom: {
113-
...parsedClientContext.Custom,
112+
custom: {
113+
...parsedClientContext.custom,
114114
...propagatedContext,
115115
},
116116
};

plugins/node/opentelemetry-instrumentation-aws-sdk/test/lambda.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('Lambda', () => {
148148
'base64'
149149
).toString()
150150
) as Record<string, any>;
151-
expect(clientContext.Custom).toHaveProperty('traceparent');
151+
expect(clientContext.custom).toHaveProperty('traceparent');
152152
});
153153

154154
it('should skip context propagation in the event it would push the ClientContext over 3583 bytes', async () => {
@@ -168,7 +168,7 @@ describe('Lambda', () => {
168168

169169
const existingClientContext = Buffer.from(
170170
JSON.stringify({
171-
Custom: {
171+
custom: {
172172
text: [...Array(2600)]
173173
.map(x => String.fromCharCode(48 + Math.random() * 74))
174174
.join(''),
@@ -221,7 +221,7 @@ describe('Lambda', () => {
221221
),
222222
ClientContext: Buffer.from(
223223
JSON.stringify({
224-
Custom: {
224+
custom: {
225225
existing: 'data',
226226
},
227227
})
@@ -238,8 +238,8 @@ describe('Lambda', () => {
238238
'base64'
239239
).toString()
240240
) as Record<string, any>;
241-
expect(clientContext.Custom).toHaveProperty('existing', 'data');
242-
expect(clientContext.Custom).toHaveProperty('traceparent');
241+
expect(clientContext.custom).toHaveProperty('existing', 'data');
242+
expect(clientContext.custom).toHaveProperty('traceparent');
243243
});
244244

245245
it('should maintain any existing top-level fields in the client context', async () => {
@@ -265,7 +265,7 @@ describe('Lambda', () => {
265265
platform: 'Symbian',
266266
platformVersion: '9.2',
267267
},
268-
Custom: {
268+
custom: {
269269
existing: 'data',
270270
},
271271
};
@@ -293,7 +293,7 @@ describe('Lambda', () => {
293293
).toString()
294294
) as Record<string, any>;
295295
expect(updatedClientContext.env).toStrictEqual(clientContext.env);
296-
expect(updatedClientContext.Custom).toHaveProperty('traceparent');
296+
expect(updatedClientContext.custom).toHaveProperty('traceparent');
297297
});
298298

299299
// It probably should be valid JSON, and I'm not sure what the lambda internals make of it if

0 commit comments

Comments
 (0)