sentry-rust
sentry-rust copied to clipboard
sentry-tracing: `SentryLayer` ignores `event_filter` if `event_mapper` is set
Environment
Linux x86_64
Steps to Reproduce
- Build
SentryLayerwith bothevent_filterandevent_mapperset.event_filterignores tracing events belowLevel::ERROR.event_mapperalways returnsEventMapping::Event(..).
- Emit a tracing event with
Level::WARN(warn!()).
Expected Result
The warn event is discarded by the filter; the Sentry instance does not receive any events.
Actual Result
The warn event is not discarded by the filter; the Sentry instance receives the mapped event.
Yes, this is pretty much intentional. The event_mapper takes precedence over the filter, as you can also filter things in it, you just return an EventMapping::Ignore.
https://github.com/getsentry/sentry-rust/blob/3e7eec2c27467d528ed3316fe05dc3e5d52f176c/sentry-tracing/src/layer.rs#L136-L138
Though I admit the docs might not fully reflect this.
Yes, this is pretty much intentional. The
event_mappertakes precedence over the filter, as you can also filter things in it, you just return anEventMapping::Ignore.https://github.com/getsentry/sentry-rust/blob/3e7eec2c27467d528ed3316fe05dc3e5d52f176c/sentry-tracing/src/layer.rs#L136-L138
Though I admit the docs might not fully reflect this.
Thank you for your swift response! I appreciate it, really.
I believe this behavior is part of stable API and guaranteed to stay the same in the foreseeable future. Is this correct? If this is the case, I could submit a PR to document this explicitly.
I believe this behavior is part of stable API and guaranteed to stay the same in the foreseeable future. Is this correct? If this is the case, I could submit a PR to document this explicitly.
Yes, we wouldn’t want to change this behavior suddenly. PRs to improve docs are always appreciated ❤️