Adding a "first" and "last" measurement option to the BasicStats aggregator
#11,097 opened on May 13, 2022
Repository metrics
- Stars
- (9,892 stars)
- PR merge metrics
- (Avg merge 2d 12h) (136 merged PRs in 30d)
Description
Feature Request
Opening a feature request kicks off a discussion.
Proposal:
Besides the current measurements, such as "min", "max" and "mean" I would like to have the "last" or "first" value out of each period being returned.
Current behavior:
This is not available currently.
Desired behavior:
Be able to specify that the "first" and/or "last" value out of all measurements in every "period" of seconds is returned out of a series of continuous measurements.
Note: the "Final" Aggregator does not work as required, as this only submits a " final" measurement if there are no measurements during a set timeout. This however does not work for continuous streams of measurements without interruptions/timeouts.
Use case:
I have measurements published on Mosquito that I wish to monitor in real-time. So the input to telegraf/Mosquitto must not be throttled. For analysis however the measurements could be reduced from 1 sample per second to once per minute.
With this new feature this could be done in memory/Telegraf before the data is written to Influx, which drastically reduces the number of writes to e.g. Influx.