Class CrdbEvents

java.lang.Object
com.cockroachlabs.crdb.observe.CrdbEvents

public final class CrdbEvents extends Object
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 Details

    • addListener

      public static void addListener(CrdbEventListener listener)
    • removeListener

      public static void removeListener(CrdbEventListener listener)
    • clearListeners

      public static void clearListeners()
      Remove all listeners (does not reset counters). Intended for tests.
    • fireRetryAttempt

      public static void fireRetryAttempt(String operation, int attempt, String sqlState)
    • fireRetryExhausted

      public static void fireRetryExhausted(String operation, int attempts, String sqlState)
    • fireCircuitOpen

      public static void fireCircuitOpen(String operation, int consecutiveFailures)
    • stats

      public static CrdbStats stats()
      A snapshot of the current counters.
    • resetStats

      public static void resetStats()
      Reset all counters to zero. Intended for tests.