From bd634905a2c501188b1528a2bd4b5b166a68b140 Mon Sep 17 00:00:00 2001 From: idoko Date: Thu, 17 Oct 2024 08:09:43 +0100 Subject: [PATCH] fix tests --- collector/textfile_test.go | 2 +- go.mod | 4 ++-- go.sum | 4 ++-- node_exporter.go | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/collector/textfile_test.go b/collector/textfile_test.go index 8ec2584756..d759dfaf95 100644 --- a/collector/textfile_test.go +++ b/collector/textfile_test.go @@ -20,12 +20,12 @@ import ( "os" "testing" + "github.com/alecthomas/kingpin/v2" "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/promlog" "github.com/prometheus/common/promlog/flag" - "gopkg.in/alecthomas/kingpin.v2" ) type collectorAdapter struct { diff --git a/go.mod b/go.mod index b43f12724c..5bc9d8b85f 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/prometheus/node_exporter go 1.23 require ( + github.com/alecthomas/kingpin/v2 v2.4.0 github.com/beevik/ntp v1.3.1 github.com/coreos/go-systemd/v22 v22.5.0 github.com/dennwc/btrfs v0.0.0-20220403080356-b3db0b2dedac @@ -20,7 +21,7 @@ require ( github.com/montanaflynn/stats v0.7.1 github.com/opencontainers/selinux v1.11.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.20.4 + github.com/prometheus/client_golang v1.20.5 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.60.0 github.com/prometheus/exporter-toolkit v0.7.2 @@ -34,7 +35,6 @@ require ( ) require ( - github.com/alecthomas/kingpin/v2 v2.4.0 // indirect github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/beorn7/perks v1.0.1 // indirect diff --git a/go.sum b/go.sum index 44a927b64a..67c9fc25e6 100644 --- a/go.sum +++ b/go.sum @@ -216,8 +216,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= -github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/node_exporter.go b/node_exporter.go index 1ee7284999..597aec579b 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -25,16 +25,17 @@ import ( "github.com/prometheus/common/promlog" "github.com/prometheus/common/promlog/flag" + "github.com/alecthomas/kingpin/v2" "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" promcollectors "github.com/prometheus/client_golang/prometheus/collectors" + collectorversion "github.com/prometheus/client_golang/prometheus/collectors/version" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/version" "github.com/prometheus/exporter-toolkit/web" "github.com/prometheus/node_exporter/collector" _ "github.com/prometheus/node_exporter/percona/perconacollector" - kingpin "gopkg.in/alecthomas/kingpin.v2" ) // handler wraps an unfiltered http.Handler but uses a filtered handler, @@ -118,7 +119,7 @@ func (h *handler) innerHandler(filters ...string) (http.Handler, error) { } r := prometheus.NewRegistry() - r.MustRegister(version.NewCollector("node_exporter")) + r.MustRegister(collectorversion.NewCollector("node_exporter")) if err := r.Register(nc); err != nil { return nil, fmt.Errorf("couldn't register node collector: %s", err) }