influxdata / influxdata/telegraf

inputs.statsd: Add optional per-counter event count field independent of counter increment value

Open
#18,693 0 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

### Use Case

I ingest StatsD counters where a single event can increment by values greater than 1 (for example `metric:2|c`, `metric:5|c`).
I can compute rate in post-processing from the counter sum, but I also need the number of counter events received per metric per gather window.
I cannot change the application instrumentation to emit a second `*_count:1|c` metric, so this needs to be handled in Telegraf `inputs.statsd`.

### Expected behavior

For counter metrics (|c), Telegraf should provide an optional field that tracks event occurrences (number of counter updates received), not only the summed counter value.
Example option (name open to maintainers):

`counter_event_count = true`
When enabled, output for a counter metric should include:
`value = sum of increments (existing behavior)`
`event_count = number of counter packets/events seen in the gather interval`
This should work regardless of increment size (1, 2, 10, etc.), with no app-side change required.

### Actual behavior

`inputs.statsd` only emits the aggregated counter sum (value) for |c metrics.
No per-metric event count field is emitted.
If increment values vary, event count cannot be derived from value alone (for example total 3 can be 3 once or 1+2).
So today there is no accurate way to get per-counter event count without changing app instrumentation or modifying the plugin.

### Additional info

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the Telegraf inputs.statsd plugin and its counter aggregation path, then review the existing configuration and tests for StatsD counters. Define the optional event-count behavior and configuration name with maintainers, ensuring increments of different sizes are counted as separate events. Done means enabled counters expose both the existing sum and the number of received counter events without changing default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.