Skip to content

feat(browser): Add option to ignore mark and measure spans #16443

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 4 commits into from
Jun 3, 2025

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jun 2, 2025

  • Adds ignorePerformanceApiSpans option that matches span names of mark and measure spans to a given array or RegExp
  • Adds unit tests
  • Adds integration test

Usage:

Sentry.init({
  dsn: '...',
  integrations: [
    Sentry.browserTracingIntegration({
      ignorePerformanceApiSpans: ['measure-ignore', /mark-to-ignore/],
    }),
  ],
  tracesSampleRate: 1,
});

closes #16441

@Lms24 Lms24 requested review from bcoe and s1gr1d June 2, 2025 11:57
@Lms24 Lms24 self-assigned this Jun 2, 2025
Copy link
Contributor

github-actions bot commented Jun 2, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.99 kB - -
@sentry/browser - with treeshaking flags 23.76 kB - -
@sentry/browser (incl. Tracing) 38.34 kB +0.14% +52 B 🔺
@sentry/browser (incl. Tracing, Replay) 76.48 kB +0.06% +45 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.59 kB +0.07% +42 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 81.24 kB +0.06% +41 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 93.32 kB +0.05% +44 B 🔺
@sentry/browser (incl. Feedback) 40.73 kB - -
@sentry/browser (incl. sendFeedback) 28.7 kB - -
@sentry/browser (incl. FeedbackAsync) 33.59 kB - -
@sentry/react 25.76 kB - -
@sentry/react (incl. Tracing) 40.33 kB +0.1% +40 B 🔺
@sentry/vue 28.34 kB - -
@sentry/vue (incl. Tracing) 40.18 kB +0.13% +50 B 🔺
@sentry/svelte 24.01 kB - -
CDN Bundle 25.48 kB - -
CDN Bundle (incl. Tracing) 38.52 kB +0.11% +39 B 🔺
CDN Bundle (incl. Tracing, Replay) 74.38 kB +0.07% +49 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 79.8 kB +0.06% +42 B 🔺
CDN Bundle - uncompressed 74.41 kB - -
CDN Bundle (incl. Tracing) - uncompressed 114.07 kB +0.16% +179 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 228.04 kB +0.08% +179 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 240.87 kB +0.08% +179 B 🔺
@sentry/nextjs (client) 42 kB +0.11% +44 B 🔺
@sentry/sveltekit (client) 38.84 kB +0.12% +45 B 🔺
@sentry/node 149.87 kB -0.01% -1 B 🔽
@sentry/node - without tracing 98.12 kB -0.01% -1 B 🔽
@sentry/aws-serverless 123.88 kB -0.01% -1 B 🔽

View base workflow run

@@ -149,7 +149,22 @@ export interface BrowserTracingOptions {
*
* Default: []
*/
ignoreResourceSpans: Array<string>;
ignoreResourceSpans: Array<'resouce.script' | 'resource.css' | 'resource.img' | 'resource.other' | string>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice type addition 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, realized we only made this addition in browsermetrics.ts rather than the user-facing option. Luckily not breaking :D

*
* Default: [] - By default, all `mark` and `measure` entries are sent as spans.
*/
ignoreMeasureSpans: Array<string | RegExp>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this not only applies to the measure spans...should we call this ignorePerformanceAPISpans or ignoreWebPerformanceSpans? 🤔

No hard opinion on that though as my proposed name might be too wide in its description.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had exactly the same feeling. Let's make a decision fast, as I agree the name doesn't really include mark spans.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is how we could extend this if people need granular options:

ignorePerformanceAPISpans: {
  mark:
  measure:
  ...
}

Copy link
Member Author

@Lms24 Lms24 Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the option to ignorePerformanceApiSpans in ae2cfb0. Thanks for bringing this up!

@Lms24 Lms24 merged commit ddec964 into develop Jun 3, 2025
125 checks passed
@Lms24 Lms24 deleted the lms/feat-browser-ignore-performance-spans branch June 3, 2025 07:19
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.

Add Option to ignore mark and measure spans
3 participants