Open matthijskooijman opened 2 years ago
@matthijskooijman I think adding this option makes sense, putting it behind a configuration option would be best. Would you be able to open a pull request perhaps?
@sspaink I won't have time for a PR, I'm afraid.
Use Case
I'm using the derivative plugin to calculate instantaneous power (in W) from the meter pulse count (in kWh).
The input plugin only produces a kWh measurement whenever the value increases (LED pulse on the meter seen). This means that when no power is being consumed, no measurements are produced.
Expected behavior
If there is not enough info to produce an aggregate (i.e. no or only one input measurements), the plugin should produce an aggregate with a zero rate.
This is probably not wanted for all usecases, so I suppose it should be controlled by a configuration option (disabled by default).
Actual behavior
When the derivative plugin has just one measurement to work with (e.g. rolled over from the previous period and no measurements in the current period), it outputs https://github.com/influxdata/telegraf/blob/5b48f5da8c4c9edaec7b2e2e5c10c1bef2b217a6/plugins/aggregators/derivative/derivative.go#L122 instead of producing an aggregate.
When the derivative has no measurements to work with (i.e.
max_roll_over
was exceeded and no new input measurements came in), it simply skips the metric entirely.In both cases, no measurement is generated, meaning the last non-zero value that was produced will stay in the database as the most recent value.
Additional info
No response