Git Product home page Git Product logo

estatsd's Introduction

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
==========

1) Install and configure graphite (quick-ish)
2) Install rebar, have it in your path
3) rebar compile
4) erl -pa ebin
5) > application:start(estatsd).
   > estatsd:increment(foo, 123).
6) 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



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

estatsd's People

Contributors

blinkov avatar jwheare avatar rj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

estatsd's Issues

Inaccurate gauges

Fragments = lists:foldl(

Gauge data are associated with timestamp in second if several updates occurred within the same timestamp graphite will interpret the first update as the last one because the list is reversed when building gauges report. It could be solved by using lists:foldr/3 instead of lists:foldl/3 when building the Fragments in estatsd_server:do_report_gauges/1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.