StatsD
By Etsy
StatsD is a network daemon that listens for application metrics sent as small UDP or TCP messages, aggregates them in memory over short intervals, and forwards the aggregated results to a backend such as Graphite. Originally built at Etsy,…
Definition
StatsD is a network daemon that listens for application metrics sent as small UDP or TCP messages, aggregates them in memory over short intervals, and forwards the aggregated results to a backend such as Graphite. Originally built at Etsy, it popularized a lightweight push-based approach to instrumentation where application code sends a one-line metric update and does not wait for a response, minimizing the performance cost of instrumenting hot code paths.
Overview
Applications often need to emit fine-grained operational data, such as how many times an endpoint was hit or how long a database call took, without that instrumentation slowing down the request path or requiring the application to manage metric storage itself. StatsD solves this by giving applications an extremely cheap way to fire off a metric: a client library sends a short, fire-and-forget UDP packet containing a metric name, a value, and a type indicator, and StatsD does the work of aggregating those packets into meaningful statistics. Mechanically, the StatsD daemon listens on a UDP port for incoming packets formatted as `metric_name:value|type`, where the type indicates whether the value is a counter increment, a gauge reading, a timing measurement, or a set member. Over a configurable flush interval, typically ten seconds, StatsD aggregates all packets received for each metric name, computing counts, rates, and for timers, percentiles like the 90th and 99th, and then pushes the aggregated results to a backend such as Graphite, InfluxDB, or a StatsD-compatible exporter that bridges to Prometheus. StatsD's push-and-aggregate model differs sharply from the pull-based approach used by Prometheus and the OpenMetrics format, where a collector scrapes a metrics endpoint on its own schedule. StatsD's UDP transport means metric sends can be lost without the application ever knowing, which is an accepted trade-off for the model's very low overhead; this makes StatsD attractive for extremely latency-sensitive code but less suitable where exact counts are required. In practice, StatsD client libraries are embedded directly in application code across many languages, and the daemon itself is often deployed as a sidecar or a local collector on each host to minimize network latency for the fire-and-forget sends. It remains common in older infrastructure and in environments that standardized on Graphite as a metrics store, and StatsD-compatible protocols are still supported by many modern collectors for backward compatibility. The main limitations are the lack of delivery guarantees inherent to UDP, the absence of built-in support for high-cardinality labels compared to dimensional systems like Prometheus, and the need to run and scale a separate aggregation daemon as traffic volume grows. Many teams migrating to cloud-native stacks replace StatsD with a pull-based, dimensional metrics pipeline, or use a StatsD-to-Prometheus exporter as a bridge during the transition rather than adopting it fresh. Operationally, StatsD also requires deciding where the aggregation daemon lives relative to the applications sending it data, since a shared, remote StatsD instance reintroduces the network latency and packet-loss risk that a local, per-host deployment is meant to avoid, which is why sidecar deployment patterns became the common best practice.
Key Features
- Accepts metrics as lightweight, fire-and-forget UDP or TCP packets
- Aggregates counters, gauges, timers, and sets over a flush interval
- Computes percentile statistics for timing measurements automatically
- Forwards aggregated results to backends like Graphite or InfluxDB
- Extremely low overhead on the instrumented application's hot path
- Simple text-based line protocol supported by many client libraries
- Commonly deployed as a per-host sidecar to minimize network latency
- Widely bridged to Prometheus via StatsD-compatible exporters