Skip to content

Commit

Permalink
Merge pull request #9848 from wenjiaswe/automated-cherry-pick-of-#896…
Browse files Browse the repository at this point in the history
…0-upstream-release-3.1

Automated cherry pick of #8960
  • Loading branch information
gyuho committed Jun 13, 2018
2 parents 06da6cf + b3ee996 commit fab24fb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions etcdserver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"time"

"github.com/coreos/etcd/pkg/runtime"
"github.com/coreos/etcd/version"
"github.com/prometheus/client_golang/prometheus"
)

Expand Down Expand Up @@ -64,6 +65,13 @@ var (
Name: "proposals_failed_total",
Help: "The total number of failed proposals seen.",
})
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() {
Expand All @@ -74,6 +82,11 @@ func init() {
prometheus.MustRegister(proposalsApplied)
prometheus.MustRegister(proposalsPending)
prometheus.MustRegister(proposalsFailed)
prometheus.MustRegister(currentVersion)

currentVersion.With(prometheus.Labels{
"server_version": version.Version,
}).Set(1)
}

func monitorFileDescriptor(done <-chan struct{}) {
Expand Down

0 comments on commit fab24fb

Please sign in to comment.