-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Refactored Windows perfmon metricset: replaced method to retrieve counter paths with PdhExpandWildCardPathW, separated code by responsibility, removed unused functions #12212
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.
Nice change, but I think we should split this PR if possible in two or three PRs, specially to make it clearer what is changed code and what was moved.
This will also need some changelog entries.
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 to see this refactoring happening.
for path, counter := range q.counters { | ||
_, value, err := PdhGetFormattedCounterValue(counter.handle, counter.format|PdhFmtNoCap100) | ||
if err != nil { | ||
rtn[path] = append(rtn[path], CounterValue{Err: err}) |
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 was reading this line and 116 / 118 a few times. Is rtn[path]
always set or could we run into a panic here?
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.
This shouldn't be a problem here, appending to a nil array works.
- Used the [PdhExpandWildCardPathW](https://docs.microsoft.com/en-us/windows/desktop/api/pdh/nf-pdh-pdhexpandwildcardpathw) func to retrieve all counter paths. Will fix elastic#10660 - Small refactoring in order to separate methods by responsability (will be usefull for the iis module as well) - Added `perfmon.append_instance_counter: true` config option in order to retrieve the full instance name (with counter)
@narph - I have checked out your pull request and built meticbeat package locally to collect Windows Perfmon Counters on a Windows-7 32 bit server, I have added a wild card query to collect Private Bytes across all the processes running, The output seems to be different now: Configuration: Output: It doesn't collect the Private Bytes for all the processes, instead it had sent only one document with the process name as '*' . I have also added 'perfmon.append_instance_counter: true' to my windows configuration. |
…eats into refactor/perfmon-queries
@prakash1243, I am getting different results here when testing locally with
Nonetheless, I have added an integration test Regarding |
Hi @narph - Here is module config: `- module: windows
|
Hi @narph - Would you mind sharing the snapshot build, which could be a huge help for me to test and let you know my findings. Thanks ! |
@prakash1243 , I believe you can download a snapshot from one of the latest CI builds here https://beats-ci.elastic.co/job/elastic+beats+master+multijob-package-linux/663/gcsObjects/ |
@narph - does this snapshot builds include the changes you had on this PR? |
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. It seems this was mostly moving core around.
Could you update the PR description accordingly?
for _, value := range config.CounterConfig { | ||
form := strings.ToLower(value.Format) | ||
switch form { | ||
case "": | ||
case "", "float": |
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.
Was this a bug before?
jenkins, test this |
Will fix recovered from panic while fetching 'windows/perfmon' for host '' ERROR in Metricbeats Windows Module #10660