pub struct DirectiveSet { /* private fields */ }Expand description
The set of active directives, evaluated per request. Cheap to evaluate (a filtered scan); typically a handful of directives are active at once.
Implementations§
Source§impl DirectiveSet
impl DirectiveSet
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty set, every request evaluates to DiagLevel::Off.
Sourcepub fn from_directives(directives: Vec<DiagnosticsDirective>) -> Self
pub fn from_directives(directives: Vec<DiagnosticsDirective>) -> Self
Builds a set from active directives.
Sourcepub fn evaluate(
&self,
attrs: &RequestAttrs<'_>,
now: Instant,
request: &RequestId,
) -> DiagLevel
pub fn evaluate( &self, attrs: &RequestAttrs<'_>, now: Instant, request: &RequestId, ) -> DiagLevel
The effective level for a request: the highest level among the
directives that apply (target matches, not expired, in sample), or
DiagLevel::Off if none do.
Sourcepub fn wants_ring_buffer(
&self,
attrs: &RequestAttrs<'_>,
now: Instant,
request: &RequestId,
) -> bool
pub fn wants_ring_buffer( &self, attrs: &RequestAttrs<'_>, now: Instant, request: &RequestId, ) -> bool
Whether any applying directive requests local ring-buffer capture.
Sourcepub fn wants_capture(
&self,
attrs: &RequestAttrs<'_>,
now: Instant,
request: &RequestId,
) -> bool
pub fn wants_capture( &self, attrs: &RequestAttrs<'_>, now: Instant, request: &RequestId, ) -> bool
Whether any applying directive turns on fleet traffic capture for this
request. The runtime gate for capture-on-demand: with no matching
directive (the baseline), this is false and nothing is teed.
Sourcepub fn introspect(&self, now: Instant) -> Value
pub fn introspect(&self, now: Instant) -> Value
A well-defined, shape-only introspection of the active settings: for each
directive, what it targets, at what verbosity and sample, whether it
captures to the ring buffer, and whether it has expired at now.
This is the read side of the control-plane store, an agent fetches it
to see exactly what an instance is applying. The schema mirrors the publish
body (crate::DirectiveSet decoding), except the relative ttl_secs is
reported as a computed expired flag, since expiry is held as an absolute
monotonic instant that has no portable numeric form. Value-free throughout:
the only strings are operator-authored ids and targeting selectors.
Trait Implementations§
Source§impl Clone for DirectiveSet
impl Clone for DirectiveSet
Source§fn clone(&self) -> DirectiveSet
fn clone(&self) -> DirectiveSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more