Class AsyncMetricEntityStateOneEnum<E extends Enum<E> & VeniceDimensionInterface>

java.lang.Object
com.linkedin.venice.stats.metrics.AsyncMetricEntityStateOneEnum<E>

public class AsyncMetricEntityStateOneEnum<E extends Enum<E> & VeniceDimensionInterface> extends Object
This class is used when the async metric (MetricType.ASYNC_GAUGE or MetricType.ASYNC_DOUBLE_GAUGE) has one dynamic dimension which is an Enum implementing VeniceDimensionInterface.

For each enum value, a separate AsyncMetricEntityStateBase is created with its own callback. This allows polling different values based on the dimension (e.g., different VersionRole values).

Callers always provide a DoubleSupplier callback. The factory dispatches to the correct OTel instrument type based on the MetricEntity's MetricType:

  • ASYNC_GAUGE creates an ObservableLongGauge (value cast to long)
  • ASYNC_DOUBLE_GAUGE creates an ObservableDoubleGauge (value used as-is)

EnumMap is used here as it is more efficient than HashMap as it is backed by an array and does not require hashing of the keys resulting in constant time complexity for get() and put() operations.