Project

metricize

0.0
No commit activity in last 3 years
No release in over 3 years
Simple client/forwarder system to aggregate metrics and periodically send them to a stats service
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
>= 0

Runtime

 Project Readme

Metricize

Simple in-memory server to receive metrics, aggregate them, and send them to a stats service

Installation

Add this line to your application's Gemfile:

gem 'metricize'

And then execute:

$ bundle

Or install it yourself as:

$ gem install metricize

Usage

# start server in its own Ruby process (eg using lib/tasks/metrics.rake)
Metricize::Server.new(username: 'name@example.com', password: 'api_key').start

# start appropriate client (eg from config/initializers/metrics.rb)
if Rails.env == 'production'
  client_config = { prefix:     "app_name.#{Rails.env}",
                    queue_host: 'localhost',
                    queue_name: "app_name.#{Rails.env}.metrics_queue",
                    logger:     Rails.logger }

  METRICS = Metricize::Client.new(client_config)

else
  METRICS = Metricize::NullClient
end

# use client interface to send metrics from the app
METRICS.increment('content_post.make') # increment by default value of 1
METRICS.increment('bucket.make', by: 5) # increment counter by 5
METRICS.measure('worker_processes', 45) # send a snapshot of a current value (eg 45)
METRICS.time('facebook.request_content') do  # record the execution time of a slow block
  # make API call...
end
METRICS.measure('stat', 45, source: 'my_source') # break out stat by subgrouping

Contributing

  1. Fork it
  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 new Pull Request