Skip to content

govindkrjoshi/mcb

Repository files navigation

circuit-breaker

A production-grade circuit breaker library for Haskell.

Overview

The circuit breaker pattern prevents cascading failures in distributed systems by detecting failures and failing fast when a dependency becomes unavailable.

Installation

build-depends: circuit-breaker

Quick Start

import CircuitBreaker

main :: IO ()
main = do
  cb <- newCircuitBreaker defaultConfig
  result <- withCircuitBreaker cb $ do
    -- Your protected operation here
    pure "success"
  print result

Features

  • Thread-safe state management using STM
  • Configurable failure thresholds and timeouts
  • Count-based sliding window for failure rate calculation
  • Optional OpenTelemetry integration for observability
  • Composable combinators (timeout, fallback)

Documentation

See Hackage for full API documentation.

License

BSD-3-Clause - see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors