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
Copy file name to clipboardExpand all lines: docs/starknet/circuit-breaker.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,15 @@ Circuit breaker state is exposed in the diagnostics endpoint (`GET /diagnostics/
73
73
-**recentFailureCount**: Number of failures in the current rolling window
74
74
-**openedAt**: Timestamp when circuit opened (milliseconds since epoch), or `null` if closed
75
75
76
+
### Metrics
77
+
78
+
The Starknet client exposes two process-local metrics for each RPC endpoint:
79
+
80
+
-`starknet_circuit_breaker_state`, a gauge where `0=CLOSED`, `1=OPEN`, and `2=HALF_OPEN`.
81
+
-`starknet_circuit_breaker_transitions_total`, a counter labeled with the endpoint and transition name, such as `CLOSED_to_OPEN`.
82
+
83
+
Alert when an endpoint remains `OPEN` (state `1`) for longer than the normal RPC recovery window, or when `CLOSED_to_OPEN` transitions repeat rapidly. A useful starting threshold is state `1` for more than five minutes, adjusted for the configured circuit-breaker cooldown and the number of healthy fallback endpoints.
84
+
76
85
## Example Scenarios
77
86
78
87
### Scenario 1: Endpoint Degrades
@@ -112,7 +121,7 @@ Failures are tracked with timestamps in a rolling window. Old failures outside t
112
121
113
122
### Half-Open Behavior
114
123
115
-
In HALF_OPEN state, only one probe call is allowed through at a time. This prevents a "thundering herd" of simultaneous recovery attempts that could overwhelm a recovering endpoint.
124
+
In HALF_OPEN state, only one probe call is allowed through at a time. This prevents a “thundering herd” of simultaneous recovery attempts that could overwhelm a recovering endpoint.
0 commit comments