-
-
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(browser): Add previous_trace
span links
#15569
Conversation
size-limit report 📦
|
66ec822
to
45bc790
Compare
previousTraceInfo = addPreviousTraceSpanLink(previousTraceInfo, span); | ||
|
||
if (persistPreviousTrace) { | ||
storePreviousTraceInSessionStorage(previousTraceInfo); | ||
} |
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.
I think all this code around the previous trace can be put in here. Then there is also no need to mutate the variable or store undefined
in a variable if persisting is turned off.
previousTraceInfo = addPreviousTraceSpanLink(previousTraceInfo, span); | |
if (persistPreviousTrace) { | |
storePreviousTraceInSessionStorage(previousTraceInfo); | |
} | |
if (persistPreviousTrace) { | |
const updatedPreviousTraceInfo = addPreviousTraceSpanLink( | |
getPreviousTraceFromSessionStorage(), span | |
) | |
storePreviousTraceInSessionStorage(updatedPreviousTraceInfo); | |
} |
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.
Happy to rewrite this but I still need to call addPreviousTraceSpanLink
if persistPreviousTrace
is false (as by default). Let me take another look
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.
I rewrote this a bit based on your suggestion as well as on unifying the two options. b44e790
0550ac6
to
6c42afd
Compare
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.
Such nice API 🥇
This PR adds logic to set the
previous_trace
span link on root spans (viabrowserTracingIntegration
).Some notes:
linkPreviousTrace
integration option to control the trace linking behaviour:in-memory
- default - previous trace data is linked and stored in memorysession-storage
- previous trace data is linked and stored in session storageoff
- no previous trace data is stored or linkedtracesSampler
but this I'll tackle via Add possibility to sample subsequent traces based on previous trace sampling decision #15754browserTracingIntegration
, meaning there's no bundle size hit for error-only users or users who only send manual spans (the latter is a tradeoff but I think it's a fair one)Happy to bike shed on the options naming :D
closes #14992
UPDATE: I rewrote the public API options from having two options (
enablePreviousTrace
andpersistPreviousTrace
) to only one which controls both aspects.