You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7ba2f2e
Browse filesBrowse the repository at this point in the historyBrowse files
fix: emit circuit breaker events outside the lock and count rejections per outage
Breaker transitions queue their events and the drivers emit them after
releasing the sync lock, so a logging handler that sends a request through
the same breaker no longer deadlocks. Rejection accounting restarts with
each outage: the first rejection is always emitted and circuit.closed
reports the outage's total in a new rejected attribute.
Each log record has an `event` field holding the event name, such as `event="circuit.opened"`, which you can filter on in your log aggregator. `circuit.rejected` is emitted at most once per second per circuit, so an open circuit under heavy traffic does not flood your logs; its `suppressed`attribute counts the rejections that were left out since the previous one. Events from `AsyncKeyedCircuitBreaker` and `KeyedCircuitBreaker` also carry `circuit_key`, the circuit they belong to. [Resilience](resilience.md) describes when each event fires.
14
+
Each log record has an `event` field holding the event name, such as `event="circuit.opened"`, which you can filter on in your log aggregator. `circuit.rejected` is emitted at most once per second per circuit, so an open circuit under heavy traffic does not flood your logs. The first rejection of each outage is always emitted, `suppressed` counts the rejections left out since the previous one, and `circuit.closed` reports the outage's total in `rejected`. Events from `AsyncKeyedCircuitBreaker` and `KeyedCircuitBreaker` also carry `circuit_key`, the circuit they belong to. [Resilience](resilience.md) describes when each event fires.
Copy file name to clipboardExpand all lines: docs/resilience.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,9 +193,13 @@ Emitted on logger `httpware.circuit_breaker`:
193
193
| Event | When |
194
194
|---|---|
195
195
|`circuit.opened`| The failure threshold was reached and the circuit went from CLOSED to OPEN. |
196
-
|`circuit.rejected`| A request failed fast because the circuit was OPEN or a HALF_OPEN probe was already running. Emitted at most once per second per circuit; its `suppressed` attribute counts the rejections since the previous `circuit.rejected` that were not emitted. |
196
+
|`circuit.rejected`| A request failed fast because the circuit was OPEN or a HALF_OPEN probe was already running. Emitted at most once per second per circuit, and always for the first rejection of an outage. Its `suppressed` attribute counts the rejections in the same outage that were not emitted since the previous `circuit.rejected`. |
197
197
|`circuit.half_open`| The reset timeout passed and the circuit went from OPEN to HALF_OPEN. |
198
-
|`circuit.closed`| The success threshold was reached and the circuit went from HALF_OPEN to CLOSED. |
198
+
|`circuit.closed`| The success threshold was reached and the circuit went from HALF_OPEN to CLOSED. Its `rejected` attribute is the number of requests rejected during the outage, emitted or not. |
199
+
200
+
An outage runs from the moment the circuit opens until it closes again; a probe failure that reopens it stays in the same outage.
201
+
202
+
The breaker emits its events after releasing its internal lock, so a logging handler may send requests through a client that uses the same breaker.
0 commit comments