Class CrdbEvents
java.lang.Object
com.cockroachlabs.crdb.observe.CrdbEvents
Process-wide event bus and counters for CockroachDB operational signals.
Firing is cheap and lock-free; with no listeners registered it only bumps atomic counters. Listeners are notified in registration order. Exceptions thrown by a listener are swallowed so observability never breaks the app.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddListener(CrdbEventListener listener) static voidRemove all listeners (does not reset counters).static voidfireCircuitOpen(String operation, int consecutiveFailures) static voidfireRetryAttempt(String operation, int attempt, String sqlState) static voidfireRetryExhausted(String operation, int attempts, String sqlState) static voidremoveListener(CrdbEventListener listener) static voidReset all counters to zero.static CrdbStatsstats()A snapshot of the current counters.
-
Method Details
-
addListener
-
removeListener
-
clearListeners
public static void clearListeners()Remove all listeners (does not reset counters). Intended for tests. -
fireRetryAttempt
-
fireRetryExhausted
-
fireCircuitOpen
-
stats
A snapshot of the current counters. -
resetStats
public static void resetStats()Reset all counters to zero. Intended for tests.
-