EventMachine Statsd
EM::Statsd is a simple async wrapper around the ruby Statsd client. It uses EventMachine Connection class to push data around.
It is written for statsd-ruby
v1.3.0
For older versions of statsd-ruby
use old wrapper
Getting started
-
Add
em-statsd-ruby
to yourGemfile
andbundle install
:gem 'em-statsd-ruby'
-
Require it in code and use:
require 'eventmachine' require 'em-statsd-ruby' EM.run do statsd = EM::Statsd.new('127.0.0.1', 8125) statsd.increment 'daddy' end
-
If you prefer tcp:
statsd = EM::Statsd.new('127.0.0.1', 8125, :tcp)
-
It supports batch too:
EM.run do statsd = EM::Statsd.new('127.0.0.1', 8125) statsd.batch do |s| s.increment 'daddy' s.count 'kitty', 5 end end
or
```ruby
EM.run do
statsd = EM::Batch(EM::Statsd.new('127.0.0.1', 8125))
statsd.increment 'daddy'
statsd.count 'kitty', 5
end
```
Copyright
Copyright (c) Valery Mayatsky. See LICENSE for details.