embed: enable extensive metrics if specified
parent
65464838ba
commit
a535c01050
|
@ -41,6 +41,7 @@ import (
|
||||||
"github.com/coreos/etcd/rafthttp"
|
"github.com/coreos/etcd/rafthttp"
|
||||||
|
|
||||||
"github.com/coreos/pkg/capnslog"
|
"github.com/coreos/pkg/capnslog"
|
||||||
|
"github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||||
"github.com/soheilhy/cmux"
|
"github.com/soheilhy/cmux"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/keepalive"
|
"google.golang.org/grpc/keepalive"
|
||||||
|
@ -523,6 +524,10 @@ func (e *Etcd) serveClients() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Etcd) serveMetrics() (err error) {
|
func (e *Etcd) serveMetrics() (err error) {
|
||||||
|
if e.cfg.Metrics == "extensive" {
|
||||||
|
grpc_prometheus.EnableHandlingTimeHistogram()
|
||||||
|
}
|
||||||
|
|
||||||
if len(e.cfg.ListenMetricsUrls) > 0 {
|
if len(e.cfg.ListenMetricsUrls) > 0 {
|
||||||
metricsMux := http.NewServeMux()
|
metricsMux := http.NewServeMux()
|
||||||
etcdhttp.HandleMetricsHealth(metricsMux, e.Server)
|
etcdhttp.HandleMetricsHealth(metricsMux, e.Server)
|
||||||
|
|
|
@ -40,7 +40,6 @@ import (
|
||||||
"github.com/coreos/etcd/version"
|
"github.com/coreos/etcd/version"
|
||||||
|
|
||||||
"github.com/coreos/pkg/capnslog"
|
"github.com/coreos/pkg/capnslog"
|
||||||
"github.com/grpc-ecosystem/go-grpc-prometheus"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -179,10 +178,6 @@ func startEtcdOrProxyV2() {
|
||||||
|
|
||||||
// startEtcd runs StartEtcd in addition to hooks needed for standalone etcd.
|
// startEtcd runs StartEtcd in addition to hooks needed for standalone etcd.
|
||||||
func startEtcd(cfg *embed.Config) (<-chan struct{}, <-chan error, error) {
|
func startEtcd(cfg *embed.Config) (<-chan struct{}, <-chan error, error) {
|
||||||
if cfg.Metrics == "extensive" {
|
|
||||||
grpc_prometheus.EnableHandlingTimeHistogram()
|
|
||||||
}
|
|
||||||
|
|
||||||
e, err := embed.StartEtcd(cfg)
|
e, err := embed.StartEtcd(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
Loading…
Reference in New Issue