influxdata / influxdata/telegraf
aggregators.derivative should support non-negative
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
Description
## Feature Request
### Proposal:
When calculating a derivative with the derivative aggregator plugin, calculated values can sometimes be less than zero which in many cases (such as counters) is not desired.
Proposal is to add an option to the aggregator plugin which assumes that the previous value is zero, if the current value is less than the previous value.
### Current behavior:
`aggregators.derivative` can return values which are less than zero which is not desirable in many cases.
### Desired behavior:
`aggregators.derivative` returns only positive values when configured to do so.
### Use case:
SNMP polling can return a value lower than the previous one if a device restarts, an interface is deleted+re-created, or (with some vendors) if counters are cleared.
We need this to show positive in this case - as negative is not valid.
Contributor guide
Research direction
Locate the aggregators.derivative implementation and its existing tests, then review how aggregator options are defined and configured. Implement the requested opt-in non-negative behavior and add coverage showing that a decrease in the current value produces the configured positive result while normal increases remain correct.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100