Skip to content

ifad/instrumenter

 
 

Repository files navigation

Instrumenter

RuboCop Ruby

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.

Testing

Appraisal

Gem dependency versions are managed by Appraisal.

After any change to Appraisals, regenerate the appraisal gemfiles by running:

bundle exec appraisal generate

To install dependencies for all appraisal gemfiles, run:

bundle exec appraisal install

To run specs against a specific Rails version, run:

bundle exec appraisal rails-7.2 rspec

Testing matrix

GitHub Actions runs the Appraisal matrix declared in .github/workflows/ruby.yml, and RuboCop runs in .github/workflows/rubocop.yml.

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

About

Add ActiveSupport instrumentation to your API client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 100.0%