Interface AggregatorFactory


  • @Immutable
    public interface AggregatorFactory
    Factory class for Aggregator.
    • Method Detail

      • sum

        static AggregatorFactory sum​(boolean alwaysCumulative)
        Returns an AggregationFactory that calculates sum of recorded measurements.

        This factory produces Aggregator that will always produce Sum metrics, the monotonicity is determined based on the instrument type (for Counter and SumObserver will be monotonic, otherwise not).

        Parameters:
        alwaysCumulative - configures to always produce AggregationTemporality.CUMULATIVE if true OR AggregationTemporality.DELTA for all types except SumObserver and UpDownSumObserver which will always produce AggregationTemporality.CUMULATIVE.
        Returns:
        an AggregationFactory that calculates sum of recorded measurements.
      • count

        static AggregatorFactory count​(AggregationTemporality temporality)
        Returns an AggregationFactory that calculates count of recorded measurements (the number of recorded measurements).

        This factory produces Aggregator that will always produce monotonic Sum metrics independent of the instrument type. The sum represents the number of measurements recorded.

        Parameters:
        temporality - configures what temporality to be produced for the Sum metrics.
        Returns:
        an AggregationFactory that calculates count of recorded measurements (the number of recorded * measurements).
      • lastValue

        static AggregatorFactory lastValue()
        Returns an AggregationFactory that calculates the last value of all recorded measurements.

        This factory produces Aggregator that will always produce gauge metrics independent of the instrument type.

        Limitation: The current implementation does not store a time when the value was recorded, so merging multiple LastValueAggregators will not preserve the ordering of records.

        Returns:
        an AggregationFactory that calculates the last value of all recorded measurements.
      • minMaxSumCount

        static AggregatorFactory minMaxSumCount()
        Returns an AggregationFactory that calculates a simple summary of all recorded measurements. The summary consists of the count of measurements, the sum of all measurements, the maximum value recorded and the minimum value recorded.

        This factory produces Aggregator that will always produce double summary metrics independent of the instrument type.

        Returns:
        an AggregationFactory that calculates a simple summary of all recorded measurements.
      • histogram

        static AggregatorFactory histogram​(List<Double> boundaries,
                                           AggregationTemporality temporality)
        Returns an AggregatorFactory that calculates an approximation of the distribution of the measurements taken.
        Parameters:
        temporality - configures what temporality to be produced for the Histogram metrics.
        boundaries - configures the fixed bucket boundaries.
        Returns:
        an AggregationFactory that calculates histogram of recorded measurements.
        Since:
        1.1.0
      • create

        <T> Aggregator<T> create​(io.opentelemetry.sdk.resources.Resource resource,
                                 io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo,
                                 InstrumentDescriptor descriptor)
        Returns a new Aggregator.
        Parameters:
        resource - the Resource associated with the Instrument that will record measurements.
        instrumentationLibraryInfo - the InstrumentationLibraryInfo associated with the Instrument that will record measurements.
        descriptor - the descriptor of the Instrument that will record measurements.
        Returns:
        a new Aggregator.