evalphobia / logrus_sentry

sentry hook for logrus
MIT License
194 stars 78 forks source link

Add option to add error breadcrumb in sentry log #81

Closed nicpottier closed 5 years ago

nicpottier commented 5 years ago

When using pkg/errors a problem we keep encountering is that sentry truncates the error message, which removes relevant information that has been annotated on the error via Wrapf. I looked into adding this into the StackTraceFrame but it would include a mountain of changes including ones upstream in raven-go.

This instead adds a new option IncludeErrorBreadcrumb which when true will add a breadcrumb to the sentry report that includes the verbose print of the error. When using pkg/errors this gives you a full trace including the annotations.

Totally understand if this isn't something you want to merge but leaving this here as maybe it will be useful to others. The "right" way to do this is to annotate each StackTraceFrame with vars in the cases where there is an annotation. This would require tweaking pkg/errors to get at the error message at that level (and not only the recursive error message) and tweaking getsentry/raven-go to let us set vars on a StackTraceFrame.

errors fundamental illegal method get 2019-01-29 10-40-58

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-1.3%) to 81.19% when pulling c2962b80ba7d827510f5c06131240fbc7180f391 on nyaruka:master into 4034fb124d4e039c84e66e70f40ee32343f0ea19 on evalphobia:master.

evalphobia commented 5 years ago

Thanks! 🍞

Note: https://github.com/evalphobia/logrus_sentry/releases/tag/v0.8.2