MiniGraphite
Simple wrapper for Graphite and Statsd
Instructions
Check the test folder for examples, if you need more explanations please contact us.
Installation
Add this line to your application's Gemfile:
gem 'mini_graphite'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mini_graphite
Usage
Dalia::MiniGraphite.config({
:graphite_host => "my.graphite.server.com",
:graphite_port => 2003, # default 2003
:statsd_host => "my.graphite.server.com",
:statsd_port => 8125, # default 8125
:mock_mode => false, # default false
:debug_mode => true # default false
})
Dalia::MiniGraphite.datapoint("my.key", 120, Time.now) # to Graphite
Dalia::MiniGraphite.counter("my.key", 120) # to StatSD
This will send 4 signals:
- key_prefix.ini # At the begining of the block
- key_prefix.count # At the begining of the block, keep it for compatibility
- key_prefix.time, ~1000 # At the end of the block, with the Benchmark.realtime result of the execution
key_prefix.end # At the end of the block
result = Dalia::MiniGraphite.benchmark_wrapper("key_prefix") do sleep(1) "RESULT" end
puts result # => RESULT
Contributing
- Fork it ( http://github.com/
/mini_graphite/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 new Pull Request