Split the version metric out to its own package

This commit is contained in:
Kris
2016-08-18 10:02:48 -07:00
parent b551bf1e5c
commit 1740358573
12 changed files with 48 additions and 16 deletions

View File

@@ -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)
}