-
Notifications
You must be signed in to change notification settings - Fork 672
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
Add label user to process collector #1472
base: master
Are you sure you want to change the base?
Add label user to process collector #1472
Conversation
Signed-off-by: Andrey Burtasov <[email protected]>
Signed-off-by: Andrey Burtasov <[email protected]>
…ows_exporter into feature/collector/process
Signed-off-by: Andrey Burtasov <[email protected]>
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 tested this PR on my local system and it works.
However, I see that the collector is 10 times slower compared to master branch.
master:
windows_exporter_collector_duration_seconds{collector="process"} 0.0121184
PR:
windows_exporter_collector_duration_seconds{collector="process"} 0.1610989
Thats to much. I have provide some suggestions, I hope they help. After apply the suggestion, verify locally, if everything still works as expected.
pkg/collector/process/process.go
Outdated
|
||
err := wmi.Query(win32LoggedOnUserQuery, &users) | ||
if err != nil { | ||
fmt.Println(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.
If the error occurs, the error should be returned as return value. Currently, there is just printed and the function continue, result into more errors.
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.
Done
pkg/collector/process/process.go
Outdated
|
||
err = wmi.Query(win32SessionProcessQuery, &sessionProcesses) | ||
if err != nil { | ||
fmt.Println(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.
If the error occurs, the error should be returned as return value. Currently, there is just printed and the function continue, result into more errors.
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.
Done
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 tested this PR on my local system and it works.
However, I see that the collector is 10 times slower compared to master branch.
master:
windows_exporter_collector_duration_seconds{collector="process"} 0.0121184
PR:
windows_exporter_collector_duration_seconds{collector="process"} 0.1610989
Thats to much. I have provide some suggestions, I hope they help. After apply the suggestion, verify locally, if everything still works as expected.
…rter into feature/collector/process
Signed-off-by: Andrey Burtasov <[email protected]>
@jkroepke After the changes, it still works, but I'm not sure it improved the speed |
Hey @aburtasov I looked into it and in term of performance, it overhead compared to the first version is low now. However, I would also looked into it, if I can avoid the WMI query. Thats something, what I will looked into it. |
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Please take a look, if it still works for you. |
Added label "user" to process collector. Using WIN32_LoggedOnUser and Win32_SessionProcess
Example metric with new label:
HELP windows_process_cpu_time_total Returns elapsed time that all of the threads of this process used the processor to execute instructions by mode (privileged, user).
TYPE windows_process_cpu_time_total counter
windows_process_cpu_time_total{creating_process_id="12244",mode="privileged",process="powershell",process_id="17512",user="MYDOMAIN\aburtasov"} 0.296875
windows_process_cpu_time_total{creating_process_id="12244",mode="privileged",process="powershell",process_id="19688",user="MYDOMAIN\aburtasov"} 14.296875
windows_process_cpu_time_total{creating_process_id="12244",mode="privileged",process="powershell",process_id="25612",user="MYDOMAIN\aburtasov"} 0.484375