mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: add "etcd_server_id"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
This commit is contained in:
parent
73c1100b04
commit
d1acb5a5c8
@ -110,6 +110,13 @@ var (
|
|||||||
Help: "Which Go version server is running with. 1 for 'server_go_version' label with current version.",
|
Help: "Which Go version server is running with. 1 for 'server_go_version' label with current version.",
|
||||||
},
|
},
|
||||||
[]string{"server_go_version"})
|
[]string{"server_go_version"})
|
||||||
|
serverID = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||||
|
Namespace: "etcd",
|
||||||
|
Subsystem: "server",
|
||||||
|
Name: "id",
|
||||||
|
Help: "Server or member ID in hexadecimal format. 1 for 'server_id' label with current ID.",
|
||||||
|
},
|
||||||
|
[]string{"server_id"})
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -127,6 +134,7 @@ func init() {
|
|||||||
prometheus.MustRegister(quotaBackendBytes)
|
prometheus.MustRegister(quotaBackendBytes)
|
||||||
prometheus.MustRegister(currentVersion)
|
prometheus.MustRegister(currentVersion)
|
||||||
prometheus.MustRegister(currentGoVersion)
|
prometheus.MustRegister(currentGoVersion)
|
||||||
|
prometheus.MustRegister(serverID)
|
||||||
|
|
||||||
currentVersion.With(prometheus.Labels{
|
currentVersion.With(prometheus.Labels{
|
||||||
"server_version": version.Version,
|
"server_version": version.Version,
|
||||||
|
@ -59,6 +59,8 @@ import (
|
|||||||
|
|
||||||
"github.com/coreos/go-semver/semver"
|
"github.com/coreos/go-semver/semver"
|
||||||
"github.com/coreos/pkg/capnslog"
|
"github.com/coreos/pkg/capnslog"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -435,6 +437,7 @@ func NewServer(cfg ServerConfig) (srv *EtcdServer, err error) {
|
|||||||
reqIDGen: idutil.NewGenerator(uint16(id), time.Now()),
|
reqIDGen: idutil.NewGenerator(uint16(id), time.Now()),
|
||||||
forceVersionC: make(chan struct{}),
|
forceVersionC: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
serverID.With(prometheus.Labels{"server_id": id.String()}).Set(1)
|
||||||
|
|
||||||
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
|
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user