Most Read This Week
Instrumenting Ruby on Rails with TraceView
In under 10 minutes
May. 3, 2013 11:00 AM
It gives you insight into your web application performance such as this:
and a per request drill-down that shows you the nitty gritty detail of where time is spent in individual requests (full-size):
and even end-user monitoring:
Disclaimer: I authored the Ruby instrumentation for Traceview so I may be a bit biased. …but with good reason!
Why a system daemon? TraceView uses a system daemon to collect instrumentation from sources beyond application code such as host metrics, Apache or Resque.
The system daemon is installed with two commands that can be pasted into your shell. An account specific version of these commands are available in your TraceView dashboard once you create an account. (Under Settings; App Configuration; Trace New Hosts)
And the gem for your application Gemfile available on RubyGems:
Yes. That means requests can be traced across hosts, software stacks even track internal API calls via HTTP/SOAP/REST which make for spectacular application insight. But that’s another post for another time.
For this walkthrough we’re going to assume that you’re running a Ruby on Rails application with Unicorn, Thin, Puma or any other Rack based Ruby webserver.
To instead configure Apache/nginx as the entry point, see here.
Ruby as the Entry Point
Luckily, the defaults are very smart and only a couple initial values need to be configured.
The two required values are:
These values enable tracing (:tracing_mode) and sets the sample rate to 10% (:sample_rate). The
Getting Performance Data
If you want to test that the oboe gem is functional, start-up a Rails console, you should see a message to
Note that on hosts that don’t have the system daemon installed, the oboe gem disables itself and outputs a message to that fact.
Deploy/restart your application and you should start seeing traces show up in your TraceView dashboard after a couple minutes.
Things are moving fast for the Ruby language instrumentation in TraceView. We already support tracing of memcache-client, memcached, dalli, mongo, moped, mongoid, mongomapper, cassandra, ActiveRecord (postgres, mysql, mysql2) plus more. Most recently we added support for Rack and Resque tracing. For a full-list of supported libraries, see the top of this article.
If you haven’t tried out TraceView yet, give it a run. You won’t be disappointed.
Extras: Some Random Chart Porn
Linode migrated my VPS to a lesser utilized host with evident results (Thanks Linode):
An older issue that Gameface had with atrocious rendering times:
Subscribe to the World's Most Powerful Newsletters
Today's Top Reads