Class HeartbeatVersionedStats
java.lang.Object
com.linkedin.davinci.stats.AbstractVeniceAggVersionedStats<HeartbeatStat,HeartbeatStatReporter>
com.linkedin.davinci.stats.ingestion.heartbeat.HeartbeatVersionedStats
- All Implemented Interfaces:
StoreDataChangedListener
public class HeartbeatVersionedStats
extends AbstractVeniceAggVersionedStats<HeartbeatStat,HeartbeatStatReporter>
Manages Tehuti and OTel heartbeat/record-level delay stats per store.
OTel stats lifecycle: OTel stats are created lazily on first metric recording via
getOrCreateHeartbeatOtelStats(java.lang.String) and getOrCreateRecordLevelDelayOtelStats(java.lang.String).
Version info updates from handleStoreChanged(com.linkedin.venice.meta.Store) propagate to existing OTel stats
via onVersionInfoUpdated(java.lang.String, int, int) (computeIfPresent). See
getOrCreateHeartbeatOtelStats(java.lang.String) for why version info is fetched outside the lambda.
-
Field Summary
Fields inherited from class com.linkedin.davinci.stats.AbstractVeniceAggVersionedStats
metadataRepository -
Constructor Summary
ConstructorsConstructorDescriptionHeartbeatVersionedStats(io.tehuti.metrics.MetricsRepository metricsRepository, ReadOnlyStoreRepository metadataRepository, Supplier<HeartbeatStat> statsInitiator, StatsSupplier<HeartbeatStatReporter> reporterSupplier, Map<HeartbeatKey, IngestionTimestampEntry> leaderMonitors, Map<HeartbeatKey, IngestionTimestampEntry> followerMonitors, String clusterName) -
Method Summary
Modifier and TypeMethodDescriptionvoidemitPerRecordFollowerOtelMetric(String storeName, int version, String region, long delay, boolean isReadyToServe) Emits a per-record OTel metric for follower record delay (called per record, not aggregated).voidemitPerRecordLeaderOtelMetric(String storeName, int version, String region, long delay) Emits a per-record OTel metric for leader record delay (called per record, not aggregated).voidhandleStoreChanged(Store store) voidhandleStoreCreated(Store store) Do NOT try to acquire the lock of store repository again in the implementation, otherwise a dead lock issue will happen.voidhandleStoreDeleted(String storeName) voidNo-op: heartbeat stats are loaded lazily when the first heartbeat/record arrives.protected voidonVersionInfoUpdated(String storeName, int currentVersion, int futureVersion) Updates version info for existing OTel stats.voidrecordFollowerLag(String storeName, int version, String region, long heartbeatTs, boolean isReadyToServe) voidrecordFollowerRecordLag(String storeName, int version, String region, long recordTs, boolean isReadyToServe) voidrecordLeaderLag(String storeName, int version, String region, long heartbeatTs) voidrecordLeaderRecordLag(String storeName, int version, String region, long recordTs) Methods inherited from class com.linkedin.davinci.stats.AbstractVeniceAggVersionedStats
addStore, cleanupVersionResources, getCurrentVersion, getFutureVersion, getMetricsRepository, getStats, getTotalStats, recordVersionedAndTotalStat, registerConditionalStats, updateStatsVersionInfo, updateTotalStatsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.meta.StoreDataChangedListener
handleStoreDeleted
-
Constructor Details
-
HeartbeatVersionedStats
public HeartbeatVersionedStats(io.tehuti.metrics.MetricsRepository metricsRepository, ReadOnlyStoreRepository metadataRepository, Supplier<HeartbeatStat> statsInitiator, StatsSupplier<HeartbeatStatReporter> reporterSupplier, Map<HeartbeatKey, IngestionTimestampEntry> leaderMonitors, Map<HeartbeatKey, IngestionTimestampEntry> followerMonitors, String clusterName)
-
-
Method Details
-
recordLeaderLag
-
recordFollowerLag
-
recordLeaderRecordLag
-
recordFollowerRecordLag
-
loadAllStats
public void loadAllStats()No-op: heartbeat stats are loaded lazily when the first heartbeat/record arrives.- Overrides:
loadAllStatsin classAbstractVeniceAggVersionedStats<HeartbeatStat,HeartbeatStatReporter>
-
handleStoreCreated
Description copied from interface:StoreDataChangedListenerDo NOT try to acquire the lock of store repository again in the implementation, otherwise a dead lock issue will happen.- Specified by:
handleStoreCreatedin interfaceStoreDataChangedListener- Overrides:
handleStoreCreatedin classAbstractVeniceAggVersionedStats<HeartbeatStat,HeartbeatStatReporter>
-
handleStoreDeleted
- Specified by:
handleStoreDeletedin interfaceStoreDataChangedListener- Overrides:
handleStoreDeletedin classAbstractVeniceAggVersionedStats<HeartbeatStat,HeartbeatStatReporter>
-
handleStoreChanged
- Specified by:
handleStoreChangedin interfaceStoreDataChangedListener- Overrides:
handleStoreChangedin classAbstractVeniceAggVersionedStats<HeartbeatStat,HeartbeatStatReporter>
-
onVersionInfoUpdated
Updates version info for existing OTel stats. No null guard needed: lazy loading means this is never called from the super() constructor.- Overrides:
onVersionInfoUpdatedin classAbstractVeniceAggVersionedStats<HeartbeatStat,HeartbeatStatReporter>
-
emitPerRecordLeaderOtelMetric
Emits a per-record OTel metric for leader record delay (called per record, not aggregated). Usesget()instead ofgetOrCreateto avoid synchronization on this hot path. Returns early if stats haven't been initialized yet for this store. -
emitPerRecordFollowerOtelMetric
public void emitPerRecordFollowerOtelMetric(String storeName, int version, String region, long delay, boolean isReadyToServe) Emits a per-record OTel metric for follower record delay (called per record, not aggregated). Usesget()instead ofgetOrCreateto avoid synchronization on this hot path. Returns early if stats haven't been initialized yet for this store.
-