Skip to main content

SpanConcentrator

Struct SpanConcentrator 

Source
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

Source

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_size is the size of the time buckets
  • now the current system time, used to define the oldest bucket
  • span_kinds_stats_computed list of span kinds eligible for stats computation
  • peer_tags_keys list of keys considered as peer tags for aggregation
Source

pub fn set_span_kinds(&mut self, span_kinds: Vec<String>)

Set the list of span kinds eligible for stats computation

Source

pub fn set_peer_tags(&mut self, peer_tags: Vec<String>)

Set the list of keys considered as peer_tags for aggregation

Source

pub fn get_bucket_size(&self) -> Duration

Return the bucket size used for aggregation

Source

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.

Source

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

Source§

fn clone(&self) -> SpanConcentrator

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SpanConcentrator

Source§

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

Formats the value using the given formatter. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more