Package com.linkedin.davinci.stats
Class OtelVersionedStatsUtils
java.lang.Object
com.linkedin.davinci.stats.OtelVersionedStatsUtils
Shared utilities for OpenTelemetry versioned stats classes that classify and resolve version roles.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImmutable holder for current and future version numbers. -
Method Summary
Modifier and TypeMethodDescriptionstatic VersionRoleclassifyVersion(int version, OtelVersionedStatsUtils.VersionInfo versionInfo) Classifies a version as CURRENT, FUTURE, or BACKUP.static intgetVersionForRole(VersionRole role, OtelVersionedStatsUtils.VersionInfo versionInfo, Set<Integer> knownVersions) Resolves aVersionRoleto a version number using the givenOtelVersionedStatsUtils.VersionInfoand a set of known version numbers.
-
Method Details
-
classifyVersion
public static VersionRole classifyVersion(int version, OtelVersionedStatsUtils.VersionInfo versionInfo) Classifies a version as CURRENT, FUTURE, or BACKUP. ReturnsVersionRole.BACKUPwhenversionInfois null (e.g., store not yet registered in a per-store version info map).- Parameters:
version- The version number to classifyversionInfo- The current/future version info, or null- Returns:
VersionRole.CURRENTif version matches currentVersion,VersionRole.FUTUREif version matches futureVersion,VersionRole.BACKUPotherwise or if versionInfo is null
-
getVersionForRole
public static int getVersionForRole(VersionRole role, OtelVersionedStatsUtils.VersionInfo versionInfo, Set<Integer> knownVersions) Resolves aVersionRoleto a version number using the givenOtelVersionedStatsUtils.VersionInfoand a set of known version numbers. ForVersionRole.BACKUP, returns the smallest version that is neither current nor future (deterministic selection from an unordered set).- Parameters:
role- The version role to resolveversionInfo- The current/future version info (read once from volatile before calling)knownVersions- The set of known version numbers (e.g., from a per-version map's keySet)- Returns:
- The version number, or
Store.NON_EXISTING_VERSIONif versionInfo is null, no backup version exists, or the role is not recognized
-