Skip to content

businho/sentry-deduplicate-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sentry-deduplicate-integration

Sentry integration to rate-limit duplicated errors, using redis to sync error count and identify duplications.

Install

Install it from PyPI:

pip install sentry-deduplicate-integration

Configure

Add the integration to your sentry_sdk initialization.

import redis
from sentry_deduplicate_integration import SentryDeduplicateIntegration

sentry_sdk.init(
    integrations=[
        SentryDeduplicateIntegration(redis_factory=redis.Redis),
    ],
)

The redis_factory arg is any function returning a redis client.

For simple projects, it is possible to use it without a Redis instance, using fakeredis, which is an in-memory Redis compatible implementation. It will deduplicate only errors in the same thread.

import fakeredis
from sentry_deduplicate_integration import SentryDeduplicateIntegration

sentry_sdk.init(
    integrations=[
        SentryDeduplicateIntegration(redis_factory=fakeredis.FakeRedis),
    ],
)

What about sentry_sdk.DedupeIntegration?

The DedupeIntegration is installed by default and we expected it to work, but it just avoid duplications when the same error is triggered twice, works only in the same process and only the last error is checked for deduplication.