Package com.linkedin.davinci.stats
Class AbstractVeniceAggVersionedStats<STATS,STATS_REPORTER extends AbstractVeniceStatsReporter<STATS>>
java.lang.Object
com.linkedin.davinci.stats.AbstractVeniceAggVersionedStats<STATS,STATS_REPORTER>
- All Implemented Interfaces:
StoreDataChangedListener
- Direct Known Subclasses:
AggVersionedBlobTransferStats,AggVersionedDaVinciRecordTransformerStats,AggVersionedDIVStats,AggVersionedIngestionStats,AggVersionedStorageEngineStats,HeartbeatVersionedStats
public abstract class AbstractVeniceAggVersionedStats<STATS,STATS_REPORTER extends AbstractVeniceStatsReporter<STATS>>
extends Object
implements StoreDataChangedListener
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractVeniceAggVersionedStats(io.tehuti.metrics.MetricsRepository metricsRepository, ReadOnlyStoreRepository metadataRepository, Supplier<STATS> statsInitiator, StatsSupplier<STATS_REPORTER> reporterSupplier, boolean unregisterMetricForDeletedStoreEnabled) -
Method Summary
Modifier and TypeMethodDescriptionprotected VeniceVersionedStats<STATS,STATS_REPORTER> Adds a store and initializes its version info.protected voidcleanupVersionResources(String storeName, int version) Hook method for subclasses to clean up version-specific resources (e.g., OTel stats) when a version is removed.protected intgetCurrentVersion(String storeName) returnStore.NON_EXISTING_VERSIONif current version doesn't exist.protected intgetFutureVersion(String storeName) returnStore.NON_EXISTING_VERSIONif future version doesn't exist.protected io.tehuti.metrics.MetricsRepositoryprotected STATSprotected STATSgetTotalStats(String storeName) 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) voidprotected voidonVersionInfoUpdated(String storeName, int currentVersion, int futureVersion) Hook method called when version info is updated for a store.protected voidrecordVersionedAndTotalStat(String storeName, int version, Consumer<STATS> function) protected voidregisterConditionalStats(String storeName) protected voidupdateStatsVersionInfo(String storeName, List<Version> existingVersions, int newCurrentVersion) protected voidupdateTotalStats(String storeName) Some versioned stats might always increasing; in this case, the value in the total stats should be updated with the aggregated values across the new version list.Methods 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
-
Field Details
-
metadataRepository
-
-
Constructor Details
-
AbstractVeniceAggVersionedStats
public AbstractVeniceAggVersionedStats(io.tehuti.metrics.MetricsRepository metricsRepository, ReadOnlyStoreRepository metadataRepository, Supplier<STATS> statsInitiator, StatsSupplier<STATS_REPORTER> reporterSupplier, boolean unregisterMetricForDeletedStoreEnabled)
-
-
Method Details
-
getMetricsRepository
protected io.tehuti.metrics.MetricsRepository getMetricsRepository() -
loadAllStats
public void loadAllStats() -
recordVersionedAndTotalStat
-
getTotalStats
-
getStats
-
registerConditionalStats
-
addStore
Adds a store and initializes its version info. Uses computeIfAbsent for thread-safety, ensuring version info is always initialized exactly once when the store is first added. -
updateStatsVersionInfo
-
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
-
handleStoreDeleted
- Specified by:
handleStoreDeletedin interfaceStoreDataChangedListener
-
handleStoreChanged
- Specified by:
handleStoreChangedin interfaceStoreDataChangedListener
-
getFutureVersion
returnStore.NON_EXISTING_VERSIONif future version doesn't exist. -
getCurrentVersion
returnStore.NON_EXISTING_VERSIONif current version doesn't exist. -
updateTotalStats
Some versioned stats might always increasing; in this case, the value in the total stats should be updated with the aggregated values across the new version list. -
onVersionInfoUpdated
Hook method called when version info is updated for a store. Subclasses can override this to update existing OTel stats with new version info.WARNING: This method may be called from within
aggStats.computeIfAbsentinaddStore(Store). Implementations MUST NOT callgetCurrentVersion(java.lang.String),getFutureVersion(java.lang.String), orgetVersionedStats(java.lang.String)— these re-enteraggStatsand cause a deadlock or IllegalStateException. UsecomputeIfPresenton the subclass's own OTel stats map to update existing entries only. -
cleanupVersionResources
Hook method for subclasses to clean up version-specific resources (e.g., OTel stats) when a version is removed. Same re-entrance warning asonVersionInfoUpdated(java.lang.String, int, int).
-