mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Add prysm version to prometheus (#8527)
* Add prysm version to prometheus * gofmt * apply suggestion Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
parent
f973924fbf
commit
a3781e2ffc
@ -2,7 +2,10 @@ load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["version.go"],
|
||||
srcs = [
|
||||
"metrics.go",
|
||||
"version.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/shared/version",
|
||||
visibility = ["//visibility:public"],
|
||||
x_defs = {
|
||||
@ -10,4 +13,8 @@ go_library(
|
||||
"buildDate": "{DATE}",
|
||||
"gitTag": "{STABLE_GIT_TAG}",
|
||||
},
|
||||
deps = [
|
||||
"@com_github_prometheus_client_golang//prometheus:go_default_library",
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
15
shared/version/metrics.go
Normal file
15
shared/version/metrics.go
Normal file
@ -0,0 +1,15 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
var prysmInfo = promauto.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "prysm_version",
|
||||
ConstLabels: prometheus.Labels{"version": gitTag, "commit": gitCommit},
|
||||
})
|
||||
|
||||
func init() {
|
||||
prysmInfo.Set(float64(1))
|
||||
}
|
Loading…
Reference in New Issue
Block a user