This is simple gem for tracking response times of external resources using Faraday
Add this line to your application's Gemfile:
gem 'faraday_timing_middleware'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install faraday_timing_middleware
You can use it as any other Faraday
middleware
Faraday::Connection.new(url) do |connection|
connection.use :response_time
connection.adapter Faraday.default_adapter
end
IMPORTANT
Order of middlewares is important so be careful where you put this middleware. From Faraday's README
The order in which middleware is stacked is important. Like with Rack, the first middleware on the list wraps all others, while the last middleware is the innermost one, so that must be the adapter.
- Fork it ( https://github.com/[my-github-username]/faraday_timing_middleware/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