Sentry-javascript: Prevent duplicate issues from same user

Created on 16 Mar 2016  路  7Comments  路  Source: getsentry/sentry-javascript

We want to ensure that a single user can not flood the Sentry server with the same issue (or many issues) over and over.

It probably makes sense to add two things:

  • max number of issues a user can send in a time window
  • (possibly) a stack of the recorded issues to prevent sending them again

Most helpful comment

@ms88privat https://docs.sentry.io/platforms/javascript/#dedupe

import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';

Sentry.init({
  dsn: 'yourdsn',
  integrations: [new Integrations.Dedupe()],
});

All 7 comments

So agreeing !!1

10 hours after having deployed
screen shot 2016-07-26 at 5 01 51 pm

There is a Sampling Data section in the docs. According to it, we can use something like:

shouldSendCallback: function(data) {
    // only send 10% of errors
    var sampleRate = 10;
    return (Math.random() * 100 <= sampleRate);
}

However, that's not much useful, as we already get a sample of the errors when going beyond the quota.

On my side, I'm allocating a slot quota per minute / hour:
https://gist.github.com/oliviertassinari/114792721df8b7ef2cf2ecf3e4dea621

Thanks @oliviertassinari that seems good for filtering React useless and repetitive errors, will use something similar!

@slorber It's production tested at @doctolib. It might worth extracting that into a small library.

@MaxBittker The functionality in the linked PR is not included in the new sentry/browser package? I just woke up with 21k events from the same user. Basically 1 per second...

I do not find allowDuplicates settings in the new SDK. Should this feature work out of the box by now or do I have to still implement my own throttling solution as mentioned above? @slorber

@ms88privat https://docs.sentry.io/platforms/javascript/#dedupe

import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';

Sentry.init({
  dsn: 'yourdsn',
  integrations: [new Integrations.Dedupe()],
});
Was this page helpful?
0 / 5 - 0 ratings