-
Notifications
You must be signed in to change notification settings - Fork 13
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
Enable a fastify/pino logger integration to add request pino logs to sentry as breadcrumbs #627
Comments
Hi @GlenTiki , thank you for the suggestion. It seems interesting but I am not sure I understand correctly . Can you share a poc implementation or an event screenshot that shows what you are working on? |
we have a solution for this BUT we didn't figure out a way how to have request specific logs in breadcrumbs only, so even though you have logs, its not super useful i have whipped up a quick gist for inspiration - its a new version I am currently evaluating so its not battle tested yet https://gist.github.com/tomasstrejcek/dfd37ff6efaf88477affcadd8775b81c |
I think @tomasstrejcek is onto something here, I'll need to return focus to this issue soon to try it as I've since moved onto some other stuff. @dnlup The idea here is when you look at an issue in sentry, it auto-captures console.log messages as breadcrumbs to this section (Seen here) But, if you're not using So ideally, I would have a server in fastify with a handler like below:
And in sentry, if this handler throws an error, I would see a breadcrumb for this log message (Like I would if I used the default sentry module, used console as my logger, and captured exceptions with that) ARGUABLY: this is an upstream sentry module issue - they could improve pino support themselves to benefit us/others - getsentry/sentry-javascript#4192 But since this is closed upstream, I've come downstream to the sentry lib I'm using 😄 |
Thank you @GlenTiki and @tomasstrejcek for the detailed description, I see the use case for this but I am not sure if it should be implemented in this plugin though. We can leave this open and discuss more about it, we could find a solution. |
I've made some work on this some time ago: https://github.com/Lilja/pino-sentry-breadcrumbs. Not sure if it will help |
A basic solution to get fastify/pino logs to show up in sentry is to make pino emit logs to the console log methods, which sentry does instrument. I've just shared a code snippet for this in the upstream sentry issue: getsentry/sentry-javascript#4192 (comment) |
Just an idea I had as I'm working through adding this to a project.
The text was updated successfully, but these errors were encountered: