Class KeyPartitionProfilerManager
java.lang.Object
com.linkedin.venice.listener.profiler.KeyPartitionProfilerManager
Tracks active
KeyPartitionProfiler sessions and exposes a near-zero-cost guard for the
read hot path.
When a session's window expires, the result is emitted to the server log, The session is then removed and the fast-path boolean is cleared once the last session is gone.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOutcome of astartProfiling(java.lang.String, java.lang.String, long, int)call. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final Stringstatic final longUpper bound on a single session's profiling window.static final intUpper bound on per-partition top-K size. -
Constructor Summary
ConstructorsConstructorDescriptionKeyPartitionProfilerManager(ToIntFunction<String> partitionCountResolver, int maxConcurrentSessions, LogContext logContext) -
Method Summary
Modifier and TypeMethodDescriptiongetProfiler(String storeName) Returns the active profiler forstoreNameornullif no session is running for that store.booleanHot-path entry point.voidshutdown()startProfiling(String storeName, String storeVersion, long durationMs, int topK) Starts a profiling session forstoreName.stopProfiling(String storeName) Stops the profiling session forstoreNameearly and emits its result.
-
Field Details
-
DEFAULT_MAX_CONCURRENT_SESSIONS
public static final int DEFAULT_MAX_CONCURRENT_SESSIONS- See Also:
-
DEFAULT_TOP_K
public static final int DEFAULT_TOP_K- See Also:
-
MAX_DURATION_MS
public static final long MAX_DURATION_MSUpper bound on a single session's profiling window. Prevents accidental long-running sessions. -
MAX_TOP_K
public static final int MAX_TOP_KUpper bound on per-partition top-K size. Bounds per-session memory growth.- See Also:
-
LOG_PREFIX
- See Also:
-
-
Constructor Details
-
KeyPartitionProfilerManager
public KeyPartitionProfilerManager(ToIntFunction<String> partitionCountResolver, int maxConcurrentSessions, LogContext logContext)
-
-
Method Details
-
isAnyProfilingActive
public boolean isAnyProfilingActive()Hot-path entry point. Returnstruewhen at least one profiling session is currently running and the read path should record key/partition activity. -
getProfiler
Returns the active profiler forstoreNameornullif no session is running for that store. Should only be called whenisAnyProfilingActive()returned true. -
startProfiling
public KeyPartitionProfilerManager.StartResult startProfiling(String storeName, String storeVersion, long durationMs, int topK) Starts a profiling session forstoreName. Returns a description of the action taken (always-on capability; no config flag). -
stopProfiling
Stops the profiling session forstoreNameearly and emits its result. Returns the stoppedKeyPartitionProfiler(carrying the actualstoreVersionof the session) so callers can build accurate audit messages, orOptional.empty()if no session was running for the store. -
shutdown
public void shutdown()
-