Skip to content

Releases: schigh/circuit

v1.0.0

22 Mar 20:17

Choose a tag to compare

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 modeAllow/done pattern 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 classificationWithIsSuccessful and WithIsExcluded callbacks
  • Panic handling — panics in runners are recorded as failures and re-raised
  • ObservabilityMetricsCollector interface with error detail, state change channel, OnStateChange callback, 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.Is and errors.As
  • Production hardened — fast-path lock avoidance, throttled eviction, TOCTOU-safe LoadOrCreate

Requirements

  • Go 1.22+
  • Zero external dependencies