VOOZH about

URL: https://learn.netdata.cloud/docs/collecting-metrics/statsd

⇱ StatsD Collector | Learn Netdata


Skip to main content

What is StatsD?

StatsD is a system for collecting metrics from applications. Your applications send metrics to StatsD, usually via non-blocking UDP communication, and StatsD servers collect these metrics, perform simple calculations, and push them to time-series databases.

Learn more about the StatsD protocol.

Overview

FeatureDescription
Metric CollectionCollect real-time metrics from any application supporting StatsD protocol
VisualizationView metrics as private charts (one per metric) or custom synthetic charts
Supported Metric TypesGauges, Counters, Meters, Timers, Histograms, Sets, Dictionaries
TransportBoth UDP (low-overhead) and TCP (reliable, higher volume) supported
PerformanceCan collect millions of metrics per second using just 1 CPU core
IntegrationBuilt directly into Netdata - no extra installation needed
Language SupportUse with Python, Node.js, Java, Go, Ruby, Shell scripts, and more
tip

Want a hands-on example? Jump to the K6 StatsD Walkthrough

Supported Metric Types Summary

Metric TypePurposeFormatLLM Summary
GaugesReport current valuesname:value|gReport latest value; can increment/decrement; supports sampling & tags.
CountersCount eventsname:value|c/C/mReport rate & event count; :value optional (default 1); supports sampling & tags.
MetersCount events (rate-focused)name:value|mReport rate & event count; :value optional (default 1); supports sampling & tags.
TimersStatistical analysis of values (duration)name:value|msReport min, max, avg, percentiles, median, stddev, count; supports sampling & tags.
HistogramsStatistical analysis of values (distribution)name:value|hReport min, max, avg, percentiles, median, stddev, count; supports sampling & tags.
SetsCount unique occurrencesname:value|sReport unique count & event count; sampling NOT supported; values as text; supports tags.
DictionariesCount occurrences of distinct valuesname:value|dReport counts per value & total updates; sampling NOT supported; values as text; supports tags.

How StatsD Works with Netdata

Netdata as a StatsD Server

Netdata comes with a fully-featured StatsD server built in. You can:

  • Collect StatsD-formatted metrics
  • Visualize them on the Netdata dashboard
  • Store them in Netdata's database for long-term retention

Since StatsD is embedded in Netdata, you effectively have a StatsD server on every system where Netdata is installed.

note

Netdata's StatsD implementation is incredibly fast. It can collect several million metrics per second on modern hardware using just one CPU core. The implementation uses two threads: one collects metrics, and the other updates the charts.

Pre-configured StatsD Applications

Netdata includes synthetic chart definitions to automatically present application metrics consistently. These are defined in configuration files that you can use as-is or customize.

For synthetic charts, you can set up alerts just like with any other metric or chart.

Currently available applications:

Supported Metric Types

Netdata fully supports the StatsD protocol and extends it for more advanced use cases. All StatsD client libraries are compatible with Netdata.

Advanced Features

Configuration

You can find the StatsD configuration in /etc/netdata/netdata.conf:

[statsd]
# enabled = yes
# decimal detail = 1000
# update every (flushInterval) = 1s
# udp messages to process at once = 10
# create private charts for metrics matching = *
# max private charts hard limit = 1000
# cleanup obsolete charts after = 0
# private charts memory mode = save
# private charts history = 3996
# histograms and timers percentile (percentThreshold) = 95.00000
# add dimension for number of events received = no
# gaps on gauges (deleteGauges) = no
# gaps on counters (deleteCounters) = no
# gaps on meters (deleteMeters) = no
# gaps on sets (deleteSets) = no
# gaps on histograms (deleteHistograms) = no
# gaps on timers (deleteTimers) = no
# listen backlog = 4096
# default port = 8125
# bind to = udp:localhost:8125 tcp:localhost:8125

Configuration Architecture

How the StatsD Configuration Works

Netdata's StatsD chart system uses three key sections in its configuration:

The diagram shows how the configuration flows:

  1. The central statsd.d config connects to three main components:

    • The application configuration
    • The dictionary system
    • Chart definitions
  2. Each of these components serves a specific purpose:

    • The app component handles metric filtering
    • The dictionary manages renaming metrics for display
    • Chart definitions determine properties like family, context, units, and priorities

