Instrument Your Rails Apps Automatically With Honeycomb's New Rails IntegrationBy Sam Stokes | Last modified on January 11, 2019
You’ve always been able to get observability for your Ruby apps by instrumenting them with our SDK, affectionately known as libhoney. Unfortunately, instrumenting code you’ve already written is nobody’s favourite job. If only there were some way to automate the repetitive parts, so you could get instant insight into what your app is doing in production, and then focus your effort on augmenting that insight with the information that’s unique to your app!
That’s why we’re releasing our Rails integration. Out of the box, Rails web apps provide a rich stream of data about what they’re doing and how they’re performing. By connecting that stream to Honeycomb, you get the realtime observability, insight, and analytics that you’ve always wanted.
Get the data flowing with just a few clicks
Getting started is easy. Just add
gem 'honeycomb-rails' to your app’s Gemfile, and a short config snippet to identify your Honeycomb account:
HoneycombRails.configure do |conf| conf.writekey = 'YOUR-HONEYCOMB-WRITEKEY' end
That’s all you need to instrument your app’s requests and ActiveRecord queries. Now you can start asking questions like:
- Which controllers and actions are the slowest to return in my app?
- Which routes spend the most time making database calls? What are the commonalities among the slowest-rendering pages in my app?
- Which users have seen that “Failed to save” flash error message the most lately? What other errors have they run into?
Honeycomb lets you ask these questions of your app as it’s running in production. Once you’ve got an answer, you can refine the question: e.g. try filtering to only the most common error, or breaking down by user.
Add your own custom fields for even greater insight
However, the real power of observability comes when you augment your instrumentation with context that’s unique to your app. For example, if your app deals with posts, you might want to understand the performance profile or error distribution associated with displaying a particular post. You can do that by adding fields to the
honeycomb_metadata hash in any controller method:
class PostsController < ApplicationController # in any controller method def show @post = Post.find(params[:id]) # The request event will be augmented with post ID honeycomb_metadata[:post_id] = @post.id # ... end end
Want observability for your Rails apps? Try out our Rails integration and get started for free.
Feature Focus: Winter Edition ❄️
It’s been a minute since our last Feature Focus, and we have a bit of catching up to do! I’m happy to report we’ll resume...
Iterating Our Way Toward a Service Map
For a long time at Honeycomb, we envisioned using the tracing data you send us to generate a service map. If you’re unfamiliar, a service...
Get the Big Picture: Learn How to Visually Debug Your Systems with Service Map—Now Available in Sandbox
Honeycomb’s Service Map gives you the unique capability to filter by both services and traces so you can generate maps that isolate very specific areas...