Skip to content

ideeli/ideeli-statsd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ideeli Statsd

This gem centralizes additional logic around metrics logging via statsd. Emphasis is on namespace management for metrics coming from (rails) applications and periodic "events" like deployments and outages (logged via a commandline client).

Installation

git clone https://github.com/ideeli/ideeli-statsd
cd ideeli-statsd
bundle install
rake install
cp statsd_config.yaml /etc/statsd_config.yaml

Note that you can place the statsd_config.yaml file elsewhere if you choose and point to it. See the next section.

Rails

Add to config/initializers/statsd.rb:

require 'ideeli'
require 'ideeli/statsd'

Ideeli::Statsd::Client.configure do |option|
  option.logger    = Rails.logger
  option.yaml_file = '/etc/statsd_config.yaml'
end

Log metrics:

def place_order
  Ideeli::Statsd::Client.increment "orders.placed"

  # ...

end

def some_long_query
  Ideeli::Statsd::Client.time "my_query" do

    # ...

  end
end

Commandline

$ statsd-client increment deployment

If a yaml file other than /etc/statsd_config.yaml should be used, set the STATSD_CONFIG environment variables.

The commandline app will namespace metrics as <node_type>.app.<application>.

Actions

All actions supported by statsd have corresponding methods on the Client class and arguments for the commandline client.

About

Ideeli's Statsd helper library and commandline client

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages