From ecd7dcfb0d6d1a268ad4b8c86df8f4879f3f7a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 22 May 2025 19:19:19 +0200 Subject: [PATCH] service: report invalid parameter errors as debug (#2051) --- internal/collector/service/service.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/collector/service/service.go b/internal/collector/service/service.go index a6ae3e9c..b3dae702 100644 --- a/internal/collector/service/service.go +++ b/internal/collector/service/service.go @@ -352,7 +352,9 @@ func (c *Collector) collectService(ch chan<- prometheus.Metric, serviceName stri logLevel := slog.LevelWarn - if errors.Is(err, windows.ERROR_ACCESS_DENIED) { + // ERROR_INVALID_PARAMETER returns when the process is not running. This can be happened + // if the service terminated after query the service API. + if errors.Is(err, windows.ERROR_ACCESS_DENIED) || errors.Is(err, windows.ERROR_INVALID_PARAMETER) { logLevel = slog.LevelDebug }