A Ruby client for HostedGraphite
Add this line to your application's Gemfile:
gem 'hosted_graphite'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hosted_graphite
Set ENV['HOSTEDGRAPHITE_APIKEY']
to your hosted graphite API key.
Your API key can be found on your account home page.
You can also set the hosted graphite API key programatically with:
HostedGraphite.api_key = 'YOUR API KEY'
HostedGraphite.protocol = :udp
HostedGraphite.send_metric('foo.udp', 1.2)
HostedGraphite.protocol = :tcp
HostedGraphite.send_metric('foo.tcp', 1.2)
HostedGraphite.protocol = :http
HostedGraphite.send_metric('foo.http', 1.2)
HostedGraphite.protocol = :faraday_protocol
HostedGraphite.send_metric('foo.faraday', 1.2)
Enable Statsd on your account
Ensure these line are present in your application's Gemfile:
gem 'hosted_graphite'
gem 'statsd-ruby'
And then require
require 'hosted_graphite/statsd'
# Send some stats
HostedGraphite.increment 'page_views'
HostedGraphite.decrement 'likes_count'
HostedGraphite.timing 'foo', 320
HostedGraphite.gauge 'bar', 100
# Use {#time} to time the execution of a block
HostedGraphite.time('newsletter.monthly') { @newsletter.deliver_now }
- Fork it ( https://github.com/seuros/hosted_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 a new Pull Request