Class VeniceOpenTelemetryMetricsRepository
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final io.tehuti.utils.RedundantLogFilter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncloneWithNewMetricPrefix(String newMetricPrefix) Creates a new repository that shares the same OpenTelemetry SDK instance but uses a different metric prefix.voidclose()io.opentelemetry.api.metrics.ObservableLongGaugecreateAsyncLongGauge(MetricEntity metricEntity, LongSupplier asyncCallback, io.opentelemetry.api.common.Attributes attributes) Asynchronous gauge that will call the callback during metrics collection.io.opentelemetry.api.common.AttributescreateAttributes(MetricEntity metricEntity, Map<VeniceMetricsDimensions, String> baseDimensionsMap, VeniceDimensionInterface... additionalDimensionEnums) io.opentelemetry.api.common.AttributescreateAttributes(MetricEntity metricEntity, Map<VeniceMetricsDimensions, String> baseDimensionsMap, Map<VeniceMetricsDimensions, String> additionalDimensionsMap) io.opentelemetry.api.metrics.DoubleHistogramcreateDoubleHistogram(MetricEntity metricEntity) createInstrument(MetricEntity metricEntity) createInstrument(MetricEntity metricEntity, LongSupplier asyncCallback, io.opentelemetry.api.common.Attributes attributes) io.opentelemetry.api.metrics.LongCountercreateLongCounter(MetricEntity metricEntity) io.opentelemetry.api.metrics.LongGaugecreateLongGuage(MetricEntity metricEntity) io.opentelemetry.api.metrics.LongUpDownCountercreateLongUpDownCounter(MetricEntity metricEntity) booleanbooleangetDimensionName(VeniceMetricsDimensions dimension) voidrecordFailureMetric(MetricEntity metricEntity, Exception e) voidrecordFailureMetric(MetricEntity metricEntity, String error) io.opentelemetry.api.metrics.ObservableLongCounterregisterObservableLongCounter(MetricEntity metricEntity, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> reportCallback) Registers an Observable Long Counter that reads accumulated values from a callback.io.opentelemetry.api.metrics.ObservableLongUpDownCounterregisterObservableLongUpDownCounter(MetricEntity metricEntity, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> reportCallback) Registers an Observable Long UpDownCounter that reads accumulated values from a callback.
-
Field Details
-
REDUNDANT_LOG_FILTER
public static final io.tehuti.utils.RedundantLogFilter REDUNDANT_LOG_FILTER -
DEFAULT_METRIC_PREFIX
- See Also:
-
-
Constructor Details
-
VeniceOpenTelemetryMetricsRepository
-
-
Method Details
-
cloneWithNewMetricPrefix
Creates a new repository that shares the same OpenTelemetry SDK instance but uses a different metric prefix. This is useful for emitting metrics with a different prefix (e.g., "participant_store_client") without reinitializing OpenTelemetry.- Parameters:
newMetricPrefix- The metric prefix to use for the child repository- Returns:
- A new VeniceOpenTelemetryMetricsRepository instance with the specified prefix
-
createDoubleHistogram
public io.opentelemetry.api.metrics.DoubleHistogram createDoubleHistogram(MetricEntity metricEntity) -
createLongCounter
-
createLongUpDownCounter
public io.opentelemetry.api.metrics.LongUpDownCounter createLongUpDownCounter(MetricEntity metricEntity) -
createLongGuage
-
createAsyncLongGauge
public io.opentelemetry.api.metrics.ObservableLongGauge createAsyncLongGauge(MetricEntity metricEntity, @Nonnull LongSupplier asyncCallback, @Nonnull io.opentelemetry.api.common.Attributes attributes) Asynchronous gauge that will call the callback during metrics collection. This is useful for metrics that are not updated frequently or require expensive computation.Each call creates a new SDK instrument handle via
buildWithCallback— there is no deduplication. Multiple callers (e.g., different stores) can register callbacks for the same metric name; the OTel SDK natively aggregates all their data points during collection. -
createInstrument
public Object createInstrument(MetricEntity metricEntity, LongSupplier asyncCallback, io.opentelemetry.api.common.Attributes attributes) -
createInstrument
-
registerObservableLongCounter
public io.opentelemetry.api.metrics.ObservableLongCounter registerObservableLongCounter(MetricEntity metricEntity, @Nonnull Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> reportCallback) Registers an Observable Long Counter that reads accumulated values from a callback. This method should be called after the MetricEntityState is fully constructed, as the callback needs access to the metricAttributesData map.For
MetricType.ASYNC_COUNTER_FOR_HIGH_PERF_CASESmetrics, the callback is invoked during OpenTelemetry's metric collection cycle. The callback should iterate over all accumulated values and report them via the providedObservableLongMeasurement.Each call creates a new SDK instrument handle via
buildWithCallback— there is no deduplication. The OTel SDK natively aggregates data points from multiple instruments sharing the same name during the export pipeline's collection cycle.- Parameters:
metricEntity- the metric entity definitionreportCallback- callback that reports all accumulated values to the measurement- Returns:
- the created ObservableLongCounter, or null if OTel metrics are disabled
-
registerObservableLongUpDownCounter
public io.opentelemetry.api.metrics.ObservableLongUpDownCounter registerObservableLongUpDownCounter(MetricEntity metricEntity, @Nonnull Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> reportCallback) Registers an Observable Long UpDownCounter that reads accumulated values from a callback. This method should be called after the MetricEntityState is fully constructed, as the callback needs access to the metricAttributesData map.For
MetricType.ASYNC_UP_DOWN_COUNTER_FOR_HIGH_PERF_CASESmetrics, the callback is invoked during OpenTelemetry's metric collection cycle. The callback should iterate over all accumulated values and report them via the providedObservableLongMeasurement. Unlike ASYNC_COUNTER_FOR_HIGH_PERF_CASES, this supports both positive and negative values.Each call creates a new SDK instrument handle via
buildWithCallback— there is no deduplication. The OTel SDK natively aggregates data points from multiple instruments sharing the same name during the export pipeline's collection cycle.- Parameters:
metricEntity- the metric entity definitionreportCallback- callback that reports all accumulated values to the measurement- Returns:
- the created ObservableLongUpDownCounter, or null if OTel metrics are disabled
-
getDimensionName
-
createAttributes
public io.opentelemetry.api.common.Attributes createAttributes(MetricEntity metricEntity, Map<VeniceMetricsDimensions, String> baseDimensionsMap, VeniceDimensionInterface... additionalDimensionEnums) -
createAttributes
public io.opentelemetry.api.common.Attributes createAttributes(MetricEntity metricEntity, Map<VeniceMetricsDimensions, String> baseDimensionsMap, Map<VeniceMetricsDimensions, String> additionalDimensionsMap) -
close
public void close() -
recordFailureMetric
-
recordFailureMetric
-
emitOpenTelemetryMetrics
public boolean emitOpenTelemetryMetrics() -
emitTehutiMetrics
public boolean emitTehutiMetrics() -
getMetricsConfig
-
getMetricFormat
-
getRecordFailureMetric
-