0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rack middleware for logging request data to Honeycomb.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 1.7
>= 1.0.0
>= 0
~> 10.0
>= 0
>= 0

Runtime

>= 1.5.0
 Project Readme

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.