Skip to content

feat(core): Implement suppressTracing #11468

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
Apr 10, 2024
Merged

feat(core): Implement suppressTracing #11468

merged 4 commits into from
Apr 10, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Apr 8, 2024

This implements a new suppressTracing method which can be used to ensure we do not send any spans inside of a callback.

Usage:

await suppressTracing(() => {
  // do not capture any spans for this fetch!
  return fetch(...);
});

This also changes the behavior of starting child spans slightly to actually create NonRecordingSpan as child spans when not sampled (previously, we'd still create SentrySpans). I choose to continue to create proper spans for unsampled transactions because it makes things like picking name and stuff like this easier for the time being.

@mydea mydea requested review from lforst and s1gr1d April 8, 2024 08:05
@mydea mydea self-assigned this Apr 8, 2024
@lforst
Copy link
Contributor

lforst commented Apr 8, 2024

We need a browser version of this utility. The symbolification in Next.js is isomorphic.

@mydea
Copy link
Member Author

mydea commented Apr 8, 2024

We need a browser version of this utility. The symbolification in Next.js is isomorphic.

damn, I guess we'll need to put this on the ACS then, as this means we'll have to export this from core and use a different implementation. will look into it!

@lforst
Copy link
Contributor

lforst commented Apr 8, 2024

I don't think ACS is the right place tbh. Can we just have two different exports that have the exact same interface?

mydea added 3 commits April 9, 2024 16:09
This exports a new `suppressTracing` utility from `@sentry/opentelemetry` which can be used to wrap a callback to avoid tracing inside of it. We use this for bun transport, and for nextjs error symbolication.
@mydea mydea force-pushed the fn/suppressTracing branch from 702d5d9 to 65d4c30 Compare April 9, 2024 14:09
@mydea mydea changed the title fix(node): Ensure tracing is suppressed for all generated requests feat(core): Implement suppressTracing Apr 9, 2024
Copy link
Contributor

github-actions bot commented Apr 9, 2024

size-limit report 📦

Path Size
@sentry/browser 22.07 KB (0%)
@sentry/browser (incl. Tracing) 31.75 KB (+0.19% 🔺)
@sentry/browser (incl. Tracing, Replay) 66.95 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 60.54 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) 70.79 KB (+0.1% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) 75.71 KB (+0.08% 🔺)
@sentry/browser (incl. Feedback) 30.84 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal) 30.86 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal, Feedback Screenshot) 30.87 KB (0%)
@sentry/browser (incl. sendFeedback) 26.86 KB (0%)
@sentry/react 24.75 KB (0%)
@sentry/react (incl. Tracing) 34.65 KB (+0.19% 🔺)
@sentry/vue 25.56 KB (+0.24% 🔺)
@sentry/vue (incl. Tracing) 33.47 KB (+0.15% 🔺)
@sentry/svelte 22.2 KB (0%)
CDN Bundle 24.08 KB (0%)
CDN Bundle (incl. Tracing) 32.68 KB (+0.16% 🔺)
CDN Bundle (incl. Tracing, Replay) 66.38 KB (+0.06% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) 71.66 KB (+0.09% 🔺)
CDN Bundle - uncompressed 71.62 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 97.81 KB (+0.16% 🔺)
CDN Bundle (incl. Tracing, Replay) - uncompressed 207.21 KB (+0.08% 🔺)
@sentry/nextjs (client) 33.84 KB (+0.17% 🔺)
@sentry/sveltekit (client) 32.26 KB (+0.17% 🔺)
@sentry/node 120.1 KB (+0.06% 🔺)

@mydea mydea merged commit 15d6cb1 into develop Apr 10, 2024
@mydea mydea deleted the fn/suppressTracing branch April 10, 2024 09:53
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this pull request Apr 19, 2024
This implements a new `suppressTracing` method which can be used to
ensure we do not send any spans inside of a callback.

Usage:

```js
await suppressTracing(() => {
  // do not capture any spans for this fetch!
  return fetch(...);
});
```

This also changes the behavior of starting child spans slightly to
actually create `NonRecordingSpan` as child spans when not sampled
(previously, we'd still create SentrySpans). I choose to continue to
create proper spans for unsampled transactions because it makes things
like picking name and stuff like this easier for the time being.
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