#[repr(usize)]pub enum Instruments {
NoInstruments = 0,
LogsWithoutMetrics = 32,
LogsWithMetrics = 103,
LogsWithExpensiveMetrics = 107,
MetricsWithoutLogs = 7,
ExpensiveMetricsWithoutLogs = 11,
Custom(usize),
}
Expand description
Honors the Zero-Cost Instrumentation Pattern for the [stream_executors]:
Designed to be used as a const generic parameter for Structs,
causes the conditional instrumentation code in client structs to
be selectively compiled – see the implemented const methods for
documentation of each available instrument.
Note: Using this enum directly in generics –
as in struct S<const INSTUMENTS: Instruments = { Instruments::NoInstruments }> {...}
– is not possible yet (as of Rust 1.64): “adt const params is experimental [E0658]”,
so we’ll use it as struct S<const INSTRUMENTS: usize = 0>
instead, and use [Instruments::from(INSTRUMENTS)]
in the instrumentable implementations & let s = S::<Instruments::<YourOption>::into()> {};
in clients.
Variants§
NoInstruments = 0
No conditional instrumentation code will be included – bringing in the fastest possible execution speeds at the expense of lowest operational control
LogsWithoutMetrics = 32
LogsWithMetrics = 103
LogsWithExpensiveMetrics = 107
MetricsWithoutLogs = 7
ExpensiveMetricsWithoutLogs = 11
Custom(usize)
Implementations§
Source§impl Instruments
impl Instruments
Sourcepub const fn from(instruments: usize) -> Self
pub const fn from(instruments: usize) -> Self
To be used in if conditions, returns the enum variant that corresponds to the given const generic numeric value as described in Self
Sourcepub const fn into(self) -> usize
pub const fn into(self) -> usize
designed to be used by clients of the implementor structs, returns the number to be used as a const generic numeric value (when instantiating the implementor struct) that corresponds to the given enum variant
Sourcepub const fn logging(self) -> bool
pub const fn logging(self) -> bool
returns whether executors should log start/stop in the INFO
level OR events TRACING
Sourcepub const fn tracing(self) -> bool
pub const fn tracing(self) -> bool
returns whether executors should log events in the TRACING
level
Sourcepub const fn cheap_profiling(self) -> bool
pub const fn cheap_profiling(self) -> bool
returns whether executors should compute the CHEAP_PROFILING
metrics
Trait Implementations§
Source§impl Clone for Instruments
impl Clone for Instruments
Source§fn clone(&self) -> Instruments
fn clone(&self) -> Instruments
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more