This structure allows for flexible and powerful metric configuration within Netdata's StatsD implementation.

Key Configuration Options

  • enabled = yes|no - Controls whether StatsD is enabled
  • default port = 8125 - The default port if not specified in binding
  • bind to = udp:localhost tcp:localhost - Space-separated list of IPs and ports to listen on
  • update every (flushInterval) = 1s - How often StatsD updates Netdata charts
  • decimal detail = 1000 - Controls decimal precision in gauges and histograms

StatsD Charts

Netdata can visualize StatsD collected metrics in two ways:

  1. Private charts - Each metric gets its own chart (default, no configuration needed)
  2. Synthetic charts - Combine multiple metrics into custom charts (requires configuration)

Private Metric Charts

Private charts are controlled with create private charts for metrics matching = *. This setting accepts a space-separated list of simple patterns. By default, Netdata creates private charts for all metrics.

Private Chart Naming Convention

When querying StatsD metrics via the Netdata API, you must use the chart identifier that Netdata constructs from the metric name — not the raw metric name you sent to StatsD. The chart identifier is built as follows:

  • Chart type = statsd_<first_word> — where <first_word> is the portion of the metric name before the first . or _.
  • Chart id = <remaining>_<metric_type> — where <remaining> is the portion after the first . or _, and <metric_type> is one of: gauge, counter, meter, timer, histogram, set, or dictionary. If the metric name has no . or _, the chart id is just the <metric_type>.
  • Full chart reference = <chart_type>.<chart_id> — use this as the chart parameter in API queries.
Metric sentMetric typeChart typeChart IDFull chart reference
test.metric:100|ccounterstatsd_testmetric_counterstatsd_test.metric_counter
myapp.used_memory:12345|ggaugestatsd_myappused_memory_gaugestatsd_myapp.used_memory_gauge
myapp.requests:50|mstimerstatsd_myapprequests_timerstatsd_myapp.requests_timer
tip

To discover the exact chart names available on your agent, run:

curl http://localhost:19999/api/v1/charts

Filter the results for IDs starting with statsd_. Use the returned chart id field (in type.id format) as the chart parameter in data queries.

info

Troubleshooting "No metrics where matched to query": This error typically occurs when you use the raw StatsD metric name (e.g., statsd.test.metric) as the chart parameter instead of the constructed chart reference (e.g., statsd_test.metric_counter). To resolve this, verify the correct chart name using /api/v1/charts before querying metric data.

For example, after sending test.metric:100|c via StatsD, the correct query is:

curl "http://localhost:19999/api/v1/data?chart=statsd_test.metric_counter&after=-10&before=now"

The chart name statsd_test.metric_counter follows the type.id convention: type statsd_test (prefix + first dot-delimited word) and id metric_counter (remaining words + metric type).

Example: To create charts for all myapp.* metrics except myapp.*.badmetric:

create private charts for metrics matching = !myapp.*.badmetric myapp.*

You can configure a different memory mode specifically for StatsD charts:

  • private charts memory mode
  • private charts history

Storage Optimization

For performance reasons, Netdata limits private charts. The max private charts hard limit (default: 1000) controls this. Metrics above this limit can still be used in synthetic charts.

For ephemeral metrics, use set charts as obsolete after and cleanup obsolete charts after to automatically clean up charts that haven't received data recently.

Synthetic StatsD Charts

Use synthetic charts to create dedicated sections on the dashboard to render your StatsD charts.

Synthetic charts are organized in:

  • Application - Section in Netdata Dashboard
  • Charts for each application - Family/submenu in the Dashboard
  • StatsD metrics for each chart - Charts and context in the Dashboard

Basic Configuration Structure

For example, to monitor the application myapp using StatsD and Netdata, create the file /etc/netdata/statsd.d/myapp.conf:

[app]
name = myapp
metrics = myapp.*
private charts = no
gaps when not collected = no
history = 60

[dictionary]
m1 = metric1
m2 = metric2

