Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

statsd

Daemon for easy but powerful stats aggregation

Subscribe to updates I use statsd


Statistics on statsd

Number of watchers on Github 12684
Number of open issues 86
Average time to close an issue about 2 months
Main language JavaScript
Average time to merge a PR about 1 month
Open pull requests 62+
Closed pull requests 21+
Last commit almost 3 years ago
Repo Created over 8 years ago
Repo Last Updated over 1 year ago
Size 2.05 MB
Organization / Authoretsy
Contributors165
Page Updated
Do you use statsd? Leave a review!
View open issues (86)
View statsd activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating statsd for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

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
statsd open issues Ask a question     (View All Issues)
  • about 3 years statsd as a logstash codec
  • about 3 years How to escape metrics with colon in the name
  • about 3 years Allow deleteGauges to take idle time as parameter
  • about 3 years statsd not generating metrics under the stats and stats_counts folder in graphite
  • almost 4 years Ramifications of setting the prefixes to ""
  • almost 4 years The default counterNamespace is incorrect
  • almost 4 years StatsD fails to run when installed according to "Installation and Configuration" in README.md
  • about 4 years Statsd-proxy missing metrics
  • about 4 years As a developer, I would love a fancy tshirt
  • about 4 years Missing explanation for the metric graphiteStats.calculationtime
  • over 4 years Proxy cluster setup
  • over 4 years Add information on what to measure to the wiki
  • over 4 years Is it possible to flush the metrics into a file right before the statsd daemon being stopped/killed?
  • over 4 years nanosecond timers
  • over 4 years Make statsd as a proper node_module
  • almost 5 years proxy.js: { 'replicas': 0 } does not do what we think it does.
  • almost 5 years EADDRINUSE on activated config reload
  • about 5 years Number of StatsD instances in a single host
  • about 5 years Resend metrics if connection is reset
  • about 5 years Use CommonJS modules in config
  • about 6 years Config change detection loop stacks unlimited number of SIGTERM listeners
  • about 6 years Management port is sensitive to packetization of input
  • about 6 years 20% of lost values after statsd
  • over 6 years Support Cormode-Muthukrishnan percentiles
statsd open pull requests (View All Pulls)
  • Make statsd work with newer version of node
  • Allow to use unix domain sockets.
  • statsd-proxy management server
  • Systemd improvements
  • Updated copyright to 2016
  • Added aws-cloudwatch-backend to backend list
  • change subconfig(at statsd.js 330:15) to local variable
  • Improve native packaging
  • Fix date in debian changelog
  • SystemD enable autostart fails
  • Support InfluxDB 0.9 Line Protocol
  • Repeater hosts can be configured to send on flush
  • issue #462 fix EADDRINUSE on config reload
  • support pickle to graphite
  • More precisely changelog merge of #506 and #517
  • Change deleteIdleStats default value from false to true
  • Upgrade to "nodeunit": "^0.9.1"
  • Remove readFileSync inside readFile while reading config
  • Use "percentile" as it is defined in statistics
  • Replica should be 1 not 0 (0 = no hashring = no proxy)
  • Adding proxy management interface
  • added tcp repeater. merged with udp repeater
  • fix reporting of dead upstream statsd metrics
  • Use jshint for sanitizations
  • Clean backends interface
  • default time for flushInterval in exampleConfig
  • Graphite backend: Applying the globalPrefix value in legacyNamespace mode
  • rewrite stats.js to use promises and add regex-whitelisting
  • Adds an optional (extra) multicast listener to StatsD
  • Allow for aliasing the different timer metrics
  • Allow the proxy to listen over TCP
  • Add Docker support
  • Reuse Graphite connection and abstract out test helpers
  • support regexp in histogram config
  • Fix inactive timers flushes
  • statsd-proy: reset/delete state of metrics on statsd instances when ring members change [WIP]
  • Add Graphite backend configuration flag to connect only when there are metrics to send
  • New 'derives' functionality added
  • Connecting graphite with an SSL certificate.
  • Composition Engine
  • Make it possible to configure which timer metrics not to calculate
  • Cleaned up console backend to make more readable
  • Configuration can now be loaded from ENV as well as from a configuration file
  • Regex filter on graphite timer stats
  • updated new namespacing to support suffixes instead of prefixes
  • Additional graphite options to reduce overall stat counts when not needed
  • Raw and averages
  • Add nano msg server
  • Handle stream errors in TCP server.
  • Add some of my StatsD plugins
  • Switch usage of process.EventEmitter (removed in Node 7) for require('events')
  • Update: ignore files
  • Enhancement: populate default config
  • removes -q switch
  • Max ttl for gauges
  • add support to negative number as value
  • Fix bug with getFlushTimeout
  • Suppressing TCP errors from clients to prevent TCP server crashes
  • Add clarification to metric_types docs for Gauges
  • Update docs
  • Update metric_types.md
  • Refactor use of EventEmitter to work with Node versions 6 and above
