Class MetricEntityState

java.lang.Object
com.linkedin.venice.stats.metrics.AsyncMetricEntityState
com.linkedin.venice.stats.metrics.MetricEntityState
Direct Known Subclasses:
MetricEntityStateBase, MetricEntityStateFourEnums, MetricEntityStateGeneric, MetricEntityStateOneEnum, MetricEntityStateThreeEnums, MetricEntityStateTwoEnums

public abstract class MetricEntityState extends AsyncMetricEntityState
Abstract operational state of a non-async metric extended on top of AsyncMetricEntityState to provide common functionality for non-async metrics like record() which is not supported for async metrics. This abstract class should be extended by different MetricEntityStates like MetricEntityStateBase to pre-create/cache the Attributes for different number/type of dimensions. check out the classes extending this for more details.
  • Constructor Details

  • Method Details

    • getAllMetricAttributesData

      protected abstract Iterable<MetricAttributesData> getAllMetricAttributesData()
      Returns an iterable of all MetricAttributesData for observable counter reporting. Subclasses must implement this to provide iteration over their specific EnumMap structure. Returns null if metrics are not enabled or no data exists.
    • registerObservableCounterIfNeeded

      protected final void registerObservableCounterIfNeeded()
      Registers the Observable Counter with the OTel repository if this metric uses async recording. Supports both ASYNC_COUNTER_FOR_HIGH_PERF_CASES and ASYNC_UP_DOWN_COUNTER_FOR_HIGH_PERF_CASES. This must be called by subclasses after their constructor completes and the metricAttributesData map is initialized.
    • isObservableCounter

      public final boolean isObservableCounter()
      Returns whether this metric entity state is for an Observable Counter
    • recordOtelMetric

      public void recordOtelMetric(double value, MetricAttributesData holder)
      Record otel metrics with MetricAttributesData (double version for histograms)
    • recordOtelMetric

      public void recordOtelMetric(long value, MetricAttributesData holder)
      Record otel metrics with MetricAttributesData (long version)
    • record

      protected final void record(double value, MetricAttributesData holder)
      Records a double value using MetricAttributesData. Use this for histogram metrics that need double precision.
    • record

      protected final void record(long value, MetricAttributesData holder)
      Records a long value using MetricAttributesData. More efficient for counter/gauge metrics - avoids long->double->long conversion.