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
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. -
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 -
Constructor Summary
ConstructorsConstructorDescriptionMetricEntityState(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, Map<VeniceMetricsDimensions, String> baseDimensionsMap, AsyncMetricEntityState.TehutiSensorRegistrationFunction registerTehutiSensorFn, TehutiMetricNameEnum tehutiMetricNameEnum, List<io.tehuti.metrics.MeasurableStat> tehutiMetricStats) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Iterable<MetricAttributesData>Returns an iterable of all MetricAttributesData for observable counter reporting.final booleanReturns whether this metric entity state is for an Observable Counterprotected final voidrecord(double value, MetricAttributesData holder) Records a double value using MetricAttributesData.protected final voidrecord(long value, MetricAttributesData holder) Records a long value using MetricAttributesData.voidrecordOtelMetric(double value, MetricAttributesData holder) Record otel metrics with MetricAttributesData (double version for histograms)voidrecordOtelMetric(long value, MetricAttributesData holder) Record otel metrics with MetricAttributesData (long version)protected final voidRegisters the Observable Counter with the OTel repository if this metric uses async recording.Methods inherited from class com.linkedin.venice.stats.metrics.AsyncMetricEntityState
getTehutiSensor, setOtelMetric, setTehutiSensor
-
Constructor Details
-
MetricEntityState
public MetricEntityState(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, Map<VeniceMetricsDimensions, String> baseDimensionsMap, AsyncMetricEntityState.TehutiSensorRegistrationFunction registerTehutiSensorFn, TehutiMetricNameEnum tehutiMetricNameEnum, List<io.tehuti.metrics.MeasurableStat> tehutiMetricStats)
-
-
Method Details
-
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
Record otel metrics with MetricAttributesData (double version for histograms) -
recordOtelMetric
Record otel metrics with MetricAttributesData (long version) -
record
Records a double value using MetricAttributesData. Use this for histogram metrics that need double precision. -
record
Records a long value using MetricAttributesData. More efficient for counter/gauge metrics - avoids long->double->long conversion.
-