Skip to main content

DirectiveSet

Struct DirectiveSet 

Source
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

Source

pub fn new() -> Self

An empty set, every request evaluates to DiagLevel::Off.

Source

pub fn from_directives(directives: Vec<DiagnosticsDirective>) -> Self

Builds a set from active directives.

Source

pub fn len(&self) -> usize

How many directives the set holds.

Source

pub fn is_empty(&self) -> bool

Whether the set is empty (every request evaluates to Off).

Source

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.

Source

pub fn wants_ring_buffer( &self, attrs: &RequestAttrs<'_>, now: Instant, request: &RequestId, ) -> bool

Whether any applying directive requests local ring-buffer capture.

Source

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.

Source

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

Source§

fn clone(&self) -> DirectiveSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DirectiveSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DirectiveSet

Source§

fn default() -> DirectiveSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.