Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: #1458 (@paologallinaharbur needs to confirm this as fix)
The old service collector via WMI query doesn't perform well.
The alternative approach (using the API direct) is an better improvement, however it needs time, because is asks each single service about state and configuration. That doesn't scale well. Additionally, admin permissions is mandatory.
I introduce a V2 collector here, because it's an breaking change in terms of metrics. (labels are different and information are omit)
The code based on https://github.com/DataDog/datadog-agent/blob/afbd8b6c87939c92610c654cb07fdfd439e4fb27/pkg/util/winutil/scmmonitor.go#L59
Performace
WMI:
windows_exporter_collector_duration_seconds{collector="service"} 0.4285152
API:
windows_exporter_collector_duration_seconds{collector="service"} 0.3175442
V2:
windows_exporter_collector_duration_seconds{collector="service"} 0.0046183