...
1
16
17 package version
18
19 import (
20 "k8s.io/component-base/metrics"
21 "k8s.io/component-base/metrics/legacyregistry"
22 "k8s.io/component-base/version"
23 )
24
25 var (
26 buildInfo = metrics.NewGaugeVec(
27 &metrics.GaugeOpts{
28 Name: "kubernetes_build_info",
29 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.",
30 StabilityLevel: metrics.ALPHA,
31 },
32 []string{"major", "minor", "git_version", "git_commit", "git_tree_state", "build_date", "go_version", "compiler", "platform"},
33 )
34 )
35
36
37 func init() {
38 info := version.Get()
39 legacyregistry.MustRegister(buildInfo)
40 buildInfo.WithLabelValues(info.Major, info.Minor, info.GitVersion, info.GitCommit, info.GitTreeState, info.BuildDate, info.GoVersion, info.Compiler, info.Platform).Set(1)
41 }
42
View as plain text