coverband  by danmayer

Ruby gem for production code coverage

Created 12 years ago
2,596 stars

Top 18.1% on SourcePulse

GitHubView on GitHub
Project Summary

Coverband is a Ruby gem designed to collect and report on production code usage, providing line-by-line execution counts for Ruby applications. It targets developers and operations teams seeking to understand runtime behavior, identify unused code, and optimize performance in production environments. The primary benefit is gaining actionable insights into code execution with minimal performance impact.

How It Works

Coverband operates by patching Ruby's Kernel#require and Kernel#load to track code execution. It stores coverage data in Redis, either through a background thread or as Rack middleware. This approach allows for continuous monitoring with low overhead, distinguishing between code loaded during application startup (eager load) and code executed during runtime.

Quick Start & Requirements

  • Install via Bundler: gem 'coverband'
  • Requires Redis for data storage.
  • Official Demo App: https://coverband.io/

Highlighted Details

  • Reports runtime code usage, not just test coverage.
  • Features a mountable web UI for visualizing coverage data.
  • Supports Rails, Sinatra, and non-Rack Ruby applications.
  • Offers configuration for ignoring files, tracking routes, and managing reporting frequency.

Maintenance & Community

The project is actively maintained, with contributions from various developers. Community support channels are not explicitly mentioned, but the project has a GitHub repository for issues and contributions.

Licensing & Compatibility

  • License: MIT
  • Compatible with commercial use and closed-source applications.

Limitations & Caveats

Coverband does not provide line-level coverage for view files (e.g., ERB, Slim), only file-level tracking. It is incompatible with Scout APM's auto-instrumentation (AUTO_INSTRUMENT=true) and Bootsnap, as these interfere with its patching mechanisms. Elastic APM requires careful gem loading order to avoid conflicts.

Health Check
Last Commit

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
1
Star History
19 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.