Class NativeMetadataRepositoryStats

java.lang.Object
com.linkedin.venice.stats.AbstractVeniceStats
com.linkedin.davinci.stats.NativeMetadataRepositoryStats

public class NativeMetadataRepositoryStats extends AbstractVeniceStats
Tracks metadata cache staleness for NativeMetadataRepository.

Tehuti emits a single high-watermark gauge (oldest store's staleness across all stores). OTel emits per-store ASYNC_DOUBLE_GAUGE with STORE_NAME dimension — backends can compute the high watermark at query time via max aggregation.

Per-store OTel callbacks are registered lazily on first updateCacheTimestamp(java.lang.String, java.lang.String, long) call and read from the shared metadataCacheTimestampMapInMs. When a store is removed, the callback returns NaN (timestamp absent from the map, store no longer tracked). OTel callbacks cannot be deregistered (SDK limitation), so the per-store entry stays registered until the process exits.

  • Constructor Details

    • NativeMetadataRepositoryStats

      public NativeMetadataRepositoryStats(io.tehuti.metrics.MetricsRepository metricsRepository, String name, Clock clock)
  • Method Details

    • getMetadataStalenessHighWatermarkMs

      public final double getMetadataStalenessHighWatermarkMs()
    • updateCacheTimestamp

      public void updateCacheTimestamp(String storeName, String clusterName, long cacheTimeStampInMs)
      Updates the cache timestamp for a store and lazily registers an OTel gauge on first call per store.
      Parameters:
      clusterName - used only on the first call per store to set the CLUSTER_NAME OTel dimension. Subsequent calls for the same store ignore this parameter — the OTel gauge is already registered under the first-seen cluster name and OTel callbacks cannot be deregistered. Known limitation: if a store migrates clusters during the lifetime of this process, the gauge will continue to emit under the original cluster name dimension rather than the post-migration cluster.
    • removeCacheTimestamp

      public void removeCacheTimestamp(String storeName)