Skip to content

Commit

Permalink
perfdata: fix incorrect collector log lines (prometheus-community#1626)
Browse files Browse the repository at this point in the history
Signed-off-by: astigmata <[email protected]>
  • Loading branch information
jkroepke authored and astigmata committed Sep 26, 2024
1 parent 18c0624 commit 87fcd97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/collector/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ func (p *Prometheus) execute(name string, c Collector, ctx *types.ScrapeContext,
}

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),
)

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
}
1 change: 1 addition & 0 deletions pkg/perfdata/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
// 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 {
case PERF_ELAPSED_TIME:
Expand Down

0 comments on commit 87fcd97

Please sign in to comment.