Statsman

Send stats to a cupboard backend

Installation

Add this line to your application's Gemfile:

gem 'statsman'

And then execute:

$ bundle

Or install it yourself as:

$ gem install statsman

Usage

Rails

In an initializer:

# config/initializers/statsman.rb

Statsman.config do |config|
  #config.logging_on = false      # stealth by default
  config.api_key = "your-api-key"
  config.api_secret = "your-api-secret"
  config.url = "http://url-of-cupboard-backend"
end

Then, whereever you want to collect stats:

# Send a counter stat
Statsman.send_counter "my-counter-stat-name", some_count, { optional: "metadata" }

# Send a value stat
Statsman.send_value "my-value-stat-name", some_value, { optional: "metadata" }

Troubleshooting

If Statsman doesn't appear to be working, be sure to turn on logging.

TODO

  • Thread pool?

Contributing

  1. Fork it ( https://bitbucket.org/7compass/statsman/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request