Quick hack to add ActiveSupport Instrumentations to a class.
Add this line to your application's Gemfile:
gem 'instrumenter'And then execute:
$ bundle
Or install it yourself as:
$ gem install instrumenter
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
endYou'll get messages with timings in your log file, and aggregate timings at the bottom of log stanzas generated by controller actions.
- Fork it ( https://github.com/ifad/instrumenter/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request