Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sonots/sinatra-template_metrics
Instrument sinatra template rendering
https://github.com/sonots/sinatra-template_metrics
Last synced: 2 months ago
JSON representation
Instrument sinatra template rendering
- Host: GitHub
- URL: https://github.com/sonots/sinatra-template_metrics
- Owner: sonots
- License: mit
- Created: 2014-11-01T15:48:57.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-11T07:49:33.000Z (about 10 years ago)
- Last Synced: 2024-10-13T08:08:43.151Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 168 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Sinatra::TemplateMetrics
Instrument sinatra template rendering
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'sinatra-template_metrics'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install sinatra-metrics
## Usage
Just require `sinatra/template_metrics` in addition to `sinatra/base` as:
```ruby
require 'sinatra/base'
require 'sinatra-template_metrics'class App < Sinatra::Base
get '/' do
erb :index, layout: :base
end
end
```This 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.
## See also
* [rack-ltsv_logger](https://github.com/sonots/rack-ltsv_logger) (or `enable :logging`) is useful to instrument http request.
* [mysql2-metrics](https://github.com/sonots/mysql2-metrics) is useful to instrument mysql2 queries.## Contributing
1. Fork it ( https://github.com/sonots/sinatra-metrics/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