Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
/ estatsd Public archive
forked from spilgames/estatsd

Erlang stats aggregation app that periodically flushes data to graphite

License

Notifications You must be signed in to change notification settings

luceracloud/estatsd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

estatsd is a simple stats aggregation service that periodically dumps data to Graphite: http://graphite.wikidot.com/

NB: Graphite is good, despite the website being a bit ghetto.

Inspired heavily by etsy statsd: http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/

QUICK DEMO

Prerequisites:

  • Graphite (or use the included dummy server via "make graphite")
  • Erlang
  • Rebar (on your path)

Running:

  1. make
  2. make go
  3. estatsd:increment(foo, 123).
  4. Observe graphite now has 1 data point.

USAGE

Add this app to your rebar deps, and make sure it's started somehow eg: application:start(estatsd).

You can configure custom graphite host/port and flush interval using application environment vars. See estatsd_sup for details.

The following calls to estatsd are all gen_server:cast, ie non-blocking.

Gauges

estatsd:gauge(temperature, 45).            %% set temperature to 45

Counters

estatsd:increment(num_foos).            %% increment num_foos by one

estatsd:decrement(<<"num_bars">>, 3).   %% decrement num_bars by 3

estatsd:increment("tcp.bytes_in", 512). %% increment tcp.bytes_in by 512

Timers

estatsd:timing(sometask, 1534).         %% report that sometask took 1534ms

Or for your convenience:

Start = erlang:now(),
do_sometask(),
estatsd:timing(sometast, Start).        %% uses now() and now_diff for you

CONFIGURATION

See config_example for an example configuration

NOTES

This could be extended to take a callback for reporting mechanisms. Right now it's hardcoded to stick data into graphite.

I've been running this since May 2011 in production for irccloud.

Richard Jones [email protected] @metabrew

About

Erlang stats aggregation app that periodically flushes data to graphite

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Erlang 99.7%
  • Shell 0.3%