feat(tracing): Add PropagationContext to scope #8421
Conversation
|
I know this needs more tests, I'm planning to add some integration tests after some more twp tasks are merged in. |
size-limit report 📦
|
Lms24
left a comment
There was a problem hiding this comment.
LGTM! Good point about tests and I agree that it's better to wait until all important parts are implemented and then add integration tests.
| } | ||
| if (captureContext.propagationContext) { | ||
| this._propagationContext = captureContext.propagationContext; | ||
| } |
There was a problem hiding this comment.
Hmm seems like we have quite some duplicated logic here when distinguishing between captureContext being a class instance or a plain object. No action required in this PR but we should probable deduplicate this.
There was a problem hiding this comment.
Yeah something we can keep in mind, I'll leave a note.
| ); | ||
| }); | ||
|
|
||
| test('it adds a trace context all events', () => { |
There was a problem hiding this comment.
super-l:
| test('it adds a trace context all events', () => { | |
| test('it adds a trace context to all events', () => { |
There was a problem hiding this comment.
Will update in the next PR!
Requires #8421 to be merged ref #8352 This PR adds support for https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md via propagation context. When the Node SDK initializes, it grabs `process.env.SENTRY_TRACE` and `process.env.SENTRY_BAGGAGE` and uses them to populate the existing propagation context. In future PRs (tracked by #8352), we will be adding support for transactions/outgoing requests to use propagation context, but for now we are only storing in propagation context, not doing anything with it.
ref #8352
For more details about PropagationContext, see https://www.notion.so/sentry/Tracing-without-performance-efab307eb7f64e71a04f09dc72722530
Building off of work in both #8403 and #8418, this PR adds
PropagationContextand uses that to always set a trace context on outgoing error events.Currently if there is an active span on the scope, we automatically attach that span's trace context to all outgoing events. Now, we want to rely on either the active span or fallback to the propagation context to ensure that there is always a trace being generated and propagated.
Next up we'll work on updating the node/browser SDKs to update the propagation context. For example, we should update the propagation context for node based on the incoming sentry-trace/baggage headers.