Ruby Monitoring Quick Start Guide
Getting started with Instrumental and Ruby
Here's how to get up and running with Ruby application monitoring and Instrumental. Like all our agents, the Ruby agent is designed to prevent exceptions from impacting your application. It's also completely non-blocking.
Installation
Add the agent to your Gemfile:
gem 'instrumental_agent'
Be sure to Bundle install:
$ bundle install
Require the library and configure it with your project token. Using Rails? We recommend putting this in an initializer.
require 'instrumental_agent' I = Instrumental::Agent.new('PROJECT_TOKEN')
Automated Metrics with Metrician
When you install the Instrumental ruby agent, you also get Metrician, a tool that will automatically report metrics from your ruby application without having to configure anything. Read more about automated metric collection with Metrician.
Sending Custom Metrics
Increments are simple counters. learn more
I.increment('job.mailer.name.success', 1)
Gauges represent a value at a point in time. learn more
I.gauge('queue.name.size', 234)
The time method measures code execution time.
I.time('app.query_time.post.find') do post = Post.find(1) end
Sending Notices
Notices are project specific events with an optional duration.
I.notice("Deployed revision 038ade4 to production") I.notice("event in the past with a duration", 1.day.ago, 20.seconds)
Using StatsD or statsite? We’ve got you covered with our StatsD backend and statsite sink