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

Add option to exclude certain HTTP statuses from tracing in SDK

Open dingsdax opened this issue 3 months ago • 5 comments

If not already implemented or only partially implemented: SDK should not trace incoming 404s by default to reduce noise. Add a config option to exclude specific HTTP statuses from tracing. This should mirror existing behavior in other SDKs (Laravel, JavaScript).

  • New config option (e.g. trace_ignore_status_codes: [404, ...])
  • Backwards compatible (default still traces 404s)
  • Tests + docs updated

dingsdax avatar Sep 17 '25 13:09 dingsdax

I recommend this one.

modinis76swear avatar Sep 17 '25 13:09 modinis76swear

Agree on this, but it may need to be considered a breaking change.

I do this in my projects with this configuration:

sentry:
  options:
   ignore_exceptions:
      - Symfony\Component\Security\Core\Exception\AccessDeniedException
      - Symfony\Component\HttpKernel\Exception\NotFoundHttpException

Jean85 avatar Sep 17 '25 16:09 Jean85

What does an exception has to do with ignoring traces?

cleptric avatar Sep 17 '25 16:09 cleptric

Ouch sorry my bad, I mistook this for default config for errors, not traces. In any case, those exceptions are how Symfony reports 404 and 403, so it's still what you may want to intercept.

Jean85 avatar Sep 17 '25 17:09 Jean85