pub struct SamplingLayerBuilder<S, N = DefaultFields, E = Format<Full>, W = fn() -> Stderr> { /* private fields */ }Expand description
Builder for SamplingLayer.
Created via SamplingLayer::builder().
Implementations§
Source§impl<S, N, E, W> SamplingLayerBuilder<S, N, E, W>
impl<S, N, E, W> SamplingLayerBuilder<S, N, E, W>
Sourcepub fn budget(self, filter: EnvFilter, limit_per_second: u64) -> Self
pub fn budget(self, filter: EnvFilter, limit_per_second: u64) -> Self
Add a sampling budget with an EnvFilter and a per-second event limit.
Budgets whose limit rounds to zero events per bucket are skipped.
Sourcepub fn bucket_duration(self, duration: Duration) -> Self
pub fn bucket_duration(self, duration: Duration) -> Self
Set the time bucket duration. Defaults to 50ms.
Sourcepub fn writer<W2>(self, writer: W2) -> SamplingLayerBuilder<S, N, E, W2>
pub fn writer<W2>(self, writer: W2) -> SamplingLayerBuilder<S, N, E, W2>
Set the output writer. Defaults to stderr.
Source§impl<S, N, E, W> SamplingLayerBuilder<S, N, E, W>where
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'writer> FormatFields<'writer> + 'static,
E: FormatEvent<S, N> + 'static,
impl<S, N, E, W> SamplingLayerBuilder<S, N, E, W>where
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'writer> FormatFields<'writer> + 'static,
E: FormatEvent<S, N> + 'static,
Sourcepub fn event_format<E2>(self, e: E2) -> SamplingLayerBuilder<S, N, E2, W>where
E2: FormatEvent<S, N> + 'static,
pub fn event_format<E2>(self, e: E2) -> SamplingLayerBuilder<S, N, E2, W>where
E2: FormatEvent<S, N> + 'static,
Sets the event formatter.
Sourcepub fn map_event_format<E2>(
self,
f: impl FnOnce(E) -> E2,
) -> SamplingLayerBuilder<S, N, E2, W>where
E2: FormatEvent<S, N> + 'static,
pub fn map_event_format<E2>(
self,
f: impl FnOnce(E) -> E2,
) -> SamplingLayerBuilder<S, N, E2, W>where
E2: FormatEvent<S, N> + 'static,
Updates the event formatter by applying a function to the existing one.
Sourcepub fn fmt_fields<N2>(self, fmt_fields: N2) -> SamplingLayerBuilder<S, N2, E, W>where
N2: for<'writer> FormatFields<'writer> + 'static,
pub fn fmt_fields<N2>(self, fmt_fields: N2) -> SamplingLayerBuilder<S, N2, E, W>where
N2: for<'writer> FormatFields<'writer> + 'static,
Sets the field formatter.
Source§impl<S, N, L, T, W> SamplingLayerBuilder<S, N, Format<L, T>, W>where
N: for<'writer> FormatFields<'writer> + 'static,
impl<S, N, L, T, W> SamplingLayerBuilder<S, N, Format<L, T>, W>where
N: for<'writer> FormatFields<'writer> + 'static,
Sourcepub fn without_time(self) -> SamplingLayerBuilder<S, N, Format<L, ()>, W>
pub fn without_time(self) -> SamplingLayerBuilder<S, N, Format<L, ()>, W>
Do not emit timestamps.
Sourcepub fn with_target(self, display_target: bool) -> Self
pub fn with_target(self, display_target: bool) -> Self
Sets whether or not an event’s target is displayed.
Sourcepub fn with_level(self, display_level: bool) -> Self
pub fn with_level(self, display_level: bool) -> Self
Sets whether or not an event’s level is displayed.
Sourcepub fn compact(self) -> SamplingLayerBuilder<S, N, Format<Compact, T>, W>where
N: for<'writer> FormatFields<'writer> + 'static,
pub fn compact(self) -> SamplingLayerBuilder<S, N, Format<Compact, T>, W>where
N: for<'writer> FormatFields<'writer> + 'static,
Use the compact formatter.
Source§impl<S, N, E, W> SamplingLayerBuilder<S, N, E, W>where
W: for<'a> MakeWriter<'a> + 'static,
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'writer> FormatFields<'writer> + 'static,
E: FormatEvent<S, N> + 'static,
impl<S, N, E, W> SamplingLayerBuilder<S, N, E, W>where
W: for<'a> MakeWriter<'a> + 'static,
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'writer> FormatFields<'writer> + 'static,
E: FormatEvent<S, N> + 'static,
Sourcepub fn build(self) -> (SamplingLayer<S, N, E, W>, Stats)
pub fn build(self) -> (SamplingLayer<S, N, E, W>, Stats)
Consume the builder and create a SamplingLayer
and a Stats handle for reading event counters.
Auto Trait Implementations§
impl<S, N = DefaultFields, E = Format, W = fn() -> Stderr> !Freeze for SamplingLayerBuilder<S, N, E, W>
impl<S, N, E, W> RefUnwindSafe for SamplingLayerBuilder<S, N, E, W>
impl<S, N, E, W> Send for SamplingLayerBuilder<S, N, E, W>
impl<S, N, E, W> Sync for SamplingLayerBuilder<S, N, E, W>
impl<S, N, E, W> Unpin for SamplingLayerBuilder<S, N, E, W>
impl<S, N, E, W> UnsafeUnpin for SamplingLayerBuilder<S, N, E, W>
impl<S, N, E, W> UnwindSafe for SamplingLayerBuilder<S, N, E, W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more