Honeybadger

Introduction

Honeybadger allows custom data to be attached to an event via Honeybadger.context. Using this functionality, a link to related log data in Papertrail can be added to an error, providing a simple way of seeing what other activity was occurring around that time period.

Setup

Here’s an example of how that might be implemented in a Rails before_filter call:

before_filter do
  Honeybadger.context({
    :papertrail_url => "https://papertrailapp.com/events?time=#{Time.now.gmtime.to_i}",
  })
end

A timestamp based URL to Papertrail is included in Honeybadger.context, and whenever an error occurs, Honeybadger will display it in the UI.

Subsequent calls to context will merge the existing hash with any new data, so any other relevant information can be built up throughout the request’s life cycle. Honeybadger will discard the data when a request completes, so that the next request will start with a blank slate.