Skip to content

Commit

Permalink
Merge pull request #9108 from Quentin-M/embed_ext_metrics
Browse files Browse the repository at this point in the history
embed: enable extensive metrics if specified
  • Loading branch information
xiang90 authored Jan 7, 2018
2 parents 6546483 + a535c01 commit 6f76e46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 5 additions & 0 deletions embed/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/coreos/etcd/rafthttp"

"github.com/coreos/pkg/capnslog"
"github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/soheilhy/cmux"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
Expand Down Expand Up @@ -523,6 +524,10 @@ func (e *Etcd) serveClients() (err error) {
}

func (e *Etcd) serveMetrics() (err error) {
if e.cfg.Metrics == "extensive" {
grpc_prometheus.EnableHandlingTimeHistogram()
}

if len(e.cfg.ListenMetricsUrls) > 0 {
metricsMux := http.NewServeMux()
etcdhttp.HandleMetricsHealth(metricsMux, e.Server)
Expand Down
5 changes: 0 additions & 5 deletions etcdmain/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
"github.com/coreos/etcd/version"

"github.com/coreos/pkg/capnslog"
"github.com/grpc-ecosystem/go-grpc-prometheus"
"google.golang.org/grpc"
)

Expand Down Expand Up @@ -179,10 +178,6 @@ func startEtcdOrProxyV2() {

// startEtcd runs StartEtcd in addition to hooks needed for standalone etcd.
func startEtcd(cfg *embed.Config) (<-chan struct{}, <-chan error, error) {
if cfg.Metrics == "extensive" {
grpc_prometheus.EnableHandlingTimeHistogram()
}

e, err := embed.StartEtcd(cfg)
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit 6f76e46

Please sign in to comment.