Class MetricEntityStateGeneric
java.lang.Object
com.linkedin.venice.stats.metrics.MetricEntityState
com.linkedin.venice.stats.metrics.MetricEntityStateGeneric
Provides a flexible, generic, and non-caching implementation of
MetricEntityState
for one or more
dynamic dimensions, where the dimensions can be enums or arbitrary strings and do not need to be cached: This
implementation should be used only in certain control-path components (such as controllers) where:
1. Performance constraints are lenient, and metric recording is infrequent.
2. The metric entity requires an arbitrary number of dynamic dimensions without predefined enums: For example,
store name, cluster name, etc. Do not use this for cases with 0 dynamic dimensions and use
MetricEntityStateBase
instead.
This approach also helps reduce code complexity and avoids the proliferation of specialized subclasses (like
MetricEntityStateOneEnum) for different dynamic dimension combinations when attribute caching is not necessary.
Compared to enum-based subclasses, this class provides less compile-time type safety, as it does not enforce
dynamic dimensions to be enums and does not require explicit dimension types during instantiation.-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.stats.metrics.MetricEntityState
MetricEntityState.TehutiSensorRegistrationFunction
-
Method Summary
Modifier and TypeMethodDescriptionstatic MetricEntityStateGeneric
create
(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, MetricEntityState.TehutiSensorRegistrationFunction registerTehutiSensorFn, TehutiMetricNameEnum tehutiMetricNameEnum, List<io.tehuti.metrics.MeasurableStat> tehutiMetricStats, Map<VeniceMetricsDimensions, String> baseDimensionsMap) Overloaded Factory method for constructor with Tehuti parametersstatic MetricEntityStateGeneric
create
(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, Map<VeniceMetricsDimensions, String> baseDimensionsMap) Factory method to keep the API consistent with other subclasses likeMetricEntityStateOneEnum
void
record
(double value, Map<VeniceMetricsDimensions, String> dimensions) void
record
(long value, Map<VeniceMetricsDimensions, String> dimensions) Methods inherited from class com.linkedin.venice.stats.metrics.MetricEntityState
createMetric, recordOtelMetric, setOtelMetric, setTehutiSensor
-
Method Details
-
create
public static MetricEntityStateGeneric create(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, Map<VeniceMetricsDimensions, String> baseDimensionsMap) Factory method to keep the API consistent with other subclasses likeMetricEntityStateOneEnum
-
create
public static MetricEntityStateGeneric create(MetricEntity metricEntity, VeniceOpenTelemetryMetricsRepository otelRepository, MetricEntityState.TehutiSensorRegistrationFunction registerTehutiSensorFn, TehutiMetricNameEnum tehutiMetricNameEnum, List<io.tehuti.metrics.MeasurableStat> tehutiMetricStats, Map<VeniceMetricsDimensions, String> baseDimensionsMap) Overloaded Factory method for constructor with Tehuti parameters -
record
-
record
-