cpu: Fetch performance counter via PDH.dll via feature toggle. (off by default) (#1627)

This commit is contained in:
Jan-Otto Kröpke
2024-09-13 23:10:57 +02:00
committed by GitHub
parent 2e4ba9984d
commit 5f36a81613
4 changed files with 231 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
package utils
import (
"os"
"strings"
"github.com/prometheus-community/windows_exporter/pkg/types"
@@ -26,3 +27,11 @@ func ExpandEnabledCollectors(enabled string) []string {
return result
}
func PDHEnabled() bool {
if v, ok := os.LookupEnv("WINDOWS_EXPORTER_PERF_COUNTERS_ENGINE"); ok && v == "pdh" {
return true
}
return false
}