pub struct SpanConcentrator { /* private fields */ }Expand description
SpanConcentrator compute stats on span aggregated by time and span attributes
§Aggregation
Spans are aggregated into time buckets based on their end_time. Within each time bucket there
is another level of aggregation based on the spans fields (e.g. resource_name, service_name)
and the peer tags if the peer_tags_aggregation is enabled.
§Span eligibility
The ingested spans are only aggregated if they are root, top-level, measured or if their
span.kind is eligible and the compute_stats_by_span_kind is enabled.
§Flushing
When the SpanConcentrator is flushed it keeps the buffer_len most recent buckets and remove
all older buckets returning their content. When using force flush all buckets are flushed
regardless of their age.
Implementations§
Source§impl SpanConcentrator
impl SpanConcentrator
Sourcepub fn new(
bucket_size: Duration,
now: SystemTime,
span_kinds_stats_computed: Vec<String>,
peer_tag_keys: Vec<String>,
) -> SpanConcentrator
pub fn new( bucket_size: Duration, now: SystemTime, span_kinds_stats_computed: Vec<String>, peer_tag_keys: Vec<String>, ) -> SpanConcentrator
Return a new concentrator with the given parameters
bucket_sizeis the size of the time bucketsnowthe current system time, used to define the oldest bucketspan_kinds_stats_computedlist of span kinds eligible for stats computationpeer_tags_keyslist of keys considered as peer tags for aggregation
Sourcepub fn set_span_kinds(&mut self, span_kinds: Vec<String>)
pub fn set_span_kinds(&mut self, span_kinds: Vec<String>)
Set the list of span kinds eligible for stats computation
Set the list of keys considered as peer_tags for aggregation
Sourcepub fn get_bucket_size(&self) -> Duration
pub fn get_bucket_size(&self) -> Duration
Return the bucket size used for aggregation
Sourcepub fn add_span<'a, T>(&'a mut self, span: &'a T)where
T: StatSpan<'a>,
pub fn add_span<'a, T>(&'a mut self, span: &'a T)where
T: StatSpan<'a>,
Add a span into the concentrator, by computing stats if the span is eligible for stats computation.
Sourcepub fn flush(&mut self, now: SystemTime, force: bool) -> Vec<ClientStatsBucket>
pub fn flush(&mut self, now: SystemTime, force: bool) -> Vec<ClientStatsBucket>
Flush all stats bucket except for the buffer_len most recent. If force is true, flush
all buckets.
Trait Implementations§
Source§impl Clone for SpanConcentrator
impl Clone for SpanConcentrator
Source§fn clone(&self) -> SpanConcentrator
fn clone(&self) -> SpanConcentrator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more