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
impl SamplingInfo
Sourcefn writes_key(&self, key: &str) -> bool
fn writes_key(&self, key: &str) -> bool
Whether key is written from one of this map’s own fields. See
TraceHeader::writes_key.
fn to_value(&self) -> Value
Sourcefn from_pairs(pairs: &[(Value, Value)]) -> Self
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
impl Clone for SamplingInfo
Source§fn clone(&self) -> SamplingInfo
fn clone(&self) -> SamplingInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more