Sentry on Symfony: how to exclude `NotFoundHttpException`



PHP Snippet 1:

sentry:
  register_error_listener: false # custom monolog handler: Disables the ErrorListener to avoid duplicated log in sentry
  dsn: 'FOOBAR_DNS'
  options:
    traces_sample_rate: 0.1
  tracing:
    enabled: true
    dbal:
      enabled: true
      connection: 'default'
    cache:
      enabled: true
    twig:
      enabled: true

# sentry: log also error logs when there is no request exception
monolog:
  handlers:
    sentry:
      type: fingers_crossed
      action_level: error
      handler: sentry_main
      excluded_http_codes: [ 404, 405 ]
      buffer_size: 50
    sentry_main:
      type: sentry
      level: error
      hub_id: Sentry\State\HubInterface

PHP Snippet 2:

services:

    <...other services>

    Sentry\Integration\IgnoreErrorsIntegration:
        arguments:
            $options:
                ignore_exceptions:
                    - Symfony\Component\HttpKernel\Exception\NotFoundHttpException

PHP Snippet 3:

sentry:
    dsn: '%env(SENTRY_DSN)%'
    options:
        integrations:
            - 'Sentry\Integration\IgnoreErrorsIntegration'