#15659·vector

Vector does not add interval_ms to counters in the aggregation transform

Author: derekhuizhangCreated Dec 20, 2022Updated Sep 30, 2026
Labelstransform: aggregate

A note for the community

  • Please vote on this issue by adding a reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

If I have a statsd source and aggregate metrics over a certain ms interval using the aggregate transform, I would expect that the interval_ms would be added to the metric, but this does not seem to be the case. Why not?

  • I think it would be logical as it defines the # of counts over the defined aggregation interval.
  • A comparable system like datadog-agent should turn received counts into rates when it sends metrics to Datadog [2], and the metrics appear as a rate in Datadog. Vector sends metrics to Datadog in datadog_metrics sink as a count if interval_ms is not defined, and as a rate if interval_ms is defined [1]. Thus, all count metrics published to Vector via statsd get sent as counts to Datadog, when I would expect them to be sent as rate

I'm aware of the workaround of adding a manual Lua transform to add the interval_ms, but I think this interval_ms should be added by default

[1] https://github.com/vectordotdev/vector/blob/master/src/sinks/datadog/metrics/encoder.rs#L429 [2] https://docs.datadoghq.com/metrics/types/?tab=count#metric-types

Steps to reproduce:

  1. Download and build (./build.sh): https://github.com/derekhuizhang/statsd-firehose
  2. Run a Vector instance listening on 8125
  3. Run the firehose ./statsd-firehose -countcount 1 -countfreq 1000 -countinterval 1 -distcount 0 -histcount 0 -gaugecount 0

Looking at DD, we see that it reports 10k metrics, with counter type instead of a rate type Screen Shot 2022-12-20 at 3 59 13 PM

Configuration

data_dir = "/var/lib/vector"

[api]
enabled = true

[sources.statsd_metrics]
type = "statsd"
mode = "udp"
address = "127.0.0.1:8125"

[transforms.aggregate_metrics]
type = "aggregate"
inputs = ["statsd_metrics"]
interval_ms = 10000

[sinks.datadog]
type = "datadog_metrics"
default_api_key = <redacted>
inputs = [ "aggregate_metrics" ]

EDIT I also noticed that the gauges are not aggregated over an interval when being sent to Datadog, but it's unclear if this has any actual effect, given that I am previously aggregating over 10 seconds already.

Version

0.26.0

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response