Skip to content

Commit

Permalink
Merge pull request openshift#43 from mfojtik/fix-metrics
Browse files Browse the repository at this point in the history
metrics: fix registration and name of version metric
  • Loading branch information
openshift-merge-robot committed Nov 13, 2019
2 parents 534bde8 + cf6dc78 commit 8b3752b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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.",
},
Expand All @@ -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)
}

0 comments on commit 8b3752b

Please sign in to comment.