└── README.md /README.md: -------------------------------------------------------------------------------- 1 | StatsD Metrics Export Specification v0.1 2 | ======================================== 3 | 4 | Edited by Benjamin Black, 5 | 6 | This document describes current practice for the implementation of the various incarnations of the StatsD metric collection protocol. The protocol originated at Flickr, was further developed at Etsy, and has been subsequently influenced by Coda Hale's Metrics. The intent of this document is not to specify or enforce a standard, but only to act as a snapshot of current practice and a guide to ease implementation. 7 | 8 | 9 | Terminology 10 | =========== 11 | 12 | StatsD is used to collect metrics from infrastructure. It is push-based: clients export metrics to a collection server, which in turn derives aggregate metrics and often drives graphing systems such as Graphite. Few assumptions are made about how the data is processed or exposed. 13 | 14 | The terms metrics and infrastructure are both defined broadly. A metric is a measurement composed of a name, a value, a type, and sometimes additional information describing how a metric should be interpreted. Infrastructure is any part of a technology stack, from datacenter UPS controllers and temperature sensors in servers all the way up to function calls in applications and user interactions in a browser. 15 | 16 | If it can be structured as one of the metric types below, it can consumed by StatsD. 17 | 18 | 19 | Metric Types & Formats 20 | ====================== 21 | 22 | The format of exported metrics is UTF-8 text, with metrics separated by newlines. Metrics are generally of the form `:|`, with exceptions noted in the metric type definitions below. 23 | 24 | The protocol allows for both integer and floating point values. Most implementations store values internally as a IEEE 754 double precision float, but many implementations and graphing systems only support integer values. For compatibility all values should be integers in the range (-2^53^, 2^53^). 25 | 26 | Gauges 27 | ------ 28 | 29 | A gauge is an instantaneous measurement of a value, like the gas gauge in a car. It differs from a counter by being calculated at the client rather than the server. Valid gauge values are in the range [0, 2^64^) 30 | 31 | :|g 32 | 33 | Counters 34 | -------- 35 | 36 | A counter is a gauge calculated at the server. Metrics sent by the client increment or decrement the value of the gauge rather than giving its current value. Counters may also have an associated sample rate, given as a decimal of the number of samples per event count. For example, a sample rate of 1/10 would be exported as 0.1. Valid counter values are in the range (-2^63^, 2^63^). 37 | 38 | :|c[|@] 39 | 40 | Timers 41 | ------ 42 | 43 | A timer is a measure of the number of milliseconds elapsed between a start and end time, for example the time to complete rendering of a web page for a user. Valid timer values are in the range [0, 2^64^). 44 | 45 | :|ms 46 | 47 | Histograms 48 | ---------- 49 | 50 | A histogram is a measure of the distribution of timer values over time, calculated at the server. As the data exported for timers and histograms is the same, this is currently an alias for a timer. Valid histogram values are in the range [0, 2^64^). 51 | 52 | :|h 53 | 54 | Meters 55 | ------ 56 | 57 | A meter measures the rate of events over time, calculated at the server. They may also be thought of as increment-only counters. Valid meter values are in the range [0, 2^64^). 58 | 59 | :|m 60 | 61 | In at least one implementation, this is abbreviated for the common case of incrementing the meter by 1. 62 | 63 | 64 | 65 | While this is convenient, the full, explicit metric form should be used. The shortened form is documented here for completeness. 66 | 67 | 68 | References 69 | ========== 70 | 71 | * [Flickr StatsD](http://code.flickr.com/blog/2008/10/27/counting-timing/) 72 | * [Etsy StatsD](https://github.com/etsy/statsd) 73 | * [Coda Hale's Metrics](http://metrics.codahale.com/) 74 | * [metricsd](https://github.com/mojodna/metricsd) 75 | * [Graphite](http://graphite.wikidot.com/) 76 | 77 | --------------------------------------------------------------------------------