Simple daemon for easy stats aggregation
Перейти к файлу
Evan Broder 08554bdb5f Support loading multiple servers.
Example config looks something like this:

{
  servers: [
    {server: './servers/tcp', address: '0.0.0.0', port: 6125}
  , {server: './servers/udp', port: 6125}
  ]
}
2015-05-04 12:46:22 +01:00
backends Backend key name sanitization can be controlled with config flag 2015-02-06 19:00:57 +00:00
bin add bin/statsd 2012-06-28 16:07:37 +02:00
debian removing duplicated libs from debian package 2014-10-01 18:23:08 -03:00
docs add couchdb to backends 2015-03-06 16:01:28 +00:00
examples Julia statsd client implementation 2014-02-26 12:03:17 -08:00
lib Validate negative sampling 2014-10-27 14:35:11 +01:00
packager Enable packaging at https://packager.io/gh/pkgr/statsd 2014-11-20 10:23:19 +00:00
servers Initialise tcp buffer to empty string 2014-10-13 10:58:27 +00:00
test Merge pull request #470 from shaylang/pr_155_take2 2015-02-06 18:59:49 +00:00
utils clearer sample graphite url 2013-02-19 19:02:37 -05:00
.gitignore Added IDEA project files to .gitignore 2014-07-27 11:33:52 +04:00
.pkgr.yml Enable packaging at https://packager.io/gh/pkgr/statsd 2014-11-20 10:23:19 +00:00
.travis.yml run tests on v0.12.x 2015-03-06 11:22:19 -05:00
CONTRIBUTING.md move contributing information into CONTRIBUTING.md 2014-01-29 14:07:16 +01:00
Changelog.md bumping for v0.7.2 patch release 2014-09-11 19:34:47 +00:00
LICENSE Fix outdated copyright year (update to 2014) 2014-03-25 17:01:25 -07:00
README.md Add server documentation links 2014-10-17 12:57:08 +00:00
exampleConfig.js Support loading multiple servers. 2015-05-04 12:46:22 +01:00
exampleProxyConfig.js Proxy with cluster module 2014-10-22 10:28:48 +02:00
package.json add license information into package.json 2015-04-12 11:00:45 -04:00
proxy.js Proxy with cluster module 2014-10-22 10:28:48 +02:00
run_tests.sh Make failing tests exit with non-zero status 2012-07-20 22:17:08 -07:00
stats.js Support loading multiple servers. 2015-05-04 12:46:22 +01:00

README.md

StatsD Build Status

A network daemon that runs on the Node.js platform and listens for statistics, like counters and timers, sent over UDP or TCP and sends aggregates to one or more pluggable backend services (e.g., Graphite).

We (Etsy) blogged about how it works and why we created it.

Inspiration

StatsD was inspired (heavily) by the project (of the same name) at Flickr. Here's a post where Cal Henderson described it in depth: Counting and timing Cal re-released the code recently: Perl StatsD

Key Concepts

  • buckets Each stat is in its own "bucket". They are not predefined anywhere. Buckets can be named anything that will translate to Graphite (periods make folders, etc)

  • values Each stat will have a value. How it is interpreted depends on modifiers. In general values should be integer.

  • flush After the flush interval timeout (defined by config.flushInterval, default 10 seconds), stats are aggregated and sent to an upstream backend service.

Installation and Configuration

  • Install node.js

  • Clone the project

  • Create a config file from exampleConfig.js and put it somewhere

  • Start the Daemon:

    node stats.js /path/to/config

Usage

The basic line protocol expects metrics to be sent in the format:

<metricname>:<value>|<type>

So the simplest way to send in metrics from your command line if you have StatsD running with the default UDP server on localhost would be:

echo "foo:1|c" | nc -u -w0 127.0.0.1 8125

More Specific Topics

Debugging

There are additional config variables available for debugging:

  • debug - log exceptions and print out more diagnostic info
  • dumpMessages - print debug info on incoming messages

For more information, check the exampleConfig.js.

Tests

A test framework has been added using node-unit and some custom code to start and manipulate statsd. Please add tests under test/ for any new features or bug fixes encountered. Testing a live server can be tricky, attempts were made to eliminate race conditions but it may be possible to encounter a stuck state. If doing dev work, a killall statsd will kill any stray test servers in the background (don't do this on a production machine!).

Tests can be executed with ./run_tests.sh.

Meta

  • IRC channel: #statsd on freenode
  • Mailing list: statsd@librelist.com