Merge pull request #9845 from wenjiaswe/automated-cherry-pick-of-#8960-upstream-release-3.2

Automated cherry pick of #8960
This commit is contained in:
Gyuho Lee 2018-06-13 16:02:48 -07:00 committed by GitHub
commit 5e6adfac06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ import (
"time"
"github.com/coreos/etcd/pkg/runtime"
"github.com/coreos/etcd/version"
"github.com/prometheus/client_golang/prometheus"
)
@ -70,6 +71,13 @@ var (
Name: "lease_expired_total",
Help: "The total number of expired leases.",
})
currentVersion = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "etcd",
Subsystem: "server",
Name: "version",
Help: "Which version is running. 1 for 'server_version' label with current version.",
},
[]string{"server_version"})
)
func init() {
@ -81,6 +89,11 @@ func init() {
prometheus.MustRegister(proposalsPending)
prometheus.MustRegister(proposalsFailed)
prometheus.MustRegister(leaseExpired)
prometheus.MustRegister(currentVersion)
currentVersion.With(prometheus.Labels{
"server_version": version.Version,
}).Set(1)
}
func monitorFileDescriptor(done <-chan struct{}) {