Skip to content

0.14.0 — read-only circuit-breaker state introspection

Latest

Choose a tag to compare

@lesnik512 lesnik512 released this 16 Jun 12:47
· 3 commits to main since this release
7938984

httpware 0.14.0 — read-only circuit-breaker state introspection

Minor release. Additive only — no breaking changes.

This release adds a read-only state property and a public CircuitState enum
to both AsyncCircuitBreaker and CircuitBreaker, enabling health checks,
readiness probes, dashboards, and test assertions against the current circuit
state without any impact on circuit behavior.

New behavior

Both breakers now expose a state property that returns one of three values from
the new CircuitState enum (CLOSED, OPEN, HALF_OPEN). The enum is exported
from the top-level httpware package:

from httpware import CircuitState
from httpware.middleware.resilience import AsyncCircuitBreaker

breaker = AsyncCircuitBreaker(failure_threshold=5)

# In a health or readiness handler:
if breaker.state is CircuitState.OPEN:
    ...  # report the dependency as degraded

The same property exists on the sync CircuitBreaker.

Semantics

state is a raw read of the stored state. The OPEN→HALF_OPEN transition is lazy:
it fires on the next request admitted after reset_timeout elapses, not on a
clock tick. This means state will report OPEN until a request is actually
admitted as the probe — reading the property never triggers the transition.

This is intentional. A health endpoint that polls state cannot accidentally
promote the circuit to HALF_OPEN by reading it; only real traffic does.

What is NOT in this release

The following remain deferred and are not part of 0.14.0:

  • Manual circuit control (force_open, force_closed)
  • Writable state transitions (e.g., reset via property assignment)
  • Count-based sliding windows
  • Slow-call detection

Shipped via

PR #70 — read-only circuit-breaker state introspection.