The project is in a healthy, maintained state
Health check framework that aggregates dependency checks with configurable timeouts. Provides a DSL for defining checks, aggregated status reporting, and Rack middleware for /health, /health/ready, and /health/live endpoints.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

philiprehberger-circuit_board

Tests Gem Version Last updated

Health check framework with dependency aggregation and Rack endpoint

Requirements

  • Ruby >= 3.1

Installation

Add to your Gemfile:

gem "philiprehberger-circuit_board"

Or install directly:

gem install philiprehberger-circuit_board

Usage

require "philiprehberger/circuit_board"

Philiprehberger::CircuitBoard.configure do
  check(:database) { ActiveRecord::Base.connection.active? }
  check(:redis, timeout: 2) { Redis.current.ping == 'PONG' }
end

status = Philiprehberger::CircuitBoard.check
status.healthy?   # => true
status.degraded?  # => false
status.to_h       # => { status: 'healthy', checks: [...] }

Rack Middleware

# config.ru
require "philiprehberger/circuit_board"

Philiprehberger::CircuitBoard.configure do
  check(:database) { DB.connected? }
end

use Philiprehberger::CircuitBoard::Rack::Middleware
run MyApp

Exposes three endpoints:

  • GET /health - full health check with all dependency results
  • GET /health/ready - readiness probe (all checks must pass)
  • GET /health/live - liveness probe (always returns 200)

Check Timeouts

Philiprehberger::CircuitBoard.configure do
  check(:fast_service, timeout: 1) { FastService.ping }
  check(:slow_service, timeout: 10) { SlowService.ping }
end

API

Method Description
.configure { ... } Define health checks using the DSL
.check Run all checks and return a Status
.reset! Remove all configured checks
Status#healthy? Whether all checks passed
Status#degraded? Whether some checks passed but not all
Status#to_h Hash with :status and :checks keys
Status#results Array of individual check results
Rack::Middleware.new(app) Rack middleware for health endpoints

Development

bundle install
bundle exec rspec
bundle exec rubocop

Support

If you find this project useful:

Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

License

MIT