Releases: schigh/circuit
Releases · schigh/circuit
v1.0.0
circuit v1.0.0
First stable release of the circuit breaker library.
Features
- Generic
Run[T]— type-safe execution with no type assertions - Two-step mode —
Allow/donepattern for HTTP middleware and gRPC interceptors - Functional options — clean
With*configuration API - Lazy state evaluation — zero background goroutines, no
Close()needed - Probabilistic throttling — gradual recovery with 5 built-in backoff curves (Linear, Logarithmic, Exponential, EaseInOut, JitteredLinear)
- Error classification —
WithIsSuccessfulandWithIsExcludedcallbacks - Panic handling — panics in runners are recorded as failures and re-raised
- Observability —
MetricsCollectorinterface with error detail, state change channel,OnStateChangecallback,Snapshot()for health endpoints - BreakerBox — manage multiple named breakers with centralized state change forwarding
- Contextual errors — all circuit errors carry breaker name and state, compatible with
errors.Isanderrors.As - Production hardened — fast-path lock avoidance, throttled eviction, TOCTOU-safe
LoadOrCreate
Requirements
- Go 1.22+
- Zero external dependencies