Skip to content

Commit

Permalink
embed: enable extensive metrics if specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-M authored and gyuho committed Jan 8, 2018
1 parent e330f50 commit 70ba051
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 70ba051

Please sign in to comment.