Interface DefaultAggregationSelector

All Known Subinterfaces:
MetricExporter, MetricReader
All Known Implementing Classes:
OtlpGrpcMetricExporter, OtlpHttpMetricExporter, PeriodicMetricReader
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DefaultAggregationSelector
A functional interface that selects default Aggregation based on InstrumentType.
Since:
1.16.0
  • Method Details

    • getDefault

      static DefaultAggregationSelector getDefault()
      The default implementation of DefaultAggregationSelector which returns the default aggregation for each instrument.
    • with

      default DefaultAggregationSelector with(InstrumentType instrumentType, Aggregation aggregation)
      Returns a default aggregation selector which returns the given aggregation for the given instrumentType, and defers to this for other instrument types.

      For example, the following produces a selector which drops histograms and uses the default aggregation for other instruments:

      
       // DefaultAggregationSelector selector =
       //   DefaultAggregationSelector.getDefault()
       //     .with(InstrumentType.HISTOGRAM, Aggregation.drop());
       
      Since:
      1.16.0
    • getDefaultAggregation

      Aggregation getDefaultAggregation(InstrumentType instrumentType)
      Return the default aggregation for the InstrumentType.

      The default aggregation is used when an instrument does not match any views.

    • asString

      static String asString(DefaultAggregationSelector selector)
      Returns a string representation of this selector, for using in Object.toString() implementations.
      Since:
      1.38.0