explaingit

100rabhg/railswatch

11RubyAudience · developerComplexity · 2/5ActiveSetup · easy

TLDR

Self-hosted Ruby on Rails performance monitoring gem. Tracks requests, percentiles, SQL time, Sidekiq jobs, system resources, and crashes, all stored in your own database.

Mindmap

mindmap
  root((railswatch))
    Inputs
      Rails requests
      Sidekiq jobs
      Rake tasks
      Custom code blocks
    Outputs
      Dashboard at /railswatch
      Percentile charts
      Crash reports
      Slow query lists
    Use Cases
      Replace New Relic
      Find slow controllers
      Watch background jobs
      Track deploys
    Tech Stack
      Ruby
      Rails
      ActiveRecord

Things people build with this

USE CASE 1

Drop a free APM into a Rails app instead of paying for New Relic or Datadog

USE CASE 2

Find the slowest controllers and SQL queries on a live Rails site

USE CASE 3

Track Sidekiq and Delayed Job throughput inside the same dashboard

USE CASE 4

Log custom deploy events and a wrapped business-logic block with Railswatch.measure

Tech stack

RubyRailsActiveRecordSidekiq

Getting it running

Difficulty · easy Time to first run · 30min

Runs a migration and adds a route, so plan a small deploy window and protect the dashboard before going live.

In plain English

Railswatch is a Ruby gem that adds a performance monitoring dashboard to a Ruby on Rails application. It is meant as a self-hosted and free alternative to commercial tools like New Relic APM or Datadog. The author says the gem is production-ready and is running it on two of their own applications, each with about a thousand daily unique users. Once installed, Railswatch tracks a wide range of metrics on your Rails app. It shows real-time recent requests, response time percentiles such as p50, p90, and p99, throughput in requests per minute, average response time, and the slowest controllers and actions. It also records the breakdown of time spent in views, the database, and SQL queries. Beyond raw web requests, it can monitor system resources like CPU, memory, and disk, simple crash reports for HTTP 500 errors, deployment or custom events, Sidekiq jobs, Delayed Job jobs, Grape API endpoints inside the Rails app, Rake tasks, and any custom block of code wrapped in Railswatch.measure. All of the captured data lives in your application's own database. Nothing is sent to a third party server. The README highlights that Railswatch does not need Redis for its own storage. If your application already uses Sidekiq then Sidekiq still uses Redis as usual, but Railswatch saves the job metrics into the database. Getting started is short. You add the gem to the Gemfile, run bundle install, run a Rails generator that creates an initializer and a migration, run db:migrate, then visit /railswatch in your app. You can store the monitoring data in your primary database or in a separate database defined in database.yml under a chosen connection name, which is useful for modern Rails multi-database setups. The README is firm about not leaving the dashboard open. In production you should protect it with HTTP Basic auth or with your own access check, for example by requiring current_user.admin?. The configuration file also lets you set retention windows, ignore specific endpoints or paths, attach custom request data, skip selected Rake tasks, and tune the recent and slow request tabs.

Copy-paste prompts

Prompt 1
Add the railswatch gem to my Rails 7 app, run the generator, and mount the dashboard with HTTP Basic auth
Prompt 2
Configure railswatch to store its metrics in a separate database connection defined in database.yml
Prompt 3
Show me how to wrap a checkout service method in Railswatch.measure and view the timing in the dashboard
Prompt 4
Write an initializer that ignores /healthz from railswatch and sets a 30-day retention window
Prompt 5
Restrict the railswatch dashboard route so only current_user.admin? can reach it
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.