I would like to ignore all errors generated where browser
starts with Yandex
. Should that be done inside the shouldSendCallback
function, and if so then should I search using fields inside the provided data
, or should I search the user agent string directly using browser API?
I found the answer to this in a GitHub Issue so will link and answer here myself:
From https://github.com/getsentry/raven-js/issues/617#issuecomment-227562203
The answer is indeed to use the shouldSendCallback
function, with this being an example to ignore Cloudflare and early IE browsers:
Raven.config('https://xyz@app.getsentry.com/12345', {
shouldSendCallback(data) {
return !/^(.*CloudFlare-AlwaysOnline.*|.+MSIE 8\.0;.+)$/.test(window.navigator.userAgent);
}
}).install();
While we are absolutely +1 on doing this on the client (to save CPU on the server), current versions of Sentry (including sentry.io) do have a filter for removing issues caused by bots.
In my project, “Filter out known web crawlers” was set to enabled, however I still saw Yandex pop up as the browser for a weird error, so that’s why I’m ignoring them manually.
Correction: It’s actually “Yandex Browser”, i.e not the same thing as the crawler. So I wouldn’t consider it a “bot” and therefore only way to address this is the shouldSendCallback
function, as I don’t wish to “support” it as a browser if it’s going to throw errors.