-
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
WIP: dynamic filters override static ones #2095
base: v0.1.x
Are you sure you want to change the base?
WIP: dynamic filters override static ones #2095
Conversation
The tests currently fail, and all those printlns in there are because the changed |
The reason tracing/tracing-subscriber/src/filter/env/mod.rs Lines 628 to 645 in fd8740f
You would need to change this behavior so that if an |
ah! that makes a lot of sense, thanks for the help :) |
Cool, it actually seems to work now (at least the tests do) I tried using I think it's still debatable whether this feature should exist and whether this is a good implementation. |
I don't think we want to do that, a dynamic directive will effect any event within a span that matches the directive, so we can't filter the directives in that check. Instead, we just want to check if any dynamic directive would enable the event's level. So, what you've written is correct. |
yep, I think I kinda noticed that while I was trying to understand why it doesn't work 😅 |
} else if self | ||
.dynamics | ||
.directives() | ||
.any(|directive| directive.level < *metadata.level()) |
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.
we can simplify this check; self.dynamics
has a max_level
field, so we can just check if the metadata's level is <= self.dynamics.max_level
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.
i don't think that does the same thing though?
we need to find at least one filter that would disable the metadata,
the max level being greater means that at least one filter can enable it, right?
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.
While the proposed simplifications is more appealing to me, I obeserve that both versions work for filters like
info,[{timeline=a6cfe8a1ca34765fd9a432d6193856b2}]=debug,[{timeline=a4273b74e519eb7f2d93b2c6245cd8ec}]=error
in my usecase.
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.
Hey @hawkw , @tfreiberg-fastly thank you for working on this feature, this is exactly what I've stumbled onto and would wish to have in the tracing-subscriber 0.3 version, if possible.
Can I help you somehow with the PR to make it happen?
} else if self | ||
.dynamics | ||
.directives() | ||
.any(|directive| directive.level < *metadata.level()) |
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.
While the proposed simplifications is more appealing to me, I obeserve that both versions work for filters like
info,[{timeline=a6cfe8a1ca34765fd9a432d6193856b2}]=debug,[{timeline=a4273b74e519eb7f2d93b2c6245cd8ec}]=error
in my usecase.
Issue tokio-rs#1388 Allow dynamic filters to override statis cones, thus enabling the possibility to have env filters like warn,pageserver=info,[{tenant=98d670ab7bee6f0051494306a1ab888f}]=error,[{tenant=19cbf2bf51f42a5a5a90aa8954fb3e42}]=debug
Based on tokio-rs#2095 Issue tokio-rs#1388 Allow dynamic filters to override statis cones, thus enabling the possibility to have env filters like warn,pageserver=info,[{tenant=98d670ab7bee6f0051494306a1ab888f}]=error,[{tenant=19cbf2bf51f42a5a5a90aa8954fb3e42}]=debug
Hi all, |
Motivation
See #1388.
Similar to how more specific static filters can disable things that more general filters would enable (e.g.
foo=info,foo::bar=warn
), it would be nice if dynamic filters could do something similar (although "more specific" is way harder to define here, but let's maybe try)Solution