Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to add buffered (fingers_crossed) logs to context #286

Open
rbaarsma opened this issue Dec 10, 2019 · 3 comments
Open

Option to add buffered (fingers_crossed) logs to context #286

rbaarsma opened this issue Dec 10, 2019 · 3 comments

Comments

@rbaarsma
Copy link

I want to use the awesome Symfony standard functionality "fingers_crossed" -- to only trigger on errors, but also log previous logs from the same requests as context -- with sentry.

Here's my attempt:

        main:
            type: fingers_crossed
            action_level: error
            handler: grouped

        grouped:
            type: group
            members: [streamed, sentry]

        streamed:
            type: stream
            path: "php://stdout"
            level: info

        sentry:
            type: service
            id: Sentry\Monolog\Handler
            level: info

This works, but unfortunately each info/warning that is now also logged, because of the fingers_crossed functionality, becomes a separate issue in sentry.

I know that with the (old) Raven client it was possible to group the logs, see https://stackoverflow.com/questions/51310575/monolog-send-errors-to-sentry-with-preserved-lower-level-log-records

It seems the new handler does not support working with a buffered stack.

Also, did you know the RavenHandler is still bundled by default with monolog, even though it's outdated? Perhaps you could create a PR to add a proper handler to monolog directly, then this whole bundle would become obsolete, because I think 99% using the symfony framework, is using monolog too and would be great if we can simply have a sentry handler.

@Jean85
Copy link
Collaborator

Jean85 commented Dec 10, 2019

I personally do the opposite, so this bundle still has merit.

As for this feature, I would imagine that this feature should be done using the Breadcrumbs. So, what we need would be a handler that pushes stuff not as events, but as breadcrumbs. Then, the current handler would work as a finger crossed handler, because the event would work as a buffer for the breadcrumbs.

This should be something handled in Sentry-PHP though, IMHO.

@rbaarsma
Copy link
Author

This seems related to getsentry/sentry-php#844

I'm not sure I agree with the reasoning though why this is closed and solved in another bundle. It's another thing to maintain and people like myself don't find it, or find it, but see it has only 20k downloads and don't take it seriously in big production projects.

Having a feature for batch processing to breadcrumbs either in the existing handler or in a seperate 'batchHandler' would be very helpfull to the Symfony community, who, by default, are using fingers_crossed functionality and would like an easy way to 'click' in sentry into their existing workflow. It would need some documentation too, to guide users towards using this feature.

@Jean85
Copy link
Collaborator

Jean85 commented May 14, 2021

This should be taken into consideration while working on #337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants