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
subscriber: fix incorrect filtering for tracing-log
events
#344
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
github-actions
bot
added
the
crate/subscriber
Related to the `tracing-subscriber` crate
label
Sep 12, 2019
Currently, the `tracing-subscriber` `EnvFilter` does not properly enable events that originate from the `tracing-log` `LogTracer` adapter. This is because those events are supposed to be filtered only by `enabled`, and will not generate proper `register_callsite` metadata. `EnvFilter`'s `enabled` method will assume that an event was not enabled statically, since `enabled` wouldn't have been called if the callsite was given the `Always` interest. However, this doesn't take `tracing-log` into account. I've changed `EnvFilter` to always check against static filters in `enabled` if the dynamic filters don't enable a given metadata. This fixes the filtering of `tracing-log` events. I've also added tests that fail against the current master. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
force-pushed
the
eliza/fix-log-events
branch
from
September 12, 2019 20:32
0e9debb
to
422e5c1
Compare
samscott89
approved these changes
Sep 12, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Also confirmed locally that this fixes the behaviour I was seeing.
hawkw
added a commit
that referenced
this pull request
Sep 12, 2019
Fixed: - `EnvFilter` ignoring directives with targets that are the same number of characters (#333) - `EnvFilter` failing to properly apply filter directives to events generated from `log` records by`tracing-log` (#344) Changed: - Renamed `Filter` to `EnvFilter`, deprecated `Filter` (#339) - Renamed "filter" feature flag to "env-filter", deprecated "filter" (#339) - `FmtSubscriber` now defaults to enabling only the `INFO` level and above when a max level filter or `EnvFilter` is not set (#336) Added: - `EnvFilter::add_directive` to add new directives to filters after they are constructed (#334) - `fmt::Builder::with_max_level` to set a global level filter for a `FmtSubscriber` without requiring the use of `EnvFilter` (#336) - `Layer` implementation for `LevelFilter` (#336) - `EnvFilter` now implements `fmt::Display` (#329) Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added a commit
that referenced
this pull request
Sep 13, 2019
Fixed: - `EnvFilter` ignoring directives with targets that are the same number of characters (#333) - `EnvFilter` failing to properly apply filter directives to events generated from `log` records by`tracing-log` (#344) Changed: - Renamed `Filter` to `EnvFilter`, deprecated `Filter` (#339) - Renamed "filter" feature flag to "env-filter", deprecated "filter" (#339) - `FmtSubscriber` now defaults to enabling only the `INFO` level and above when a max level filter or `EnvFilter` is not set (#336) - Made `parking_lot` dependency an opt-in feature flag (#348) Added: - `EnvFilter::add_directive` to add new directives to filters after they are constructed (#334) - `fmt::Builder::with_max_level` to set a global level filter for a `FmtSubscriber` without requiring the use of `EnvFilter` (#336) - `Layer` implementation for `LevelFilter` (#336) - `EnvFilter` now implements `fmt::Display` (#329) Removed: - Removed dependency on `crossbeam-util` (#348) Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added a commit
that referenced
this pull request
Sep 13, 2019
### Fixed - `EnvFilter` ignoring directives with targets that are the same number of characters (#333) - `EnvFilter` failing to properly apply filter directives to events generated from `log` records by`tracing-log` (#344) ### Changed - Renamed `Filter` to `EnvFilter`, deprecated `Filter` (#339) - Renamed "filter" feature flag to "env-filter", deprecated "filter" (#339) - `FmtSubscriber` now defaults to enabling only the `INFO` level and above when a max level filter or `EnvFilter` is not set (#336) ### Added: - `EnvFilter::add_directive` to add new directives to filters after they are constructed (#334) - `fmt::Builder::with_max_level` to set a global level filter for a `FmtSubscriber` without requiring the use of `EnvFilter` (#336) - `Layer` implementation for `LevelFilter` (#336) - `EnvFilter` now implements `fmt::Display` (#329) Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added a commit
to linkerd/linkerd2-proxy
that referenced
this pull request
Sep 13, 2019
Updating to the latest versions of the `tracing` and `tracing-subscriber` crates picks up a few changes that might be relevant to us: - tokio-rs/tracing#333: Fix an issue where filtering directives could sometimes be ignored - tokio-rs/tracing#344: Fix for filters not applying to events generated from `log` records - tokio-rs/tracing#346: Dependencies using `tracing`'s `log` back-compat alongside the `log` record to `tracing` event conversion layer will no longer result in duplicate events Additionally, `tracing-subscriber` 0.1.2 removed some dependencies that were previously on by default, and feature flagged others; I've tweaked the feature flags that we enable so we now have fewer transitive deps in our lockfile :D Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
added a commit
to linkerd/linkerd2-proxy
that referenced
this pull request
Sep 18, 2019
* logging: update `tracing` and `tracing-subscriber` Updating to the latest versions of the `tracing` and `tracing-subscriber` crates picks up a few changes that might be relevant to us: - tokio-rs/tracing#333: Fix an issue where filtering directives could sometimes be ignored - tokio-rs/tracing#344: Fix for filters not applying to events generated from `log` records - tokio-rs/tracing#346: Dependencies using `tracing`'s `log` back-compat alongside the `log` record to `tracing` event conversion layer will no longer result in duplicate events Additionally, `tracing-subscriber` 0.1.2 removed some dependencies that were previously on by default, and feature flagged others; I've tweaked the feature flags that we enable so we now have fewer transitive deps in our lockfile :D Signed-off-by: Eliza Weisman <eliza@buoyant.io>
panthervis
added a commit
to panthervis/linkerd2-proxy
that referenced
this pull request
Oct 8, 2021
* logging: update `tracing` and `tracing-subscriber` Updating to the latest versions of the `tracing` and `tracing-subscriber` crates picks up a few changes that might be relevant to us: - tokio-rs/tracing#333: Fix an issue where filtering directives could sometimes be ignored - tokio-rs/tracing#344: Fix for filters not applying to events generated from `log` records - tokio-rs/tracing#346: Dependencies using `tracing`'s `log` back-compat alongside the `log` record to `tracing` event conversion layer will no longer result in duplicate events Additionally, `tracing-subscriber` 0.1.2 removed some dependencies that were previously on by default, and feature flagged others; I've tweaked the feature flags that we enable so we now have fewer transitive deps in our lockfile :D Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, the
tracing-subscriber
EnvFilter
does not properly enableevents that originate from the
tracing-log
LogTracer
adapter. Thisis because those events are supposed to be filtered only by
enabled
,and will not generate proper
register_callsite
metadata.EnvFilter
'senabled
method will assume that an event was not enabled statically,since
enabled
wouldn't have been called if the callsite was given theAlways
interest. However, this doesn't taketracing-log
intoaccount.
Solution
I've changed
EnvFilter
to always check against static filters inenabled
if the dynamic filters don't enable a given metadata. Thisfixes the filtering of
tracing-log
events. I've also added tests thatfail against the current master.
This fixes the regression reported by @samscott89.
Signed-off-by: Eliza Weisman eliza@buoyant.io