-
Notifications
You must be signed in to change notification settings - Fork 731
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
core: change Interest
-combining to play nicer with multiple subscribers
#927
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>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw
force-pushed
the
eliza/filter-leak-test
branch
from
August 13, 2020 18:09
6d1b96e
to
8eae391
Compare
davidbarsky
approved these changes
Aug 13, 2020
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.
Approving since this was already approved!
hawkw
added a commit
that referenced
this pull request
Aug 21, 2020
Fixed - When combining `Interest` from multiple subscribers, if the interests differ, the current subscriber is now always asked if a callsite should be enabled (#927) Added - Internal API changes to support optimizations in the `tracing` crate (#943) - **docs**: Multiple fixes and improvements (#913, #941)
hawkw
added a commit
that referenced
this pull request
Aug 23, 2020
### Fixed - When combining `Interest` from multiple subscribers, if the interests differ, the current subscriber is now always asked if a callsite should be enabled (#927) ### Added - Internal API changes to support optimizations in the `tracing` crate (#943) - **docs**: Multiple fixes and improvements (#913, #941)
hawkw
added a commit
that referenced
this pull request
Sep 8, 2020
Fixed - **env-filter**: Fixed a regression where `Option<Level>` lost its `Into<LevelFilter>` impl ([#966]) - **env-filter**: Fixed `EnvFilter` enabling spans that should not be enabled when multiple subscribers are in use ([#927]) Changed - **json**: `format::Json` now outputs fields in a more readable order ([#892]) - Updated `tracing-core` dependency to 0.1.16 Added - **fmt**: Add `BoxMakeWriter` for erasing the type of a `MakeWriter` implementation ([#958]) - **fmt**: Add `TestWriter` `MakeWriter` implementation to support libtest output capturing ([#938]) - **layer**: Add `Layer` impl for `Option<T> where T: Layer` ([#910]) - **env-filter**: Add `From<Level>` impl for `Directive` ([#918]) - Multiple documentation fixes and improvements Thanks to @Pothulapati, @samrg472, @bryanburgers, @keetonian, and @SriRamanujam for contributing to this release! [#927]: #927 [#966]: #966 [#958]: #958 [#892]: #892 [#938]: #938 [#910]: #910 [#918]: #918
hawkw
added a commit
that referenced
this pull request
Sep 9, 2020
# 0.2.12 (September 8, 2020) ### Fixed - **env-filter**: Fixed a regression where `Option<Level>` lost its `Into<LevelFilter>` impl ([#966]) - **env-filter**: Fixed `EnvFilter` enabling spans that should not be enabled when multiple subscribers are in use ([#927]) ### Changed - **json**: `format::Json` now outputs fields in a more readable order ([#892]) - Updated `tracing-core` dependency to 0.1.16 ### Added - **fmt**: Add `BoxMakeWriter` for erasing the type of a `MakeWriter` implementation ([#958]) - **fmt**: Add `TestWriter` `MakeWriter` implementation to support libtest output capturing ([#938]) - **layer**: Add `Layer` impl for `Option<T> where T: Layer` ([#910]) - **env-filter**: Add `From<Level>` impl for `Directive` ([#918]) - Multiple documentation fixes and improvements Thanks to @Pothulapati, @samrg472, @bryanburgers, @keetonian, and @SriRamanujam for contributing to this release! [#927]: #927 [#966]: #966 [#958]: #958 [#892]: #892 [#938]: #938 [#910]: #910 [#918]: #918
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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, when multiple subscribers are in use, the way that
Interest
values are combined results in surprising behavior.
If any subscriber returns
Interest::always
for a callsite, thatinterest currently takes priority over any other
Interest
s. This meansthat if two threads have separate subscribers, one of which enables a
callsite
always
, and the othernever
, both subscribers will alwaysrecord that callsite, without the option to disable it. This is not
quite right. Instead, we should check whether the current subscriber
will enable that callsite in this case.
This issue is described in #902.
Solution
This branch changes the rules for combining
Interest
s so thatalways
is only returned if both
Interest
s arealways
. If only one isalways
, the combined interest is nowsometimes
, instead. This meansthat when multiple subscribers exist,
enabled
will always be called onthe current subscriber, except when all subscribers have indicated
that they are
always
ornever
interested in a callsite.I've added tests that reproduce the issues with leaky filters.
Fixing this revealed an additional issue where
tracing-subscriber
'sEnvFilter
assumes thatenabled
is only called for events, and neverfor spans, because it always returns either
always
ornever
fromregister_callsite
for spans. Therefore, the dynamic span matchingdirectives that might enable a span were never checked in
enabled
.However, under the new interest-combining rules,
enabled
may stillbe called even if a subscriber returns an
always
ornever
interest,if another subscriber exists that returned an incompatible interest.
This PR fixes that, as well.
Depends on #919
This was previously approved by @yaahc as PR #920, but I
accidentally merged it into #919 after that branch merged, rather
than into master (my bad!).