-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -365,6 +375,9 @@ export class Scope implements ScopeInterface { | |||
if (captureContext.requestSession) { | |||
this._requestSession = captureContext.requestSession; | |||
} | |||
if (captureContext.propagationContext) { | |||
this._propagationContext = captureContext.propagationContext; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah something we can keep in mind, I'll leave a note.
@@ -492,6 +492,28 @@ describe('BaseClient', () => { | |||
); | |||
}); | |||
|
|||
test('it adds a trace context all events', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
PropagationContext
and 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.