I need to prevent sending some events by condition. (health check)
I'm using spring libraries:
implementation "io.sentry:sentry-spring-boot-starter:5.4.1"
implementation "io.sentry:sentry-logback:5.4.1"
It works, sentry has a lot of transactions etc. The configuration is:
sentry:
dsn: https://....ingest.sentry.io/....
traces-sample-rate: 1.0
I'm going to prevent some events which has health check data using event processor: https://docs.sentry.io/platforms/java/guides/spring-boot/advanced-usage/#registering-custom-event-processor
@Component
public class SentryCallbackExtension implements EventProcessor {
@Value("${app.sentry.exclude.transactions}")
private List<String> excludes;
@Override
public @Nullable SentryEvent process(@NotNull SentryEvent event, @Nullable Object hint) {
return StringUtils.containsAnyIgnoreCase(
event.getTransaction(), excludes.toArray(new String[0])
) ? null : event;
}
}
Configuration for this block is:
app:
sentry:
exclude:
transactions: "/actuator/health"
And it doesn't work. There are a lot of health check events in sentry service.

