etcdserver: add "etcd_server_id" metric

```
etcd_server_id{server_id="8e9e05c52164694d"} 1
```

Useful for automating membership change operations,
no need to run "endpoint status" or "member list"
command to get member IDs.

Also, useful for "etcd_network" metrics with "To/From" labels.

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
This commit is contained in:
Gyuho Lee
2018-08-11 22:13:41 -07:00
parent 3a037744de
commit eb6738053b
2 changed files with 10 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ import (
"github.com/coreos/go-semver/semver"
"github.com/coreos/pkg/capnslog"
humanize "github.com/dustin/go-humanize"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"
)
@@ -511,6 +512,7 @@ func NewServer(cfg ServerConfig) (srv *EtcdServer, err error) {
forceVersionC: make(chan struct{}),
AccessController: &AccessController{CORS: cfg.CORS, HostWhitelist: cfg.HostWhitelist},
}
serverID.With(prometheus.Labels{"server_id": id.String()}).Set(1)
srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}