# Chart definition with ID 'mychart'
# The chart will be named: myapp.mychart
[mychart]
name = mychart
title = my chart title
family = my family
context = chart.context
units = tests/s
priority = 91000
type = area
dimension = myapp.metric1 m1
dimension = myapp.metric2 m2

Using this configuration, myapp gets its own dashboard section with one chart containing two dimensions.

When you send metrics like myapp.metric1:10|g and myapp.metric2:20|g, you'll see both private charts and your synthetic chart. These metric names must match the pattern defined in the [app] section (e.g., myapp.*) for them to appear in your synthetic charts.

note

Synthetic chart appears empty or is missing? This happens when the metric names you send don't match the metrics pattern in your [app] section. StatsD matches incoming metric names against the metrics pattern using Netdata's simple pattern syntax — if a metric name doesn't match, it is never linked to the app's synthetic charts. For example, with metrics = myapp.*, sending bare names like foo:10|g creates a private chart for foo but never feeds the synthetic chart. To fix this, send metric names that include the prefix matching the pattern (e.g., myapp.foo:10|g).

Application Section Options

The [app] section defines the application and has these options:

warning

The [app] section is a namespace/container — it groups metrics and sets defaults, but does not create any dashboard charts by itself. To see synthetic charts on the dashboard, you must add one or more chart definition sections (e.g., [mychart]) below the [app] section. If you only define an [app] section without chart definitions, the only visible charts will be private charts for individual metrics (if private charts = yes or the global default is enabled).

Settings like private charts, gaps when not collected, and history configure how the app's metrics and charts behave — they are not chart-level settings. The memory mode setting under [app] is currently ignored. See Chart Definitions below for how to create charts.

note
  • name - Defines the application name
  • metrics - Simple pattern matching all metrics for this app
  • private charts - Enable/disable private charts for matched metrics (yes|no)
  • gaps when not collected - Show gaps when no metrics are collected (yes|no)
  • memory mode - Ignored in the [app] section; application charts use the host's default memory mode
  • history - Size of round-robin database for application charts (optional, minimum 5)

Dictionary Section

[dictionary] defines name-value pairs for renaming metrics in synthetic charts. This allows you to:

  • Define dimension names globally for the whole app
  • Rename dimensions when using patterns
  • Create more human-readable names for technical metrics

The dictionary can be empty or omitted if not needed.

Chart Definitions

Each chart starts with [id] and will be named app_name.id. Key settings for charts:

note
  • family - Controls dashboard submenu placement
  • context - Controls alert templates
  • priority - Controls chart ordering
  • type - Chart visualization type (line, area, stacked)
  • units - Chart measurement units

Dimension Format

Add metrics to charts using dimension lines with this format:

dimension = [pattern] METRIC NAME TYPE MULTIPLIER DIVIDER OPTIONS

Where:

  1. METRIC - The metric name as collected (must match the metrics pattern)
  2. NAME - The dimension name to display (can use dictionary for renaming)
  3. TYPE - (Optional) Value selector like events, last, min, max, etc.
  4. MULTIPLIER - (Optional) Value to multiply the metric by
  5. DIVIDER - (Optional) Value to divide the metric by
  6. OPTIONS - (Optional) Flags like hidden to include but not display a dimension

Scope of StatsD Chart Configuration

All chart and dimension configuration directives in /etc/netdata/statsd.d/*.conf control local agent behavior only — they define how the local Netdata agent processes, names, and visualizes statsd metrics it receives.

The dimension TYPE field (see Dimension Format above) selects which computed value of a metric a single agent displays. It does not control how that metric is combined across multiple Netdata instances.

Cross-node aggregation — how metrics from multiple agents are combined in Netdata Cloud dashboards — is governed by the Cloud query engine, not by statsd configuration files. To choose Sum, Average, or another aggregation for a chart in Netdata Cloud, use the aggregate function on that chart. There is no aggregation = SUM or aggregation = AVG directive in statsd.d configuration.

Using StatsD with Different Languages

Step-by-Step Guide: Monitoring K6 with StatsD

This guide demonstrates how to use Netdata's StatsD to visualize metrics from k6, an open-source load testing tool.


Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.