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.
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
Clarify
filter.not()
w.r.t. event_enabled #2251Clarify
filter.not()
w.r.t. event_enabled #2251Changes from 1 commit
cdae874
d7b1d4f
602d875
193f25c
cf3cacd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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'm not completely sure how i feel about the use of Rust-like pseudocode in the documentation; it seems like it could potentially create some confusion if people incorrectly interpret it actual code. do you think it would make sense to document this as a Markdown table or something, instead? i'm fine with this if it's really the best way to document this behavior, but i am mildly skeptical about it...
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.
The thing which is easier explained with pseudocode is the short circuiting behavior. Also, just trying to reason about using a filter on top of a layer which reports global filtering is overloading my brain atm, so...
That said, here's an attempt at a table to communicate the same information plus a bit:
Normal
F::callsite_enabled
F::enabled
S::enabled
F::event_enabled
S::event_enabled
ALWAYS
NEVER
SOMETIMES
true
SOMETIMES
true
true
SOMETIMES
true
false
SOMETIMES
false
Not
F::callsite_enabled
F::enabled
S::enabled
F::event_enabled
S::event_enabled
ALWAYS
NEVER
SOMETIMES
true
SOMETIMES
false
SOMETIMES
false
Pure logical filter inverse without time travel
F::callsite_enabled
F::enabled
S::enabled
F::event_enabled
S::event_enabled
ALWAYS
NEVER
SOMETIMES
true
SOMETIMES
true
true
SOMETIMES
true
false
SOMETIMES
false
SOMETIMES
false
I wish I could give a nice visual diff between the tables, but this'll have to do: diff
Not
to "logical":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.
hmm, yeah, that's...not great. i'm fine with the pseudocode instead, then.
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.
(It's worth noting that the pseudocode doesn't contain the
S::*
information from the tables, so for a fair comparison drop those two columns. But yeah, communicating short circuiting in a table is hard.)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.
You mentioned thinking maybe we should've made
event_enabled
returnOption<bool>
; the "correct" behavior I think would've been for (a time machine and)enabled
to also returnInterest
, then iff that returns asometimes()
callingspan_enabled
/event_enabled
for a final determination.So roughly
callsite_enabled
.span!
is entered:enabled
.enabled
always: Evaluate fields. Return active span.enabled
sometimes:span_enabled
: Return active span.event!
is entered:enabled
.enabled
always: Evaluate fields. Emit event.enabled
sometimes:event_enabled
: Emit event.In terms of signatures,
Collect
register_callsite(&self, &Metadata) -> Interest
enabled(&self, &Metadata) -> Interest
span_enabled(&self, &Attributes) -> bool
event_enabled(&self, &Attributes) -> bool
Subscribe
(but only local filtering)register_callsite(&self, &Metadata) -> Interest
enabled(&self, &Metadata, &Context) -> Interest
span_enabled(&self, &Attributes, &Context) -> bool
event_enabled(&self, &Attributes, &Context) -> bool
Subscribe
in a tree fashion.(I'd personally also say that the
enabled
functions not being called when!interest.is_sometimes()
is purely an optimization and you are not allowed to rely on this being true. This isn't necessary, but it's imho easier to reason about for wrapping collectors/filters.)(Yes, there's complexity in the system I'm not fully aware of that probably makes that too simple.)