Statsd Receiver
contrib
Maintainers: @jmacd, @dmitryax
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
Configuration
The Following settings are optional:-
endpoint: Address and port to listen on.- For
udpandtcpbasedtransport, this config will default tolocalhost:8125 - For
unixgramtransport, this config will default to/var/run/statsd-receiver.sock
- For
-
transport(default =udp): Protocol used by the StatsD server. Currently supported transports can be found in this file. -
socket_permissions(default =0622): When transport is set tounixgram, can be used to customize permissions of the binded socket. -
aggregation_interval: 70s(default value is 60s): The aggregation time that the receiver aggregates the metrics (similar to the flush interval in StatsD server) -
enable_metric_type: true(default value is false): Enable the statsd receiver to be able to emit the metric type(gauge, counter, timer(in the future), histogram(in the future)) as a label. -
enable_ip_only_aggregation(default value is false): Enables metric aggregation onClient+IPonly. Normally, aggregation is performed onClient+IP+Port. This setting is useful when the client sends metrics from a random ports or the receiver should aggregate metrics from the same client but different ports. -
enable_simple_tags: true(default value is false): Enable parsing tags that do not have a value, e.g.#mykeyinstead of#mykey:myvalue. DogStatsD supports such tagging. -
is_monotonic_counter(default value is false): Set all counter-type metrics the statsd receiver received as monotonic. -
timer_histogram_mapping:(default value is below): Specify what OTLP type to convert received timing/histogram data to.
"statsd_type" specifies received Statsd data type. Possible values for this setting are "timing", "timer", "histogram" and "distribution".
"observer_type" specifies OTLP data type to convert to. We support "gauge", "summary", and "histogram". For "gauge", it does not perform any aggregation.
For "summary, the statsD receiver will aggregate to one OTLP summary metric for one metric description (the same metric name with the same tags). By default, it will send percentile 0, 10, 50, 90, 95, 100 to the downstream. The "histogram" setting selects an auto-scaling exponential histogram configured with only a maximum size, as shown in the example below unless it matches the configured explicit_buckets matcher pattern.
TODO: Add a new option to use a smoothed summary like Prometheus: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/3261
Example:
Aggregation
Aggregation is done in statsD receiver. The default aggregation interval is 60s. The receiver only aggregates the metrics with the same metric name, metric type, label keys and label values. After each aggregation interval, the receiver will send all metrics (after aggregation) in this aggregation interval to the following workflow. It supports: Counter(transferred to int):- statsdTestMetric1:3000|c|#mykey:myvalue statsdTestMetric1:4000|c|#mykey:myvalue (get the value after incrementation: 7000)
- statsdTestMetric1:3000|c|#mykey:myvalue statsdTestMetric1:20|c|@0.25|#mykey:myvalue (get the value after incrementation with sample rate: 3000+20/0.25=3080)
- statsdTestMetric1:500|g|#mykey:myvalue statsdTestMetric1:400|g|#mykey:myvalue (get the latest value: 400)
- statsdTestMetric1:500|g|#mykey:myvalue statsdTestMetric1:+2|g|#mykey:myvalue statsdTestMetric1:-1|g|#mykey:myvalue (get the value after calculation: 501)
Metrics
General format is:<name>:<value>|<type>|@<sample-rate>|#<tag1-key>:<tag1-value>,<tag2-k/v>
Counter
<name>:<value>|c|@<sample-rate>|#<tag1-key>:<tag1-value>
It supports sample rate. When a sample rate is provided (between 0 and 1), the receiver divides the counter value by the sample rate during aggregation to estimate the actual count. For example, a counter value of 20 with sample rate 0.25 results in an estimated count of 80 (20 ÷ 0.25).
Note: Currently, the sample rate is applied during aggregation and the adjusted value is exported. If OTLP adds native support for sample rate as a metric parameter in the future, the implementation may be updated to preserve the original sample rate information.
Gauge
<name>:<value>|g|@<sample-rate>|#<tag1-key>:<tag1-value>
Timer
<name>:<value>|ms|@<sample-rate>|#<tag1-key>:<tag1-value>
<name>:<value>|h|@<sample-rate>|#<tag1-key>:<tag1-value>
It supports sample rate.
Testing
Full sample collector config
Send StatsD message into the receiver
A simple way to send a metric tolocalhost:8125:
Configuration
Example Configuration
Last generated: 2026-04-13