Use this when a failing dependency should not be hammered.
Circuit Breaker
A circuit breaker stops calling a failing dependency after repeated errors, fails fast for a cooling-off period, then tries again, protecting both the automation and the failing service.
1. Circuit breakers stop calling failing dependencies for a while.
2. Prevent cascading failures and wasted retries.
3. Half-open probes.
4. Fallbacks.
5. Monitor state.
failures exceed threshold → open → probe → close
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The primary procedure is: Inject controlled dependency failures until the threshold is crossed, observe CLOSED→OPEN→HALF-OPEN transitions, then restore the dependency and verify limited probes return the breaker to CLOSED. Exercise failure-oriented cases such as counting caller errors as dependency failure, combining retries that overwhelm half-open probes, shared breaker keys causing cross-tenant blast radius and stale OPEN state after recovery so the test covers failure cases, not only the happy path.
Step 2 Common mistakes Narrow the fault
- Circuit breaker never resetting.
- No circuit breaker, hammering a failing API.
Step 3 Where it fails Narrow the fault
Failure analysis for Error Handling → Circuit Breaker should follow the path through the components: caller → retry/timeout policy → circuit breaker → network/dependency → response classification → state transition. Tests should include edge cases such as counting caller errors as dependency failure, combining retries that overwhelm half-open probes, shared breaker keys causing cross-tenant blast radius and stale OPEN state after recovery. Recovery should preserve transition metrics and representative errors, repair the failing dependency or classification, allow controlled half-open probes, then verify CLOSED only after successful bounded calls.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Open after repeated failures.
- Fail fast while open.
- Half-open to test recovery.
- Circuit breaker state (closed/open/half-open) — protection
- Failure threshold and reset time — configuration
- Fallback behaviour — degradation
ReferenceWhy it matters1 section · depth on demand
In depth
A circuit breaker stops calling a failing dependency for a while after repeated errors, instead of continuing to hammer it. After a cool-down it lets a test call through; if that succeeds, normal calls resume.
| State | Behaviour |
|---|---|
| Closed | Calls pass; failures counted |
| Open | Calls fail immediately |
| Half-open | Limited test calls decide whether to close |
In automation, a circuit breaker prevents a job from timing out on hundreds of calls to a dead API and lets it fail fast with a clear reason.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
Circuit Breaker in Error Handling is owned at runtime by the client-side or middleware circuit-breaker state machine protecting a remote dependency. The durable intent is policy defining failure classifications, rolling threshold, open duration, half-open probe count and fallback behavior. Reliable automation must carry stable identity across the path: breaker instance/key scoped to dependency/operation, state transition timestamp and correlated request IDs. The consumer-visible target is whether calls to one dependency operation are admitted, rejected fast or probed during recovery. The key invariants are only relevant failures contribute to trip logic, OPEN prevents load amplification, HALF-OPEN limits probes, recovery resets counters safely and breaker scope does not cross unrelated tenants/dependencies.
ReferenceConfiguration & state1 section · depth on demand
Lifecycle
Store and review policy defining failure classifications, rolling threshold, open duration, half-open probe count and fallback behavior; pin or at least record implementation/model versions and keep environment-specific identity outside reusable logic where possible. The stable identity contract is breaker instance/key scoped to dependency/operation, state transition timestamp and correlated request IDs.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Error Handling > Circuit Breaker. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker · confidence 94%Quick lookup tables
Error Handling → Circuit Breaker · operational reference
Context-specific ownership, verification, output and failure-boundary lookup for Error Handling → Circuit Breaker.
| Layer | Error Handling → Circuit Breaker operational reference |
|---|---|
| Runtime/ownership | distributed automation resilience / circuit breaker pattern · the client-side or middleware circuit-breaker state machine protecting a remote dependency |
| Persistent intent | policy defining failure classifications, rolling threshold, open duration, half-open probe count and fallback behavior |
| Verification | Inject controlled dependency failures until the threshold is crossed, observe CLOSED→OPEN→HALF-OPEN transitions, then restore the dependency and verify limited probes return the breaker to CLOSED. |
| Expected interpretation | The breaker trips only on configured failure classes, fast-fails while OPEN, limits recovery probes, exposes state transitions, and returns to CLOSED only after the defined success criteria. |
| Recovery boundary | preserve transition metrics and representative errors, repair the failing dependency or classification, allow controlled half-open probes, then verify CLOSED only after successful bounded calls |
Deep reference
Healthy vs suspicious evidence
Output interpretation
At minimum retain breaker key/state, previous/new state, transition time, failure/success counters, classified error, open-until time, probe result, dependency latency and correlated request ID. The useful output makes ambiguity visible, links to the target identity from breaker instance/key scoped to dependency/operation, state transition timestamp and correlated request IDs, and provides enough context to safely decide whether a retry is permitted.