Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ const injectLambdaPropagationContext = (

const updatedClientContext = {
...parsedClientContext,
Custom: {
...parsedClientContext.Custom,
custom: {
...parsedClientContext.custom,
...propagatedContext,
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('Lambda', () => {
'base64'
).toString()
) as Record<string, any>;
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 () => {
Expand All @@ -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(''),
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('Lambda', () => {
),
ClientContext: Buffer.from(
JSON.stringify({
Custom: {
custom: {
existing: 'data',
},
})
Expand All @@ -238,8 +238,8 @@ describe('Lambda', () => {
'base64'
).toString()
) as Record<string, any>;
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 () => {
Expand All @@ -265,7 +265,7 @@ describe('Lambda', () => {
platform: 'Symbian',
platformVersion: '9.2',
},
Custom: {
custom: {
existing: 'data',
},
};
Expand Down Expand Up @@ -293,7 +293,7 @@ describe('Lambda', () => {
).toString()
) as Record<string, any>;
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
Expand Down