Skip to content

Commit

Permalink
subscriber: explain why we always call inner.register_callsite() be…
Browse files Browse the repository at this point in the history
…fore if statement (tokio-rs#1433)

This backports tokio-rs#1433 from `master`.

* subscriber: explain why we always call `inner.register_callsite()` before if statement

* Apply suggestions from code review

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
2 people authored and kaffarell committed May 22, 2024
1 parent 1d16943 commit 7d48faa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tracing-subscriber/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,9 @@ where
return outer;
}

// The intention behind calling `inner.register_callsite()` before the if statement
// is to ensure that the inner subscriber is informed that the callsite exists
// regardless of the outer subscriber's filtering decision.
let inner = self.inner.register_callsite(metadata);
if outer.is_sometimes() {
// if this interest is "sometimes", return "sometimes" to ensure that
Expand Down

0 comments on commit 7d48faa

Please sign in to comment.