Best way to turn off auto-breadcrumbs
Is this the quickest way to turn off default breadcrumbs?
Sentry.init({
integrations: [new Sentry.Integrations.Breadcrumbs({
console: false,
dom: false,
xhr: false,
fetch: false,
beacon: false,
history: false,
})]
})
Documenting here in case anyone else is wondering as can't find specific docs...
No, just remove Breadcrumbs integration - https://docs.sentry.io/platforms/javascript/#removing-an-integration :)
Sentry.init({
dsn: 'https://[email protected]/1',
integrations(integrations) {
return integrations.filter(integration => integration.name !== 'Breadcrumbs');
}
});
@kamilogorek It looks like you should actually be filtering on integration.name not integration.id as the integration objects do not have a key named id. Also the documentation needs to be updated.
@pljeskavica right, thanks for catching that! PR https://github.com/getsentry/sentry-docs/pull/568
This does not work anymore :/
@StarryFire how so? Can you provide your configuration? It should still work just fine
This does not work anymore :/
I just tried and it works. Check if you spelled it correctly, that was my mistake xD
Documentation URL for the solution seems to have changed: https://docs.sentry.io/platforms/javascript/configuration/integrations/default/#removing-an-integration
I tried many things but for some reason couldn't make it work, so instead I used
Sentry.init({ dsn: config.SENTRY_DSN, maxBreadcrumbs: 0 })
Documented here https://docs.sentry.io/platforms/javascript/configuration/options/#max-breadcrumbs
I unsucessfully tried variations of this:
Sentry.init({
dsn: config.SENTRY_DSN,
integrations: (integrations) => {
return integrations
.filter((integration) => {
return integration.name !== 'Breadcrumbs'
})
.map((integration) => {
if (integration.name === 'Http') {
return new Sentry.Integrations.Http({
breadcrumbs: false,
tracing: false,
})
}
return integration
})
},
})
Hope it helps
You can filter breadcumbs by category; something like this:
Sentry.init({
beforeBreadcrumb(breadcrumb) {
if (breadcrumb.category === "console") {
return null
}
return breadcrumb
},
})
Regards 👋
@adwher , I can confirm this approach works, although my react native sentry version is 1.3.9. Thanks for sharing!
if I use beforeBreadcrumb to remove some breadcrumbs, will the 100 breadcrumb limit count before or after the removal?
If a breadcrumb is dropped in beforeBreadcrumb, it will not be stored and thus does not count to the limit.