-
-
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
Change tracesSampleRate after Sentry.init called #3324
Comments
API ideasSentry.updateOption import * as featureFlags from 'featureFlags';
await feautreFlags.syncFromServer();
Sentry.updateOption({
tracesSampleRate: featureFlags.get('enableSentryTracing') ? 0.10 : 0,
}); Allow function as tracesSampleRate value import * as featureFlags from 'featureFlags';
Sentry.init({
// ...
tracesSampleRate: () => featureFlags.get('enableSentryTracing')) ? 0.10 : 0,
}); |
Ahh! I see it in those docs, but it doesn't seem to be in the SDK/typing docs which I lean on a lot: https://getsentry.github.io/sentry-javascript/interfaces/types.options-1.html Thanks, I'll give it a try! |
Oh - that's quite out of date ( |
FWIW then sentry-electron is also on a pretty old version too (5.27.6) https://github.com/getsentry/sentry-electron/blob/master/package.json#L41 That's how I'm really using this. |
tracesSampleRate
option afterSentry.init
is called?Sentry.init
multiple times to change the value?I looked at the SDK and don't see an
updateOption()
that allows option values to be updated afterSentry.init
is called.Options.tracesSampleRate
is typed toundefined | number
. If there's no method that lets me update the value of options, maybe you could allow the value oftracesSampleRate
to be a function so I can dynamically decide what the sample rate is.Use case: I'd like to remotely control the
tracesSampleRate
option using our feature flags system. If something goes wrong with the implementation of tracing, we could flip off the feature flag and maketracesSampleRate
to go to0
. We build a long-lived Electron app, so we don't callSentry.init
on every page load like some web apps might.Thanks for building a great product! 🙏
The text was updated successfully, but these errors were encountered: