Class MetricEntityStateOneEnum<E extends Enum<E> & VeniceDimensionInterface>
java.lang.Object
com.linkedin.venice.stats.metrics.AsyncMetricEntityState
com.linkedin.venice.stats.metrics.MetricEntityState
com.linkedin.venice.stats.metrics.MetricEntityStateOneEnum<E>
public class MetricEntityStateOneEnum<E extends Enum<E> & VeniceDimensionInterface>
extends MetricEntityState
This version of
MetricEntityState is used when the metric entity has one dynamic dimension
which is an Enum implementing VeniceDimensionInterface.
The base dimensions that are common for all invocation of this instance are passed in the constructor
which is used along with all possible values for the dynamic dimensions to create an EnumMap of
Attributes for each possible value of the dynamic dimension. These attributes are used during
every record() call, the key to the EnumMap being the value of the dynamic dimension.
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.-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.stats.metrics.AsyncMetricEntityState
AsyncMetricEntityState.TehutiSensorRegistrationFunction -
Field Summary
Fields inherited from class com.linkedin.venice.stats.metrics.AsyncMetricEntityState
metricEntity, otelMetric, otelRepository, tehutiSensor -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends Enum<E> & VeniceDimensionInterface>
MetricEntityStateOneEnum<E>create(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, AsyncMetricEntityState.TehutiSensorRegistrationFunction registerTehutiSensorFn, TehutiMetricNameEnum tehutiMetricNameEnum, List<io.tehuti.metrics.MeasurableStat> tehutiMetricStats, Map<VeniceMetricsDimensions, String> baseDimensionsMap, Class<E> enumTypeClass) Overloaded Factory method for constructor with Tehuti parametersstatic <E extends Enum<E> & VeniceDimensionInterface>
MetricEntityStateOneEnum<E>create(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, Map<VeniceMetricsDimensions, String> baseDimensionsMap, Class<E> enumTypeClass) Factory method with named parameters to ensure the passed in enumTypeClass are in the same order as Eprotected Iterable<MetricAttributesData>Returns an iterable of all MetricAttributesData for observable counter reporting.io.opentelemetry.api.common.AttributesgetAttributes(E dimension) Returns the Attributes for the given dimension.visible for testingvoidvoidMethods inherited from class com.linkedin.venice.stats.metrics.MetricEntityState
isObservableCounter, record, record, recordOtelMetric, recordOtelMetric, registerObservableCounterIfNeededMethods inherited from class com.linkedin.venice.stats.metrics.AsyncMetricEntityState
getTehutiSensor, setOtelMetric, setTehutiSensor
-
Method Details
-
create
public static <E extends Enum<E> & VeniceDimensionInterface> MetricEntityStateOneEnum<E> create(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, Map<VeniceMetricsDimensions, String> baseDimensionsMap, Class<E> enumTypeClass) Factory method with named parameters to ensure the passed in enumTypeClass are in the same order as E -
create
public static <E extends Enum<E> & VeniceDimensionInterface> MetricEntityStateOneEnum<E> create(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, AsyncMetricEntityState.TehutiSensorRegistrationFunction registerTehutiSensorFn, TehutiMetricNameEnum tehutiMetricNameEnum, List<io.tehuti.metrics.MeasurableStat> tehutiMetricStats, Map<VeniceMetricsDimensions, String> baseDimensionsMap, Class<E> enumTypeClass) Overloaded Factory method for constructor with Tehuti parameters -
getAttributes
Returns the Attributes for the given dimension. -
record
-
record
-
getAllMetricAttributesData
Description copied from class:MetricEntityStateReturns 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.- Specified by:
getAllMetricAttributesDatain classMetricEntityState
-
getMetricAttributesDataEnumMap
visible for testing
-