DEPRECATION NOTICE: This gem is deprecated, please use honeycomb-beeline instead
Honeycomb middleware for Rack applications
This is Rack middleware that sends request/response data to Honeycomb. You can use Rack::Honeycomb
with any Ruby web framework based on Rack, including Ruby on Rails and Sinatra.
For more information about using Honeycomb, check out our docs and our Ruby SDK.
Adding instrumentation to a Sinatra application
Attaching the middleware is simple. Inside handlers, you also have the choice of attaching custom fields to be added to the events sent to Honeycomb.
#!/usr/bin/env ruby -rubygems
require 'sinatra'
require 'rack/honeycomb'
use Rack::Honeycomb::Middleware, writekey: "<YOUR WRITEKEY HERE>", dataset: "<YOUR DATASET NAME HERE>", is_sinatra: true
get('/hello') do
Rack::Honeycomb.add_field env, :greeting, 'hello'
"Hello, world!\n"
end
Adding instrumentation to a Rails application
For more fully-featured Rails support, see beeline-ruby.
beeline-ruby includes this gem along with active record support.
If beeline-ruby doesn't work for you, you can include this middleware standalone
# config/application.rb
require 'rack/honeycomb'
class Application < Rails::Application
config.middleware.use Rack::Honeycomb::Middleware, writekey: "<YOUR WRITEKEY HERE>", dataset: "<YOUR DATASET NAME HERE>", is_rails: true
end
Installation
To install the latest stable release of rack-honeycomb
, simply:
$ gem install rack-honeycomb
or add this to your Gemfile
gem "rack-honeycomb"
To follow the bleeding edge, it's easy to track the git repo:
gem "rack-honeycomb", :git => "https://github.com/honeycombio/rack-honeycomb.git"
Documentation
See rubydoc for gem documentation.