logo
pub trait Processor: AsDynProcessor {
    fn aggregator_selector(&self) -> &dyn AggregatorSelector;
}
Available on crate feature metrics only.
Expand description

Processor is responsible for deciding which kind of aggregation to use (via aggregation_selector), gathering exported results from the SDK during collection, and deciding over which dimensions to group the exported data.

The SDK supports binding only one of these interfaces, as it has the sole responsibility of determining which Aggregator to use for each record.

The embedded AggregatorSelector interface is called (concurrently) in instrumentation context to select the appropriate Aggregator for an instrument.

Required Methods

AggregatorSelector is responsible for selecting the concrete type of Aggregator used for a metric in the SDK.

This may be a static decision based on fields of the Descriptor, or it could use an external configuration source to customize the treatment of each metric instrument.

The result from AggregatorSelector.AggregatorFor should be the same type for a given Descriptor or else nil. The same type should be returned for a given descriptor, because Aggregators only know how to Merge with their own type. If the result is nil, the metric instrument will be disabled.

Note that the SDK only calls AggregatorFor when new records require an Aggregator. This does not provide a way to disable metrics with active records.

Implementors