pbergman/sentry-bundle

There is no license information available for the latest version (2.0.4) of this package.

Monolog sentry handler with support for breadcrumbs and sentry dispatching events

2.0.4 2024-05-07 10:49 UTC

This package is auto-updated.

Last update: 2024-12-07 12:08:43 UTC


README

I have created this bundle because the entry/sentry-symfony was not using the batch handler from monolog when connected with a buffer handler. This resulted in all messaged from a request being delivered individually instead of using breadcrumbs.

So with this extension you could configure monolog like this:

    handlers:
        main:
            type: fingers_crossed
            action_level: error
            handler: grouped
            excluded_http_codes: [404, 405]
        grouped:
            type: whatfailuregroup
            members: [ streamed, sentry_deduplicated ]
        streamed:
            type: stream
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            level: debug
        sentry_deduplicated:
            type:    deduplication
            handler: sentry                  
        sentry:
            type: service
            id: pbergman.sentry_handler

And when the fingercrossed handler get an error message, all messages in the buffer of INFO or higher will be grouped and send to sentry.

This bundle has also created a bridge between the native hooks (before_breadcrumb an before_send) and symfony dispatcher. So now you can just create listener that listens to PBergman\Bundle\SentryBundle\Events::EVENT_BEFORE_SEND or PBergman\Bundle\SentryBundle\Events::EVENT_BEFORE_BREADCRUMB

By default it will create a listener that will filter exception classes (see bin/console config:dump-reference p_bergman_sentry) to disable add the following config:

p_bergman_sentry:
    excluded_exceptions: ~

Or set there the desired classes.