module Honeybadger::InstrumentationHelper

Honeybadger::InstrumentationHelper is a module that can be included into any class. This module provides a convenient DSL around the instrumentation methods to provide a cleaner interface. There are three usage variations as show in the example below:

@example class TicketsController < ApplicationController include Honeybadger::InstrumentationHelper

  def create
    metric_source 'controller'
    metric_attributes(foo: 'bar') # These attributes get tagged to all metrics called after.

    # pass a block
    time('create.ticket') { Ticket.create(params[:ticket]) }

    # pass a lambda argument
    time 'create.ticket', ->{ Ticket.create(params[:ticket]) }

    # pass the duration argument
    duration = timing_method { Ticket.create(params[:ticket]) }
    time 'create.ticket', duration: duration
  end
end