evalphobia / logrus_sentry

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

Fire() deletes variables without asking #20

Closed njern closed 7 years ago

njern commented 7 years ago

Just ran into this when I added

hook.StacktraceConfiguration.Enable = true

to one of my projects and could not understand why it suddenly made my error field (logging with logrus.WithError(...)) disappear from my logfiles..

Turns out it was logrus_sentry "consuming" the error as part of sending it to Sentry. Looking at the code it does it with several other "special" fields as well, like "http_request".

Not sure what the best solution is here, but this should be configurable by the caller in some way - otherwise it's bound to cause these type of headaches for other people as well.

GlenDC commented 7 years ago

Why are fields deleted anyhow? I checked some other community developed Hooks, and I didn't see any other hook dropping fields. Could we simply remove this?

evalphobia commented 7 years ago

@njern /cc @GlenDC

I think some special fields are removed to avoid duplicate data and large payload size when it used.

PR #25 is not to delete keys from logrus.Data and not to affect other hooks. @njern does this PR solve your problem? if so, I'll merge it.

I'm planning to add an option flag to preserve original data of "special fields" and send duplicated data to Sentry.

evalphobia commented 7 years ago

Fixed in v0.2.7