We are using sentry.io for error reporting in some backend applications with high frequency data processing. Sometimes the same error is being sent to sentry again and again over a longer period of time. The spike protection feature is only meant for very high short spikes and sentry's client side sampling will lead to losing important one-time-only events.
For our java applications we use sentry-logback. This filter can be used to only send one event per defined timeframe for a combination of loggername + (first line in stack OR log message).
Maven:
<dependency>
<groupId>com.abusix.util</groupId>
<artifactId>rate-limiting-logback-filter</artifactId>
<version>{LATEST VERSION}</version>
</dependency>
Gradle (groovy):
implementation 'com.abusix.util:rate-limiting-logback-filter:{LATEST VERSION}'
Gradle (kotlin):
compile("com.abusix.util:rate-limiting-logback-filter:{LATEST VERSION}")
Add as a filter to the appender. Example:
<appender name="Sentry" class="io.sentry.logback.SentryAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<filter class="com.abusix.util.logback.filters.RateLimitingLogbackFilter">
</filter>
</appender>
./gradlew clean build publishMavenJavaPublicationToCentralRepository
./gradlew clean release