Interface MetricStorage

All Known Subinterfaces:
SynchronousMetricStorage
All Known Implementing Classes:
AsynchronousMetricStorage, DefaultSynchronousMetricStorage, EmptyMetricStorage

public interface MetricStorage
Stores collected MetricData.

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

  • Field Details

    • DEFAULT_MAX_CARDINALITY

      static final int DEFAULT_MAX_CARDINALITY
      The default max number of distinct metric points for a particular MetricStorage.
      See Also:
    • CARDINALITY_OVERFLOW

      static final Attributes CARDINALITY_OVERFLOW
      Attributes capturing overflow measurements recorded when cardinality limit is exceeded.
  • Method Details

    • getMetricDescriptor

      MetricDescriptor getMetricDescriptor()
      Returns a description of the metric produced in this storage.
    • collect

      MetricData collect(Resource resource, InstrumentationScopeInfo instrumentationScopeInfo, long startEpochNanos, long epochNanos)
      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.

      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

      default boolean isEmpty()
      Determines whether this storage is an empty metric storage.

      Uses the reference comparison since EmptyMetricStorage is singleton.

      Returns:
      true if is empty.