-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(tracing): Add user data to tracestate
header
#3343
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
Changes from all commits
ba466c9
86ac6a3
a2ee549
2572ff4
ba14834
2a7b830
7cc1d39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,11 +40,6 @@ export class Transaction extends SpanClass implements TransactionInterface { | |
this._trimEnd = transactionContext.trimEnd; | ||
this._hub = hub || getCurrentHub(); | ||
|
||
// create a new sentry tracestate value if we didn't inherit one | ||
if (!this.metadata.tracestate?.sentry) { | ||
this.metadata.tracestate = { ...this.metadata.tracestate, sentry: this._getNewTracestate(this._hub) }; | ||
} | ||
|
||
// this is because transactions are also spans, and spans have a transaction pointer | ||
this.transaction = this; | ||
} | ||
|
@@ -117,6 +112,11 @@ export class Transaction extends SpanClass implements TransactionInterface { | |
}).endTimestamp; | ||
} | ||
|
||
// ensure that we have a tracestate to attach to the envelope header | ||
if (!this.metadata.tracestate?.sentry) { | ||
this.metadata.tracestate = { ...this.metadata.tracestate, sentry: this._getNewTracestate() }; | ||
} | ||
|
||
Comment on lines
+115
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I saw that this is not a new thing (it predates this PR) but why do we push tracestate in debug_meta ? If we didn't _getNewTracestate() could become private. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because it needs to get through to here somehow, and putting it in *If you look a few lines into the linked function, you'll see that in fact it gets pulled out of the eventual event payload. Same with the sampling data.
Is there any advantage to that over it being protected (which it is currently)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again it was just a nit, but in general I find |
||
const transaction: Event = { | ||
contexts: { | ||
trace: this.getTraceContext(), | ||
|
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.
What's going on here ? Doesn't seem to be related to the PR.
Uh oh!
There was an error while loading. Please reload this page.
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.
It actually is, though. The change here is from importing the type to importing the class. Later on in the file I'm calling
Hub.getScope()
, a method which exists on the class but isn't in the type, so if I don't make this change, it won't compile. The alternative to doing this is to add the method to the type, which I'm happy to do instead if you think that's better.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.
Understood, it's probably me (I'm not so familiar with this code) but it further raises the question why we don't have
getScope
in the interface ( since we do havepushScope
,popScope
,withScope
).Anyway, not the right place to discuss general architecture of the API.