Skip to main content

SamplingInfo

Struct SamplingInfo 

Source
pub struct SamplingInfo {
    pub effective_rate: Option<f64>,
    pub max_events_per_sec: Option<u64>,
    pub drop_policy: Option<DropPolicy>,
    pub dropped_total: Option<u64>,
    pub dropped_segment: Option<u64>,
    pub rule: Option<String>,
    pub rule_lang: Option<String>,
    pub applies_to: Option<Vec<u64>>,
    pub extra: Vec<(Value, Value)>,
}
Expand description

Sampling and filtering metadata. Present only when events were dropped or filtered at the source.

Its absence means the trace is complete relative to the declared detail level. Sources must not drop control messages, state changes, errors, or peer and subscription events under any policy — those carry the causal structure that makes the rest of the trace readable — so a source that cannot keep up with them refuses the recording instead. When sampling is active, applies_to names the event types the policy actually touched, and a reader may treat every other type as complete.

Fields§

§effective_rate: Option<f64>

Effective fraction of source events retained, in (0.0, 1.0].

§max_events_per_sec: Option<u64>

Per-segment cap that triggered drops, if rate-limited.

§drop_policy: Option<DropPolicy>

Drop strategy applied when the cap was exceeded.

§dropped_total: Option<u64>

Cumulative events dropped since start_time. In a segmented trace this is the running total at the start of this segment.

§dropped_segment: Option<u64>

Events dropped within this segment only.

§rule: Option<String>

Source-side filter rule that selected events.

§rule_lang: Option<String>

Filter language the rule is written in ("prefix", "glob", "cel").

§applies_to: Option<Vec<u64>>

Event type IDs the drop policy was applied to.

None when the file carried no "appliesTo" — and also when it carried one this crate could not read whole, in which case the array is kept verbatim in SamplingInfo::extra. An "appliesTo" of [3, "x", 5] read as [3, 5] would not be a partial answer: the key names the event types the drop policy touched, and a reader may treat every type absent from it as complete, so shortening the array reports a sampled event type as fully recorded.

§extra: Vec<(Value, Value)>

Keys in the "sampling" map that this version of the crate could not use, kept verbatim and written back into that map. See TraceHeader::extra.

Empty for every sampling map this crate constructs itself.

Implementations§

Source§

impl SamplingInfo

Source

fn writes_key(&self, key: &str) -> bool

Whether key is written from one of this map’s own fields. See TraceHeader::writes_key.

Source

fn to_value(&self) -> Value

Source

fn from_pairs(pairs: &[(Value, Value)]) -> Self

Decode the contents of a "sampling" map. Infallible: the map has no required keys, so every value this cannot use goes to the store.

The caller has already established that the value is a map; a "sampling" that is not one goes to the header’s store.

Trait Implementations§

Source§

impl Clone for SamplingInfo

Source§

fn clone(&self) -> SamplingInfo

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 SamplingInfo

Source§

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

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

impl Default for SamplingInfo

Source§

fn default() -> SamplingInfo

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

impl PartialEq for SamplingInfo

Source§

fn eq(&self, other: &SamplingInfo) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SamplingInfo

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.