New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(aggregators.final): Swap useful statements #15159
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the new wording is correct. Ontimeout
all metrics received within the timeout are swallow and the aggregator only outputs the last metric if it is older than the timeout! So it "fills a gap" if no metric arrived within timeout.
For downsampling you want to get the data in a fixed interval (usually with a lower frequency than the input). This is exactly what the periodic
strategy does, it outputs the last metric received at a fixed interval (the period
). Here the "age" of the metric is irrelevant.
See this post for reference how we came to this conclusion. In the use-case of the TS, the current wording is very confusing. |
This sentence is what is causing confusion. If no metrics are received within a timeout, then nothing is returned. i.e. if no metrics, a gap is produced. The text literally says to use "timeout" to fill gaps, but that is not the behavior. For example, given the following config, and if I send a single metric: [[aggregators.final]]
period = "10s"
delay = "5s"
output_strategy = "timeout" 2024-04-16T13:53:00Z D! [aggregators.final] Updated aggregation range [2024-04-16 07:53:00 -0600 MDT, 2024-04-16 07:53:10 -0600 MDT]
metric,topic=telegraf/test value=43 1713275576116715552
2024-04-16T13:53:02Z D! [outputs.file] Wrote batch of 1 metrics in 51.7µs
2024-04-16T13:53:02Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-04-16T13:53:10Z D! [aggregators.final] Updated aggregation range [2024-04-16 07:53:10 -0600 MDT, 2024-04-16 07:53:20 -0600 MDT]
2024-04-16T13:53:12Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-04-16T13:53:20Z D! [aggregators.final] Updated aggregation range [2024-04-16 07:53:20 -0600 MDT, 2024-04-16 07:53:30 -0600 MDT]
2024-04-16T13:53:22Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-04-16T13:53:30Z D! [aggregators.final] Updated aggregation range [2024-04-16 07:53:30 -0600 MDT, 2024-04-16 07:53:40 -0600 MDT]
2024-04-16T13:53:32Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics |
@powersj I agree that this can cause confusion, but the statement of this PR ## timeout -- output a metric if no new input arrived for `series_timeout`;
## useful to down sample the input data
## periodic -- output the last received metric every `period`;
## useful for filling gaps in input data is just wrong. You won't be able to downsample using |
Your definition above, is that downsampling is about periodic return of data, but I can also read downsample as taking many measurements and reducing them down to a single one. Reducing the rate at which data is transmited. If you receive 100 values during one period, and final returns only the last one, is that not a downsampling? |
@powersj the definition of downsampling references a "rate" so my take is that is equidistant. But no matter if this is true or not, the |
Unfortunately, I will disagree and state that this absolutely definition does matter. In terms of telegraf, users are generally not doing signal processing. It is probably better to reference a definition specific to metrics and data, for example from our own blog post on downsamplling. |
I want to specifically call out the following quote:
Replace "mean" with "final". Given that question from a user, what would you tell them? Use final with I would argue that you could use either, and the key difference is if you want data to fill in gaps via |
@powersj so assume a metric that really is coming at a constant rate of 1 sample per minute and use the
You can ONLY use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 👍 This pull request doesn't change the Telegraf binary size 📦 Click here to get additional PR build artifactsArtifact URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @powersj!
(cherry picked from commit fa0dbba)
Summary
The statements seem switched around currently and are causing confusion for users. Periodic is used to avoid gaps in the data, while timeout is used to only show the last value when a whole bunch come in, i.e. downsample.
https://community.influxdata.com/t/get-at-least-every-5-min-datapoint-by-mqtt-consumer/33911/8
Checklist