[][src]Trait opentelemetry::sdk::export::metrics::Aggregator

pub trait Aggregator: Debug {
    pub fn update(&self, number: &Number, descriptor: &Descriptor) -> Result<()>;
pub fn synchronized_move(
        &self,
        destination: &Arc<dyn Aggregator + Send + Sync>,
        descriptor: &Descriptor
    ) -> Result<()>;
pub fn merge(
        &self,
        other: &(dyn Aggregator + Send + Sync),
        descriptor: &Descriptor
    ) -> Result<()>;
pub fn as_any(&self) -> &dyn Any; }
This is supported on crate feature metrics only.

Aggregator implements a specific aggregation behavior, i.e., a behavior to track a sequence of updates to an instrument. Sum-only instruments commonly use a simple Sum aggregator, but for the distribution instruments (ValueRecorder, ValueObserver) there are a number of possible aggregators with different cost and accuracy tradeoffs.

Note that any Aggregator may be attached to any instrument--this is the result of the OpenTelemetry API/SDK separation. It is possible to attach a Sum aggregator to a ValueRecorder instrument or a MinMaxSumCount aggregator to a Counter instrument.

Required methods

pub fn update(&self, number: &Number, descriptor: &Descriptor) -> Result<()>[src]

Update receives a new measured value and incorporates it into the aggregation. Update calls may be called concurrently.

Descriptor::number_kind should be consulted to determine whether the provided number is an i64, u64 or f64.

The current Context could be inspected for a Baggage or SpanContext.

pub fn synchronized_move(
    &self,
    destination: &Arc<dyn Aggregator + Send + Sync>,
    descriptor: &Descriptor
) -> Result<()>
[src]

This method is called during collection to finish one period of aggregation by atomically saving the currently-updating state into the argument Aggregator.

synchronized_move is called concurrently with update. These two methods must be synchronized with respect to each other, for correctness.

This method will return an InconsistentAggregator error if this Aggregator cannot be copied into the destination due to an incompatible type.

This call has no Context argument because it is expected to perform only computation.

pub fn merge(
    &self,
    other: &(dyn Aggregator + Send + Sync),
    descriptor: &Descriptor
) -> Result<()>
[src]

This combines the checkpointed state from the argument Aggregator into this Aggregator. merge is not synchronized with respect to update or synchronized_move.

The owner of an Aggregator being merged is responsible for synchronization of both Aggregator states.

pub fn as_any(&self) -> &dyn Any[src]

Returns the implementing aggregator as Any for downcasting.

Loading content...

Implementors

impl Aggregator for ArrayAggregator[src]

impl Aggregator for DDSKetchAggregator[src]

impl Aggregator for HistogramAggregator[src]

impl Aggregator for LastValueAggregator[src]

impl Aggregator for MinMaxSumCountAggregator[src]

impl Aggregator for SumAggregator[src]

Loading content...