statsd questions on Stackoverflow (View All Questions)
  • InfluxDB: query to calculate average of StatsD "executionTime" values
  • Can I use graphite/statsd for data with specific date attached to it?
  • Writing an Asterisk security statistics module for statsd , why it does not run ? where is the wrong ? how to solve?
  • Creating one graph per node in Graphite and statsd
  • statsd architecture for a distributed system
  • StatsD and complex systems/applications
  • Can WebSharper generate real-time visualizations a-la Graphite+StatsD?
  • Graphite and statsd, averaging percentile, stddev incorrect
  • Graphite and statsd - how to change graphe metric to 1 min
  • Using Etsy's StatsD in a Windows Environment
  • Can statsd handle negative timings?
  • StatsD not listening (port 8125)
  • Passing Collectd Data to Statsd Running in Docker Container
  • statsd not wok in my logstash
  • Address family for hostname not supported in python statsd client 3.2, but ip provided
  • StatsD sends Average or Graphite stores Average instead of Sum
  • How to collect stats with StatsD?
  • Exporting Spring Boot Actuator Metrics (& Dropwizard Metrics) to Statsd
  • Why does my node-statsd client script not exit?
  • Why use statsd when graphite's Carbon aggregator can do the same job?
  • statsd influxdb retention policy not found
  • Statsd and InfluxDB: how to handle host information?
  • How to set up StatsD (along with Grafana & Graphite) as backend for Kamon?
  • Graphite displays shotrented metrics names from what is sent to StatsD
  • Statsd and Graphite issue in Rails. How do I send over data to the Graphite GUI?
  • How do I retrieve data from statsd?
  • Cubism and metrics in Elasticsearch (statsd/diamond)
  • Saving multiple values with StatsD
  • trying to get play-statsd to work with play framework v2.4
  • Using statsd-brdge to push data to prometheus from statsd
  • InfluxDB: query to calculate average of StatsD "executionTime" values
  • Does a thread-safe statsd client exist?
  • Exporting Spring Boot Actuator Metrics (& Dropwizard Metrics) to Statsd
  • Statsd: Which metric to use to measure data throughput
  • Sending . char in statsd through collectd
  • StatsD sends Average or Graphite stores Average instead of Sum
  • Statsd dies after few hours
  • Can I use graphite/statsd for data with specific date attached to it?
  • Writing an Asterisk security statistics module for statsd , why it does not run ? where is the wrong ? how to solve?
  • Creating one graph per node in Graphite and statsd
  • statsd architecture for a distributed system
  • StatsD and complex systems/applications
  • Can WebSharper generate real-time visualizations a-la Graphite+StatsD?
  • Graphite and statsd, averaging percentile, stddev incorrect
  • Graphite and statsd - how to change graphe metric to 1 min
  • Using Etsy's StatsD in a Windows Environment
  • Can statsd handle negative timings?
  • StatsD not listening (port 8125)
  • Passing Collectd Data to Statsd Running in Docker Container
  • statsd not wok in my logstash
  • Address family for hostname not supported in python statsd client 3.2, but ip provided
  • How to collect stats with StatsD?
  • Why does my node-statsd client script not exit?
  • Why use statsd when graphite's Carbon aggregator can do the same job?
  • statsd influxdb retention policy not found
  • Statsd and InfluxDB: how to handle host information?
  • How to set up StatsD (along with Grafana & Graphite) as backend for Kamon?
  • Graphite displays shotrented metrics names from what is sent to StatsD
  • Statsd and Graphite issue in Rails. How do I send over data to the Graphite GUI?
  • How do I retrieve data from statsd?
statsd list of languages used
Other projects in JavaScript