/instrumenter

Add ActiveSupport instrumentation to your API client

Primary LanguageRubyMIT LicenseMIT

Instrumenter

Quick hack to add ActiveSupport Instrumentations to a class.

Installation

Add this line to your application's Gemfile:

gem 'instrumenter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install instrumenter

Usage

  module Awesome
    module Client

      Instrumenter.instrument self, :awesome

      def send_request
        instrument 'request', method: 'something',  url: 'something else', params: {foo: :bar} do
          # Actual HTTP Request send
          #
        end
      end

    end
  end

You'll get messages with timings in your log file, and aggregate timings at the bottom of log stanzas generated by controller actions.

Contributing

  1. Fork it ( https://github.com/ifad/instrumenter/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request