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 (#1433)

This backports #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 <[email protected]>
  • Loading branch information
Folyd and hawkw committed Jun 26, 2021
1 parent de76e55 commit ab62076
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 ab62076

Please sign in to comment.