Production-Tested Automatic Instrumental Metrics for Ruby on Rails
Clone or download
jason-o-matic Fix issue with travis using old bundler
We were getting this error:
NoMethodError: undefined method `spec' for nil:NilClass

Googling lead to: rubygems/rubygems#1419
Which lead to:

Looking at our `.travis.yml` files it's now obvious we double defined
`before_install` and the last one was winning, so the line that should
have fixed this issue wasn't running.

It's not clear why this started failing suddenly, but hopefully this
fixes it.
Latest commit 97d9da8 Sep 6, 2017


Automatically get metrics for Instrumental from your Ruby on Rails (RoR) application.

Build Status

Automatic Metrics For Ruby

Automatic metrics for commonly used Ruby gems:

  • ActiveRecord
  • Redis
  • Memcached
  • Dalli
  • Delayed Job
  • Sidekiq
  • Resque
  • Honeybadger

Request Metrics:

  • apdex metrics
  • request time, broken down by controller and action
  • middleware execution time
  • idle time
  • content length
  • web server queue time (for servers that set HTTP_X_QUEUE_START like nginx)

And also you can report generic method timing.


gem install metrician instrumental_agent

Grab your project token from and activate metrician with:

I =


Rack Middleware

In rails, the middleware will be inserted into your middleware stack automatically. If you control your middleware stack manually in rails, you can load the functionality using the following manual instructions:

In your application.rb file:

# request timing should be first so we get the correct queue time and start the
# middleware timer
config.middleware.insert_before("ActionDispatch::Static", "RequestTiming")

# if you want to track content length add the rack middleware
config.middleware.insert_before("ActionDispatch::Static", "Rack::ContentLength")

# application timing should be last/just before the request is processed

If you run rake middleware, you should see something like:

use RequestTiming
use Rack::ContentLength
use ActionDispatch::Static
# etc.
use ActionDispatch::BestStandardsSupport
use ApplicationTiming
run YOUR_APP::Application.routes

Your exception tracking middleware may try to get in first (hey, Honeybadger), so you will have to change the load order in an initializer, because we want to track that as middleware time, too.

Release Process

  1. Pull latest master
  2. Merge feature branch(es) into master
  3. script/test
  4. Increment version in:
  • lib/metrician/version.rb
  1. Run rake matrix:install to generate new gem lockfiles
  2. Update
  3. Commit "Release vX.Y.Z"
  4. Push to GitHub
  5. Release packages: rake release
  6. Verify package release at

Version Policy

This library follows Semantic Versioning 2.0.0.