mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-30 15:12:27 -08:00
Merge pull request #882 from prometheus/export-buildinfo
Export build information as metric.
This commit is contained in:
commit
a5093e08a0
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
package version
|
package version
|
||||||
|
|
||||||
|
import "github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
// Build information. Populated at build-time.
|
// Build information. Populated at build-time.
|
||||||
var (
|
var (
|
||||||
Version string
|
Version string
|
||||||
|
@ -32,3 +34,16 @@ var Map = map[string]string{
|
||||||
"buildDate": BuildDate,
|
"buildDate": BuildDate,
|
||||||
"goVersion": GoVersion,
|
"goVersion": GoVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
buildInfo := prometheus.NewGaugeVec(
|
||||||
|
prometheus.GaugeOpts{
|
||||||
|
Name: "prometheus_build_info",
|
||||||
|
Help: "A metric with a constant '1' value labeled by version, revision, and branch from which Prometheus was built.",
|
||||||
|
},
|
||||||
|
[]string{"version", "revision", "branch"},
|
||||||
|
)
|
||||||
|
buildInfo.WithLabelValues(Version, Revision, Branch).Set(1)
|
||||||
|
|
||||||
|
prometheus.MustRegister(buildInfo)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue