Class AsyncMetricEntityStateTwoEnums<E1 extends Enum<E1> & VeniceDimensionInterface,E2 extends Enum<E2> & VeniceDimensionInterface>

java.lang.Object
com.linkedin.venice.stats.metrics.AsyncMetricEntityStateTwoEnums<E1,E2>

public class AsyncMetricEntityStateTwoEnums<E1 extends Enum<E1> & VeniceDimensionInterface,E2 extends Enum<E2> & VeniceDimensionInterface> extends Object
This class is used when the async metric (MetricType.ASYNC_GAUGE or MetricType.ASYNC_DOUBLE_GAUGE) has two dynamic dimensions, each of which is an Enum implementing VeniceDimensionInterface.

For each combination of (E1, E2) enum values, a separate AsyncMetricEntityStateBase is created with its own callback. The callbacks are pre-registered at construction time.

Callers always provide a BiFunction<E1, E2, 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)

A two-level EnumMap is used for O(1) lookup by (E1, E2) pair, backed by arrays with no hashing overhead.