Skip to content

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

Merged
merged 9 commits into from
Mar 8, 2024
Merged

Conversation

mydea
Copy link
Member

@mydea mydea commented Mar 7, 2024

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:

  • idle span finish reason is kept as an attribute - to keep backwards compat I finally also write it as a tag on the transaction event
  • idle span trimming happens automatically now (no more 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 calling span.end() - which is fine IMHO because that will usually not happen for users, and even so it's not the end of the world.
  • We now use continueTrace for trace propagation of the pageload span.
  • no more 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 do window.location.href themselves, which should have the same outcome.

@mydea mydea requested review from lforst, Lms24, AbhiPrasad and s1gr1d March 7, 2024 09:33
@mydea mydea self-assigned this Mar 7, 2024
Copy link
Contributor

github-actions bot commented Mar 7, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 77.08 KB (-0.62% 🔽)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 68.32 KB (-0.71% 🔽)
@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped) 72.2 KB (-0.69% 🔽)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61.88 KB (-0.76% 🔽)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.56 KB (-1.44% 🔽)
@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped) 32.56 KB (-1.44% 🔽)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.36 KB (-0.01% 🔽)
@sentry/browser (incl. sendFeedback) - Webpack (gzipped) 31.36 KB (-0.02% 🔽)
@sentry/browser - Webpack (gzipped) 22.56 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing, Replay, Feedback) - CDN Bundle (gzipped) 75.19 KB (-0.58% 🔽)
@sentry/browser (incl. Tracing, Replay) - CDN Bundle (gzipped) 66.81 KB (-0.64% 🔽)
@sentry/browser (incl. Tracing) - CDN Bundle (gzipped) 32.66 KB (-1.28% 🔽)
@sentry/browser - CDN Bundle (gzipped) 24.01 KB (-0.02% 🔽)
@sentry/browser (incl. Tracing, Replay) - CDN Bundle (minified & uncompressed) 209.38 KB (-0.78% 🔽)
@sentry/browser (incl. Tracing) - CDN Bundle (minified & uncompressed) 98.18 KB (-1.65% 🔽)
@sentry/browser - CDN Bundle (minified & uncompressed) 71.74 KB (-0.02% 🔽)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 68.56 KB (-0.71% 🔽)
@sentry/react - Webpack (gzipped) 22.6 KB (-0.02% 🔽)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 85.06 KB (-0.5% 🔽)
@sentry/nextjs Client - Webpack (gzipped) 49.46 KB (-0.89% 🔽)
@sentry-internal/feedback - Webpack (gzipped) 17.41 KB (-0.02% 🔽)

Copy link
Contributor

@lforst lforst left a 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).

Comment on lines 119 to 121
const endTimestamp = latestEndTimestamp
? Math.min(spanTimeInputToSeconds(timestamp), latestEndTimestamp)
: timestamp;
Copy link
Contributor

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.

Copy link
Member Author

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!

Copy link
Contributor

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 ^^

Copy link
Member Author

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!

@mydea mydea force-pushed the fn/use-idle-span branch from 32600d3 to 79c4777 Compare March 7, 2024 16:43
@mydea mydea force-pushed the fn/use-idle-span branch from 9024d02 to ea15c1a Compare March 7, 2024 18:08
@mydea mydea merged commit 7634a76 into develop Mar 8, 2024
@mydea mydea deleted the fn/use-idle-span branch March 8, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants