sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Filter out health check transactions

Open TomRoelofsWhyellow opened this issue 10 months ago • 7 comments

Package

Sentry.AspNetCore

.NET Flavor

.NET

.NET Version

6.0.0

OS

Any (not platform specific)

SDK Version

4.4.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

  1. Enable inbound filter for filtering out health check transactions
  2. Create a health check endpoint (e.g. /healthcheck/database)
  3. Assure that the health check is unhealthy
  4. Perform a health check call to the endpoint

Expected Result

According to the docs (https://docs.sentry.io/product/data-management-settings/filtering/#transactions-coming-from-health-check), the health check transaction should be filtered out.

Number of other things I've tried:

  1. Add SetBeforeSendTransaction and SetBeforeSend. Tried to filter on Transaction Name/Tags.

options.SetBeforeSendTransaction((sentryTransaction, _) => { return sentryTransaction.Name.Contains("healthcheck") ? null : sentryTransaction; });

  1. Add TracesSampler

options.TracesSampler = samplingContext => { return samplingContext.TransactionContext.Name.Contains("healthcheck") ? 0 : 1; };

When I check the logs, it says the events/transactions are dropped, but I'm still receiving them in Sentry. image

Actual Result

The health check is not filtered out.

TomRoelofsWhyellow avatar Apr 19 '24 08:04 TomRoelofsWhyellow