Class VeniceOpenTelemetryMetricsRepository

java.lang.Object
com.linkedin.venice.stats.VeniceOpenTelemetryMetricsRepository

public class VeniceOpenTelemetryMetricsRepository extends Object
  • Field Details

    • REDUNDANT_LOG_FILTER

      public static final io.tehuti.utils.RedundantLogFilter REDUNDANT_LOG_FILTER
    • DEFAULT_METRIC_PREFIX

      public static final String DEFAULT_METRIC_PREFIX
      See Also:
  • Constructor Details

    • VeniceOpenTelemetryMetricsRepository

      public VeniceOpenTelemetryMetricsRepository(VeniceMetricsConfig metricsConfig)
  • Method Details

    • cloneWithNewMetricPrefix

      public VeniceOpenTelemetryMetricsRepository cloneWithNewMetricPrefix(String newMetricPrefix)
      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

      public io.opentelemetry.api.metrics.LongCounter createLongCounter(MetricEntity metricEntity)
    • createLongUpDownCounter

      public io.opentelemetry.api.metrics.LongUpDownCounter createLongUpDownCounter(MetricEntity metricEntity)
    • createLongGuage

      public io.opentelemetry.api.metrics.LongGauge createLongGuage(MetricEntity metricEntity)
    • 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. For now, the attributes are passed in as a parameter while creating the gauge, ie, only MetricEntityStateBase is supported for now.
    • createInstrument

      public Object createInstrument(MetricEntity metricEntity, LongSupplier asyncCallback, io.opentelemetry.api.common.Attributes attributes)
    • createInstrument

      public Object createInstrument(MetricEntity metricEntity)
    • 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_CASES metrics, the callback is invoked during OpenTelemetry's metric collection cycle. The callback should iterate over all accumulated values and report them via the provided ObservableLongMeasurement.

      Parameters:
      metricEntity - the metric entity definition
      reportCallback - 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_CASES metrics, the callback is invoked during OpenTelemetry's metric collection cycle. The callback should iterate over all accumulated values and report them via the provided ObservableLongMeasurement. Unlike ASYNC_COUNTER_FOR_HIGH_PERF_CASES, this supports both positive and negative values.

      Parameters:
      metricEntity - the metric entity definition
      reportCallback - callback that reports all accumulated values to the measurement
      Returns:
      the created ObservableLongUpDownCounter, or null if OTel metrics are disabled
    • getDimensionName

      public String getDimensionName(VeniceMetricsDimensions dimension)
    • 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

      public void recordFailureMetric(MetricEntity metricEntity, Exception e)
    • recordFailureMetric

      public void recordFailureMetric(MetricEntity metricEntity, String error)
    • emitOpenTelemetryMetrics

      public boolean emitOpenTelemetryMetrics()
    • emitTehutiMetrics

      public boolean emitTehutiMetrics()
    • getMetricsConfig

      public VeniceMetricsConfig getMetricsConfig()
    • getMetricFormat

      public VeniceOpenTelemetryMetricNamingFormat getMetricFormat()
    • getRecordFailureMetric

      public MetricEntityStateBase getRecordFailureMetric()