mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
feat: add perfcounter.engine CLI option as alternative to WINDOWS_EXPORTER_PERF_COUNTERS_ENGINE env (#1723)
This commit is contained in:
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||
"github.com/prometheus-community/windows_exporter/internal/toggle"
|
||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
@@ -185,7 +185,7 @@ func (c *Collector) GetName() string {
|
||||
}
|
||||
|
||||
func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) {
|
||||
if utils.PDHEnabled() {
|
||||
if toggle.IsPDHEnabled() {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ func (c *Collector) Close(_ *slog.Logger) error {
|
||||
}
|
||||
|
||||
func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
if utils.PDHEnabled() {
|
||||
if toggle.IsPDHEnabled() {
|
||||
collectorFuncs := map[string]func() error{
|
||||
adAccessProcesses: c.buildADAccessProcesses,
|
||||
transportQueues: c.buildTransportQueues,
|
||||
@@ -283,7 +283,7 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
|
||||
// Collect collects exchange metrics and sends them to prometheus.
|
||||
func (c *Collector) Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||
if utils.PDHEnabled() {
|
||||
if toggle.IsPDHEnabled() {
|
||||
return c.collectPDH(ch)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user