Interface Aggregator<T>

  • All Known Implementing Classes:
    AbstractAggregator

    @Immutable
    public interface Aggregator<T>
    Aggregator represents the abstract class for all the available aggregations that can be computed during the accumulation phase for all the instrument.

    The synchronous instruments will create an AggregatorHandle to record individual measurements synchronously, and for asynchronous the accumulateDouble(double) or accumulateLong(long) will be used when reading values from the instrument callbacks.

    • Method Detail

      • accumulateLong

        default T accumulateLong​(long value)
        Returns a new Accumulation for the given value. This MUST be used by the asynchronous instruments to create Accumulation that are passed to the processor.
        Parameters:
        value - the given value to be used to create the Accumulation.
        Returns:
        a new Accumulation for the given value.
      • accumulateDouble

        default T accumulateDouble​(double value)
        Returns a new Accumulation for the given value. This MUST be used by the asynchronous instruments to create Accumulation that are passed to the processor.
        Parameters:
        value - the given value to be used to create the Accumulation.
        Returns:
        a new Accumulation for the given value.
      • merge

        T merge​(T a1,
                T a2)
        Returns the result of the merge of the given accumulations.
        Returns:
        the result of the merge of the given accumulations.
      • isStateful

        boolean isStateful()
        Returns true if the processor needs to keep the previous collected state in order to compute the desired metric.
        Returns:
        true if the processor needs to keep the previous collected state.
      • toMetricData

        @Nullable
        MetricData toMetricData​(Map<io.opentelemetry.api.metrics.common.Labels,​T> accumulationByLabels,
                                long startEpochNanos,
                                long lastCollectionEpoch,
                                long epochNanos)
        Returns the MetricData that this Aggregation will produce.
        Parameters:
        accumulationByLabels - the map of Labels to Accumulation.
        startEpochNanos - the startEpochNanos for the Point.
        epochNanos - the epochNanos for the Point.
        Returns:
        the MetricDataType that this Aggregation will produce.