-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat(processors.cumulative_sum): Add plugin #16629
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
feat(processors.cumulative_sum): Add plugin #16629
Conversation
34fb9ff
to
06d9196
Compare
@opengamer29 thanks for your contribution! However, I don't think this is the right thing to do here. How about creating a new processor that accumulates (cumulative sums) the values per metric-series and output the summed value for each field? This is closer to what you want and you get the absolute sample points (at least relative to Telegraf's start) in the highest frequency you want... You afterwards can still aggregate the metrics... |
@srebhan It definitely makes sense. Thank you for your feedback. I'll change this MR following your recommendation this or next week. |
f5e4d08
to
497956f
Compare
I'm not sure what should I do with that Lint plugin readmes / run-readme-linter check. It's something new and other processor plugins don't have it. It will be great to add some recommendations to contributing documentations. |
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 for the rework @opengamer29! Some comments in the code...
@opengamer29 ignore the linter issues for now, we are working on it. |
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 for the update @opengamer29! Please find my comments below. Let's first get the plugin code right and then look at the tests afterwards...
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.
Some more suggestions @opengamer29...
@opengamer29 any chance you address the comments in the near future? We would really love to ship this plugin with v1.35.0... |
I'm on vacation right now, but I will look through all the comments next week. Do you think it will work for you? |
@srebhan I’m keeping in mind my use case with Prometheus output, where I only need the cumulative sum, without retaining the original metrics. Based on your experience, do you foresee broader use cases for this processor plugin? Would it make sense to split the functionality into two separate plugins: The cumulative sum aggregator would be a perfect fit for my case — minimal memory overhead, no need for additional deduplication, and a single pass through the metrics array. The processor-based approach does look more flexible and may be useful in other use cases. However, for my use case, it’s not optimal in terms of memory usage and performance. I feel it might be more efficient and transparent to continue using a Starlark-based aggregator on my end. |
You could keep this as a processor, but then use for example See the docs on the difference between processors and aggregators. |
46b2c34
to
d39537e
Compare
Yes, using a processor combined with That's why I asked about the cumulative aggregator plugin. |
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.
Great, looks almost good!
531ff8e
to
cae565c
Compare
@opengamer29 sorry for the late reply, I'm travelling currently... Yes I do imagine a broader use of this plugin as e.g. some energy meters can only report the change between two gather cycles. So having a generic operation like the cumulative sum makes a lot of sense. This being said, we have to make sure that the operation is generic but also covers your use case. Moreover, we have to keep in mind the other plugins we have and not double functionality we already provide as this would create a maintenance nightmare over time. This being said, a Does that help? |
…ic aggregated cache
|
09801d5
to
a6cf696
Compare
You could check the actual output of the checks:
|
@Hipska Thank you for provided output. I don't have any output after And what should you do with
|
The output came from the failing checks here on GitHub. |
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 for fixing the linter issues @opengamer29! Ignore the missing metadata for now, I will add this as it is also missing for all other processors still...
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 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.
@opengamer29 Thanks for your contribution!
Summary
We collect metrics from a large amount of mobile devices and scrape aggregated data with Prometheus. We don't have a monotonic increasing without cumulative effect (like for histogram aggregator). Sum is reset based on period settings, which prevents us from building graphs with different time intervals.
This MR add a new config property to allow accumulate data for a long period of time even between resets.
Checklist
Related issues
resolves #16591