Skip to content

Commit 8921f33

Browse files
hawkwdavidbarsky
andauthored
Apply docs suggestions from code review
Co-authored-by: David Barsky <me@davidbarsky.com>
1 parent 794337e commit 8921f33

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

tracing-subscriber/src/filter/layer_filters.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ pub struct FilterFn<
9292
/// **Note**: Currently, the [`Registry`] type provided by this crate is the
9393
/// **only** [`Subscriber`] implementation capable of participating in per-layer
9494
/// filtering. Therefore, the `FilterId` type cannot currently be constructed by
95-
/// user code. In the future, new APIs will be added to `tracing-subscriber` to
96-
/// allow user-implemented [`Subscriber`]s to also participate in per-layer
97-
/// filtering. When those APIs are added, user subscribers will be responsible
95+
/// code outside of `tracing-subscriber`. In the future, new APIs will be added to `tracing-subscriber` to
96+
/// allow non-Registry [`Subscriber`]s to also participate in per-layer
97+
/// filtering. When those APIs are added, subscribers will be responsible
9898
/// for generating and assigning `FilterId`s.
9999
///
100100
/// [`Filter`]: crate::layer::Filter
@@ -122,7 +122,7 @@ pub(crate) struct FilterMap {
122122
/// thread.
123123
///
124124
/// When `Filtered::enabled` is called, the filter will set the bit
125-
/// corresponding to its ID if it will disable the event/span being
125+
/// corresponding to its ID if the filter will disable the event/span being
126126
/// filtered. When the event or span is recorded, the per-layer filter will
127127
/// check its bit to determine if it disabled that event or span, and skip
128128
/// forwarding the event or span to the inner layer if the bit is set. Once
@@ -132,19 +132,18 @@ pub(crate) struct FilterMap {
132132
///
133133
/// This is also read by the `Registry`, for two reasons:
134134
///
135-
/// 1. When filtering a span, the registry must store the `FilterMap`
135+
/// 1. When filtering a span, the Registry must store the `FilterMap`
136136
/// generated by `Filtered::enabled` calls for that span as part of the
137137
/// span's per-span data. This allows `Filtered` layers to determine
138-
/// whether they previously disabled a given span, and avoid showing it
138+
/// whether they had previously disabled a given span, and avoid showing it
139139
/// to the wrapped layer if it was disabled.
140140
///
141-
/// This is the mechanism that allows `Filtered` layers to also filter
142-
/// out the spans they disable from span traversals (such as iterating
143-
/// over parents, etc).
141+
/// This allows `Filtered` layers to also filter out the spans they
142+
/// disable from span traversals (such as iterating over parents, etc).
144143
/// 2. If all the bits are set, then every per-layer filter has decided it
145144
/// doesn't want to enable that span or event. In that case, the
146-
/// `Registry`'s `enabled` method will return `false`, so that we can
147-
/// skip recording it entirely.
145+
/// `Registry`'s `enabled` method will return `false`, so that
146+
/// recording a span or event can be skipped entirely.
148147
#[derive(Debug)]
149148
pub(crate) struct FilterState {
150149
enabled: Cell<FilterMap>,
@@ -273,7 +272,7 @@ where
273272
let interest = self.filter.callsite_enabled(metadata);
274273

275274
// If the filter didn't disable the callsite, allow the inner layer to
276-
// register it --- since `register_callsite` is also used for purposes
275+
// register it since `register_callsite` is also used for purposes
277276
// such as reserving/caching per-callsite data, we want the inner layer
278277
// to be able to perform any other registration steps. However, we'll
279278
// ignore its `Interest`.

0 commit comments

Comments
 (0)