Ignore spans, traces, everything for health checks
Environment
SaaS (https://sentry.io/)
What are you trying to accomplish?
I can't quite figure out if there's a way / what's the "canonical" way to filter out everything regarding health checks (or any other action you wan't to be silent). I don't need any APM on my health checks - they can go fully blind.
So far I've seen denyUrls, beforeSend, and server-side filtering, but I'm not sure what exactly they'll filter or if, for example, /health as a denyUrl would even work.
How are you getting stuck?
Not quite sure what to use and to me this seems to be worth a small section in the docs as it should be a rather common case.
Where in the product are you?
Performance
Link
No response
DSN
No response
Version
No response
Assigning to @getsentry/support for routing ⏲️
Routing to @getsentry/product-owners-performance for triage ⏲️
hey @black-snow thanks for reaching out! In general, I'd recommend enabling the Filter out health check transactions within your project's Inbound Settings. Here you can find information on what we consider to be a health check. Please note that this setting setting will only filter out transactions and not errors. Let me know if you have any additional questions on this!
@dalnoki thanks for your reply!
I'd rather like to not collect and send stuff on this route in the first place. Sure, I could just sentry.init after the routing happens and do it within each rout but this is clearly not quite ideal*. Isn't there a way to tell the SDK to ignore some routes, URLs, or to kida sentry.stop()? Not sure if it worked to just del sentry in my /health route.
*having a @NoApm on one route sure is less verbose than having @APm on every other route, plus I'd not catch anything before the now rather late init.
hi @black-snow, thanks for getting back to me - you could try using a tracesSampler or beforeSendTransaction to filter out these kinds of transactions. Please reference our documentation for additional details: https://docs.sentry.io/platforms/javascript/configuration/filtering/#filtering-transaction-events (I linked the JavaScript docs because I don't know the SDK you're interested in, but this functionality should exist in pretty much every Sentry SDK)
That's pretty much what my initial search yielded. Filtering will probably work, but it's something I have to do in the code and I also need to (re-) implement the sampling rate then. That's quite cumbersome - I have to go into every project and copypaste that in.
Would be nice to have some config option for this that I can configure from the outside - something like SENTRY_IGNORED_PATHS=/a/b/c,/health and Sentry would then automatically discard everything for these paths.
imho this should get a label:"Type: Feature Request" - unless both of us are missing some detail here.
Just found https://docs.sentry.io/concepts/data-management/filtering/#transactions-coming-from-health-check - seems to be exactly what I was looking for.
Actually, it's not. What I'd like to do is not sending any data for, e.g., /health in the first place (so I don't have to pay for traffic that sentry.io is going to trash then anyway).
So, feature request still valid.
@black-snow, per this page, any data filtered by an inbound filter, including the health check filters you linked, is not counted against your quota. So, you do not need to pay Sentry for this traffic
If you still want to filter on the SDK side, you will need to manually implement a filter with before_send_transaction. This enables you to create arbitrary filters for your transaction data.
I'm surprised this ain't seem to be a more highly sought after feature request.