From f9adbcb236464500f966081f29e179e4712554f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Mon, 9 Dec 2024 19:07:04 +0100 Subject: [PATCH] process: fix metric labels for multiple process instances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- cmd/windows_exporter/main.go | 6 +++--- pkg/collector/collection.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/windows_exporter/main.go b/cmd/windows_exporter/main.go index 99e3fc63d..63a47d10c 100644 --- a/cmd/windows_exporter/main.go +++ b/cmd/windows_exporter/main.go @@ -20,6 +20,9 @@ package main //goland:noinspection GoUnsortedImport //nolint:gofumpt import ( + // Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts. + "github.com/prometheus-community/windows_exporter/internal/windowsservice" + "context" "errors" "fmt" @@ -34,9 +37,6 @@ import ( "strings" "time" - // Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts. - "github.com/prometheus-community/windows_exporter/internal/windowsservice" - "github.com/alecthomas/kingpin/v2" "github.com/prometheus-community/windows_exporter/internal/config" "github.com/prometheus-community/windows_exporter/internal/httphandler" diff --git a/pkg/collector/collection.go b/pkg/collector/collection.go index 8a47067ae..c79f36386 100644 --- a/pkg/collector/collection.go +++ b/pkg/collector/collection.go @@ -226,7 +226,7 @@ func (c *Collection) Build(logger *slog.Logger) error { close(errCh) - var errs []error + errs := make([]error, 0, len(c.collectors)) for err := range errCh { if errors.Is(err, perfdata.ErrNoData) ||