Split the version metric out to its own package
This commit is contained in:
@@ -19,8 +19,6 @@ package version
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
// Info contains versioning information.
|
||||
@@ -60,17 +58,3 @@ func Get() Info {
|
||||
func (info Info) String() string {
|
||||
return info.GitVersion
|
||||
}
|
||||
|
||||
func init() {
|
||||
buildInfo := prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "kubernetes_build_info",
|
||||
Help: "A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.",
|
||||
},
|
||||
[]string{"major", "minor", "gitVersion", "gitCommit", "gitTreeState", "buildDate", "goVersion", "compiler", "platform"},
|
||||
)
|
||||
info := Get()
|
||||
buildInfo.WithLabelValues(info.Major, info.Minor, info.GitVersion, info.GitCommit, info.GitTreeState, info.BuildDate, info.GoVersion, info.Compiler, info.Platform).Set(1)
|
||||
|
||||
prometheus.MustRegister(buildInfo)
|
||||
}
|
||||
|
Reference in New Issue
Block a user