Skip to content
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

fix(inputs.procstat): Handle running processes correctly across multiple filters #16257

Merged

Conversation

philjb
Copy link
Contributor

@philjb philjb commented Dec 3, 2024

Summary

With the "new" style plugin filters, if multiple filters were used, the list of running processes was being reset on each filter iteration instead of globally. This commit fixes this by setting the running pid map outside the filter iteration. The cpu usage percentage calculation needs multiple passes of gather to calculate the difference so recreating the proc on each iteration meant it never got past the first pass.

Checklist

  • No AI generated code was used in this PR

Related issues

With the "new" style plugin filters, if multiple filters were used, the
list of running processes was being reset on each filter iteration
instead of globally. This commit fixes this by setting the running pid
map outside the filter iteration. The cpu usage percentage calculation
needs multiple passes of gather to calculate the difference so
recreating the proc on each iteration meant it never got past the first
pass.
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Dec 3, 2024

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Dec 3, 2024
@philjb
Copy link
Contributor Author

philjb commented Dec 3, 2024

!signed-cla

@srebhan srebhan changed the title fix(plugin,procstat): fix cpu usage percentage with multiple filters fix(inputs.procstat): Handle running processes correctly across multiple filters Dec 3, 2024
@telegraf-tiger telegraf-tiger bot added area/procstat plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Dec 3, 2024
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the fix @philjb!

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Dec 3, 2024
@DStrand1 DStrand1 merged commit 543b907 into influxdata:master Dec 3, 2024
29 checks passed
@github-actions github-actions bot added this to the v1.33.0 milestone Dec 3, 2024
justinwwhuang pushed a commit to justinwwhuang/telegraf_fork that referenced this pull request Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/procstat fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants