perfdata: fix incorrect collector log lines (#1626)

This commit is contained in:
Jan-Otto Kröpke
2024-09-13 22:12:10 +02:00
committed by GitHub
parent fb275a06fe
commit 2e4ba9984d
2 changed files with 3 additions and 2 deletions

View File

@@ -228,14 +228,14 @@ func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext,
} }
if err != nil { if err != nil {
p.logger.Error(fmt.Sprintf("collector %s failed after %s", name, p.maxScrapeDuration), p.logger.Error(fmt.Sprintf("collector %s failed after %s", name, duration),
slog.Any("err", err), slog.Any("err", err),
) )
return failed return failed
} }
p.logger.Error(fmt.Sprintf("collector %s succeeded after %s", name, p.maxScrapeDuration)) p.logger.Info(fmt.Sprintf("collector %s succeeded after %s", name, duration))
return success return success
} }

View File

@@ -186,6 +186,7 @@ func (c *Collector) Collect() (map[string]map[string]CounterValues, error) {
// This is a workaround for the issue with the elapsed time counter type. // This is a workaround for the issue with the elapsed time counter type.
// Source: https://github.com/prometheus-community/windows_exporter/pull/335/files#diff-d5d2528f559ba2648c2866aec34b1eaa5c094dedb52bd0ff22aa5eb83226bd8dR76-R83 // Source: https://github.com/prometheus-community/windows_exporter/pull/335/files#diff-d5d2528f559ba2648c2866aec34b1eaa5c094dedb52bd0ff22aa5eb83226bd8dR76-R83
// Ref: https://learn.microsoft.com/en-us/windows/win32/perfctrs/calculating-counter-values
switch counter.Type { switch counter.Type {
case PERF_ELAPSED_TIME: case PERF_ELAPSED_TIME: