Skip to content

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

@a-moussaoui

Description

@a-moussaoui

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new plugin and for new features to existing plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions