feat(core/client): propagate w3c trace headers#8156
Conversation
| const invokeStore = await InvokeStore.getInstanceAsync(); | ||
| const traceIdFromInvokeStore = invokeStore?.getXRayTraceId(); | ||
| const traceId = traceIdFromInvokeStore ?? traceIdFromEnv; | ||
| { |
There was a problem hiding this comment.
When traceparent is already set in request headers (ie: by user), the current logic still unconditionally injects tracestate and baggage from InvokeStore. Do we want this? From the spec, I understand it differently
Section 3.4: "If the value of the traceparent field wasn't changed before propagation, tracestate MUST NOT be modified as well."
WDYT?
There was a problem hiding this comment.
I didn't read the spec initially, only copied the code function.
I think this is a good catch, I've updated this in the 2nd commit to only take the secondary headers from invokeStore if the traceparent was from the invokeStore.
There was a problem hiding this comment.
I agree. that's what i was doing in the original code
There was a problem hiding this comment.
As a note. Sanitization is the only thing we should do regardless.
3.2.1 Header Name
Header name: traceparent
In order to increase interoperability across multiple protocols and encourage successful integration, by default vendors SHOULD keep the header name lowercase. The header name is a single word without any delimiters, for example, a hyphen (-).
Vendors MUST expect the header name in any case (upper, lower, mixed), and SHOULD send the header name in lowercase.
There was a problem hiding this comment.
@darklight3it oh, I see. I converted the code incorrectly, thanks.
Issue
modified from #8147
Description
propagate
traceparenttracestatebaggageheaders from Lambda invoke store.Testing
CI, new unit tests
Checklist
*.integ.spec.ts) or E2E tests.@public,@internaltags and enabled doc generation on the package. Remember that access level annotations go below the description, not above.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.