Skip to content
Daemon for easy but powerful stats aggregation
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
backends
bin add bin/statsd Jun 28, 2012
debian Updates changelogs. closes #568 May 11, 2016
docs Merge pull request #663 from BlueHatbRit/patch-1 Feb 26, 2019
examples Added StatsdClient Kotlin implementation May 2, 2018
lib Fix for failing test on node 0.10 Nov 21, 2016
packager Force statsd restart when updating package Nov 11, 2015
servers Fix node 0.10 error. May 5, 2016
test run tests using python 3.7's pickle rather than 2.x cPickle (#669) Mar 25, 2019
utils removes -q switch Dec 19, 2016
.dockerignore Update: ignore files Jan 14, 2017
.gitignore
.pkgr.yml Remove all default dependencies in generated package Nov 11, 2015
.travis.yml run tests using python 3.7's pickle rather than 2.x cPickle (#669) Mar 25, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Feb 12, 2019
CONTRIBUTING.md move contributing information into CONTRIBUTING.md Jan 29, 2014
Changelog.md Updates changelogs. closes #568 May 11, 2016
DCO.txt Create DCO.txt Feb 12, 2019
Dockerfile Pin Node version to 5.x on Docker image. May 5, 2016
LICENSE Updated copyright to 2016 Jan 1, 2016
MAINTAINERS.md Add myself (elliot blackburn) to maintainers.md (#666) Mar 7, 2019
README.md Merge pull request #654 from lpmi-13/typofix Feb 14, 2019
docker-compose.yml Initial Docker Compose manifest. Apr 29, 2016
exampleConfig.js Merge pull request #564 from Nihn/allow-to-use-unix-domain-so May 5, 2016
exampleProxyConfig.js
package.json run tests using python 3.7's pickle rather than 2.x cPickle (#669) Mar 25, 2019
proxy.js
run_tests.js
stats.js Account for negative clock skew in flushMetrics May 7, 2016

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).

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 integers.

  • 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.

History

statsd was originally written at (Etsy) and released with a blog post 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

You can’t perform that action at this time.