Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby client for statsd.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 statsd-client.gemspec
README.md

statsd-client

This is a simple client for statsd. It's roughly equivalent to the php and python examples included in the statsd repo. I put it in a gem to make it easy to install, reuse, etc.

Example

require 'rubygems'
require 'statsd'

Statsd.host = 'localhost'
Statsd.port = 8125

Statsd.increment('some_counter') # basic incrementing
Statsd.increment('system.nested_counter', 0.1) # incrementing with sampling (10%)

Statsd.decrement(:some_other_counter) # basic decrememting using a symbol
Statsd.decrement('system.nested_counter', 0.1) # decrementing with sampling (10%)

Statsd.timing('some_job_time', 20) # reporting job that took 20ms
Statsd.timing('some_job_time', 20, 0.05) # reporting job that took 20ms with sampling (5% sampling)

# passing a block to `timing` will capture the time it takes to execute   
Statsd.timing('some_job_time') do
  # do some job
end
Something went wrong with that request. Please try again.