From cf6dc78b3b37675a55b9562422d36308c5d16fb0 Mon Sep 17 00:00:00 2001 From: Michal Fojtik Date: Tue, 12 Nov 2019 11:22:33 +0100 Subject: [PATCH] metrics: fix registration and name of version metric --- pkg/version/version.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/version/version.go b/pkg/version/version.go index 96d352f0ad..f9f7bfb45b 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -20,7 +20,8 @@ import ( "fmt" "runtime" - "github.com/prometheus/client_golang/prometheus" + "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" "k8s.io/apimachinery/pkg/version" ) @@ -59,8 +60,8 @@ func Get() version.Info { } func init() { - buildInfo := prometheus.NewGaugeVec( - prometheus.GaugeOpts{ + buildInfo := metrics.NewGaugeVec( + &metrics.GaugeOpts{ Name: "openshift_build_info", Help: "A metric with a constant '1' value labeled by major, minor, git commit & git version from which OpenShift was built.", }, @@ -69,5 +70,5 @@ func init() { buildInfo.WithLabelValues(majorFromGit, minorFromGit, commitFromGit, versionFromGit).Set(1) // we're ok with an error here for now because test-integration illegally runs the same process - prometheus.Register(buildInfo) + legacyregistry.MustRegister(buildInfo) }