Skip to content

Commit

Permalink
fix interest combining for mixed PSF/non-PSF vecs
Browse files Browse the repository at this point in the history
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
hawkw committed Mar 28, 2022
1 parent 2709f97 commit 82ed40a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tracing-subscriber/src/subscribe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,7 @@ feature! {
interest = new_interest;
}
}

interest
}

Expand Down Expand Up @@ -1674,6 +1675,18 @@ feature! {
return Some(NonNull::from(self).cast());
}

// Someone is looking for per-subscriber filters. But, this `Vec`
// might contain subscribers with per-subscriber filters *and*
// subscribers without filters. It should only be treated as a
// per-subscriber-filtered subscriber if *all* its subscribers have
// per-subscriber filters.
// XXX(eliza): it's a bummer we have to do this linear search every
// time. It would be nice if this could be cached, but that would
// require replacing the `Vec` impl with an impl for a newtype...
if filter::is_psf_downcast_marker(id) && self.iter().any(|s| s.downcast_raw(id).is_none()) {
return None;
}

// Otherwise, return the first child of `self` that downcaaasts to
// the selected type, if any.
// XXX(eliza): hope this is reasonable lol
Expand Down

0 comments on commit 82ed40a

Please sign in to comment.