A client for DogStatsD, an extension of the StatsD metric server for Datadog.
First install the library:
gem install dogstatsd-ruby
Then start instrumenting your code:
# Load the dogstats module.
require 'statsd'
# Create a stats instance.
statsd = Statsd.new('localhost', 8125)
# Increment a counter.
statsd.increment('page.views')
# Record a gauge 50% of the time.
statsd.gauge('users.online', 123, :sample_rate=>0.5)
# Sample a histogram
statsd.histogram('file.upload.size', 1234)
# Time a block of code
statsd.time('page.render') do
render_page('home.html')
end
# Tag a metric.
statsd.histogram('query.time', 10, :tags => ["version:1"])
Full API documentation is available here.
To suggest a feature, report a bug, or general discussion, head over here.
- 1.2.0
- Added global tags.
- Added ability to set
namespace
andtags
fromStatsd#initialize
.
- 1.1.0
- Added
sets
metrics.
- Added
- 1.0.0
- Initial release.
dogstatsd-ruby is forked from Rien Henrichs original Statsd client.
Copyright (c) 2011 Rein Henrichs. See LICENSE.txt for further details.