Class AsynchronousMetricStorage<T extends PointData, U extends ExemplarData>

java.lang.Object
io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage<T,U>
All Implemented Interfaces:
MetricStorage

public final class AsynchronousMetricStorage<T extends PointData, U extends ExemplarData> extends Object implements MetricStorage
Stores aggregated MetricData for asynchronous instruments.

This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

  • Method Details

    • create

      public static <T extends PointData, U extends ExemplarData> AsynchronousMetricStorage<T,U> create(RegisteredReader registeredReader, RegisteredView registeredView, InstrumentDescriptor instrumentDescriptor)
      Create an asynchronous storage instance for the View and InstrumentDescriptor.
    • getMetricDescriptor

      public MetricDescriptor getMetricDescriptor()
      Description copied from interface: MetricStorage
      Returns a description of the metric produced in this storage.
      Specified by:
      getMetricDescriptor in interface MetricStorage
    • getRegisteredReader

      public RegisteredReader getRegisteredReader()
      Returns the registered reader this storage is associated with.
    • collect

      public MetricData collect(Resource resource, InstrumentationScopeInfo instrumentationScopeInfo, long startEpochNanos, long epochNanos)
      Description copied from interface: MetricStorage
      Collects the metrics from this storage. If storing AggregationTemporality.DELTA metrics, reset for the next collection period.

      Note: This is a stateful operation and will reset any interval-related state for the collector.

      Specified by:
      collect in interface MetricStorage
      Parameters:
      resource - The resource associated with the metrics.
      instrumentationScopeInfo - The instrumentation scope generating the metrics.
      startEpochNanos - The start timestamp for this SDK.
      epochNanos - The timestamp for this collection.
      Returns:
      The MetricData from this collection period.
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: MetricStorage
      Determines whether this storage is an empty metric storage.

      Uses the reference comparison since EmptyMetricStorage is singleton.

      Specified by:
      isEmpty in interface MetricStorage
      Returns:
      true if is empty.