-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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(inputs.procstat): Allow Multi filter #14815
Conversation
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 |
@tguenneguez thanks for looking into this and thanks for your contribution. I think using statefull PID finders (i.e. internal variables) is not a good solution because this has proven to get complicated over time. Instead I would propose to add one or multiple type Filter struct {
Exec string
...
Recursive bool
} and then change the PID finders to process those filters. For So this is a larger restructuring of the plugin. My proposal is to implement this for pgrep-only first and check if that works as I think the combination of command-line args should be easier. Duplicate code where necessary. Afterwards we can, in a second PR, also do it for the native finder... What do you think? |
Good morning, I understand your thinking, but I see 2 objections:
On the other hand, with pgrep, we do not deport the process search to the arguments provided so the filtering is carried out by pgrep directly. Finally, if we go in this direction, the "exec" filtering is not fair. Good reflection |
@tguenneguez thanks for your thoughts! Regarding the naming etc, this should really be an independent PR! Regarding your concerns/objections:
The idea is to keep the old way around and add this feature without breaking the existing output if you use the old way of configuration. I'm emphasizing this as changing current code-paths has the risk of unexpected side-effects. If for example now people specified multiple criteria, only one of those "wins" and is used, all others are silently ignored. If you now change that, people will suddenly get different results. Furthermore, with the current "flat" configuration it is kind of unclear what the emitted "aggregation metrics" really aggregate...
Well that's also not possible today. :-) You can set tags per plugin-instance which is what most people want. You can still extend this per emitted metric using processors (e.g. the lookup processor). |
Hello @srebhan
Other think, about using pgrep first. I think this is not good for some case : On the other hand, your proposal requires (it seems to me a very big development) that I could not take care of... |
I didn't mean to suggest
The second approach is more consistent and less expensive and would be my preferred one, i.e. the one I suggest. |
Good morning, If you look at the code is developed in this direction. Thanks |
@tguenneguez I drafted a PoC of my idea in #14948. What do you think? |
# pid_finder = "pgrep" | ||
|
||
## allow to search processus by multiple criterias (only exe, pattern, user) |
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.
Typo? s/processus/processes/
## Method to use when finding process IDs. Can be one of 'pgrep', or | ||
## 'native'. The pgrep finder calls the pgrep executable in the PATH while | ||
## the native finder performs the search directly in a manor dependent on the | ||
## platform. Default is 'pgrep' | ||
# pid_finder = "pgrep" | ||
|
||
## allow to search processus by multiple criterias (only exe, pattern, user) |
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.
Typo? s/processus/processes/
I'm going to close this PR while we continue to work through Sven's in #14948. We need to come to an agreement on the expected behavior and desire for these filters over there. |
Summary
Add new option "multi_criterias" to be able to search process with multiples criterias.
For exemple :
It's possible with somethink like :
Checklist
Related issues
#6174