Instrument sinatra template rendering
Add this line to your application's Gemfile:
gem 'sinatra-template_metrics'And then execute:
$ bundle
Or install it yourself as:
$ gem install sinatra-metrics
Just require sinatra/template_metrics in addition to sinatra/base as:
require 'sinatra/base'
require 'sinatra-template_metrics'
class App < Sinatra::Base
get '/' do
erb :index, layout: :base
end
endThis will show you the measure time to render erb as:
time:2014-11-02T02:39:50+09:00 template:index layout:base elapsed:0.002839445
where elapsed is the elapsed time in seconds.
- rack-ltsv_logger (or
enable :logging) is useful to instrument http request. - mysql2-metrics is useful to instrument mysql2 queries.
- Fork it ( https://github.com/sonots/sinatra-metrics/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