Skip to content

Commit fab24fb

Browse files
authored
Merge pull request #9848 from wenjiaswe/automated-cherry-pick-of-#8960-upstream-release-3.1
Automated cherry pick of #8960
2 parents 06da6cf + b3ee996 commit fab24fb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

etcdserver/metrics.go

+13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"time"
1919

2020
"github.com/coreos/etcd/pkg/runtime"
21+
"github.com/coreos/etcd/version"
2122
"github.com/prometheus/client_golang/prometheus"
2223
)
2324

@@ -64,6 +65,13 @@ var (
6465
Name: "proposals_failed_total",
6566
Help: "The total number of failed proposals seen.",
6667
})
68+
currentVersion = prometheus.NewGaugeVec(prometheus.GaugeOpts{
69+
Namespace: "etcd",
70+
Subsystem: "server",
71+
Name: "version",
72+
Help: "Which version is running. 1 for 'server_version' label with current version.",
73+
},
74+
[]string{"server_version"})
6775
)
6876

6977
func init() {
@@ -74,6 +82,11 @@ func init() {
7482
prometheus.MustRegister(proposalsApplied)
7583
prometheus.MustRegister(proposalsPending)
7684
prometheus.MustRegister(proposalsFailed)
85+
prometheus.MustRegister(currentVersion)
86+
87+
currentVersion.With(prometheus.Labels{
88+
"server_version": version.Version,
89+
}).Set(1)
7790
}
7891

7992
func monitorFileDescriptor(done <-chan struct{}) {

0 commit comments

Comments
 (0)