My teammate @graham.pople looked into this and determined there’s currently no way to inspect the circuit breaker status or listen for state changes. We’re tracking this as a pair of feature requests:
JCBC-2021 Add circuit breaker status to EndpointDiagnostics
JVMCBC-1168 Publish events when circuit breaker state changes
The idea is you’ll be able to get the current status of the circuit breakers (each endpoint has its own breaker) from the cluster diagnostics API.
For the state changes, the idea is you’ll be able to subscribe to the SDK’s event bus and listen for a circuit breaker state change event.
If you have a Couchbase Enterprise subscription, make sure to reach out to your Couchbase team if you want to request prioritization for these features.
I have subscribed to the event bus. From many events, I don’t know which condition helps me reach the circuit breaker state change. Do you have any advice on this?