influxdata / influxdata/telegraf
Add option to choose which statsd timing fields to compute
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
Description
### Use Case
Hello,
In statsd input plugin, for all timing input metics, there is some fields that are computed regardless we need it or not.
```
fields[prefix+"mean"] = stats.mean()
fields[prefix+"median"] = stats.median()
fields[prefix+"stddev"] = stats.stddev()
fields[prefix+"sum"] = stats.sum()
fields[prefix+"upper"] = stats.upper()
fields[prefix+"lower"] = stats.lower()
```
Due to this computations, the CPU consuption is very high in my use case, even higher than statsd javasript.
Is it possible to give an option to specify with fields we want it to be computed, like:
`calculated_timing_metrics: ["count", "stddev", "mean", "sum"] `
impacted file: `plugins/inputs/statsd/statsd.go` [link](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/statsd/statsd.go#L360)
Thank you
### Expected behavior
For timing metrics, only the specified fields are computed, that should result into optimization of CPU consuption
### Actual behavior
All timing fields are computed, except for percentile that we can deactivate if we dont need them.
### Additional info
_No response_
Contributor guide
Research direction
Start in plugins/inputs/statsd/statsd.go at the timing-field assignments for mean, median, stddev, sum, upper, and lower. Trace the plugin's configuration and timing-metric entry points, then verify that selecting fields limits computation while preserving existing behavior for unspecified options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- data, performance
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100