Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olivierlacan/etalon
A simple tool to instrument Ruby code
https://github.com/olivierlacan/etalon
benchmarking instrumentation ruby
Last synced: about 1 month ago
JSON representation
A simple tool to instrument Ruby code
- Host: GitHub
- URL: https://github.com/olivierlacan/etalon
- Owner: olivierlacan
- License: mit
- Created: 2018-10-31T16:05:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-20T05:00:16.000Z (almost 2 years ago)
- Last Synced: 2024-11-18T00:50:21.146Z (2 months ago)
- Topics: benchmarking, instrumentation, ruby
- Language: Ruby
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Etalon [![Build Status][ci-badge]][ci-url] [![Gem Version][gem-badge]][gem-url]
A simple tool to instrument Ruby code and output basic metrics to a
logger or store them in a hash.From the French noun `étalon` meaning:
> standard: something used as a measure for comparative evaluations## Installation
Add this line to your application's Gemfile:
```ruby
gem 'etalon'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install etalon
In that last case, you'll need to manually `require "etalon"`.
## Usage
Assuming the following instrumented code:
```ruby
class Cooking
def self.potato
Etalon.time("Making taters") do
peel_potato
cook_potato
end
end
end
```You can do the following:
```
$ irb
require "cooking"
=> trueEtalon.activate
=> trueEtalon.print_timings
=> {:making_taters=>["count: 1", "min: 0", "max: 400", "mean: 400.0", "deviation: ±0%", "top 5: [400]"]}
```If `Rails.logger` is available, Etalon will also output the following with
a call to `Rails.logger.debug` in the relevant log file:```
Making Taters - count: 1 | min: 0 | max: 400 | mean: 400.0 | deviation: ±0.0% | top 5: [400]
```If `Rails.logger` isn't available, Etalon attempts to require
[`syslog/logger`][syslog-logger] from the Ruby standard library as a fallback
logging mechanism.[syslog-logger]: https://www.rubydoc.info/stdlib/syslog/2.3.1/Syslog/Logger
## Contributing
[Bug reports][bugs] and [pull requests][pulls] are welcome.
See [contribution guidelines][contributions].
[bugs]: https://github.com/olivierlacan/etalon/issues
[pulls]: https://github.com/olivierlacan/etalon/pulls
[contributions]: https://github.com/olivierlacan/etalon/blob/master/CONTRIBUTING.md
[ci-badge]: https://travis-ci.org/olivierlacan/etalon.svg?branch=master
[ci-url]: https://travis-ci.org/olivierlacan/etalon
[gem-badge]: https://img.shields.io/gem/v/etalon.svg?style=flat
[gem-url]: https://rubygems.org/gems/etalon