Is it possible to find what caused the circuit breaker to open? Per Akka documentation https://doc.akka.io/api/akka/current/akka/pattern/CircuitBreakerOpenException.html, the default message "Circuit Breaker is open; calls are failing fast" gets printed when the circuit breaker is tripped. Wondering if we could use getCause() or getStackTrace() to find the underlying problem. In my case, it happened to be a high CPU whereas I was suspecting DB connectivity.
CodePudding user response:
In general, it's the responsibility of the code being executed in the context of the circuit breaker to log or otherwise communicate when the operation being attempted fails (or the caller invoking the code via circuit breaker, since there's a different exception for when the circuit breaker fails a call fast or the code being executed fails).
High CPU usage causing persistence operations to fail (judging from the tagging) can be detected via a thread starvation detector; even if the circuit breaker recorded and returned the exception from the last failing call, it wouldn't point to CPU usage at all (the exception would most likely be a timeout of some sort).