-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(browser): Use idle span for browser tracing #10957
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
Conversation
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.
Generally looks super good to me! There is one point that needs adressing: #10957 (comment).
const endTimestamp = latestEndTimestamp | ||
? Math.min(spanTimeInputToSeconds(timestamp), latestEndTimestamp) | ||
: timestamp; |
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.
Something looks off here. In one case we take spanTimeInputToSeconds(timestamp)
, in the other case we take timestamp
.
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.
this is fine here because we only need to convert it to a seconds timestamp for Math.min()
to work reliably, otherwise we can just pass the input through whatever it is!
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.
Ok, I assume because we convert it to the right unit downstream somewhere? Would you mind adding a (short) comment? This might confuse the next person coming across 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.
updated the whole code block a bit to hopefully clarify thigns!
packages/tracing-internal/src/browser/browserTracingIntegration.ts
Outdated
Show resolved
Hide resolved
packages/tracing-internal/src/browser/browserTracingIntegration.ts
Outdated
Show resolved
Hide resolved
And remove idle transaction.
And remove idle transaction.
With this, we can afterwards remove the span recorder, and everything related to it 🎉
I tried to keep all functionality intact. Some small cleanups I made:
trimEnd
option - we always set this to true anyhow). However, this only applies when the span is auto-ended by the idle functionality, not if manually callingspan.end()
- which is fine IMHO because that will usually not happen for users, and even so it's not the end of the world.continueTrace
for trace propagation of the pageload span.location
on the sampling context - we talked about this before, this is just gone, and users can instead either access the attributes from the sampling context, or just dowindow.location.href
themselves, which should have the same outcome.