Skip to content

Commit

Permalink
Automated cherry pick of etcd-io#8242
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjiaswe committed Mar 19, 2019
1 parent 1e5163d commit 0de9ea3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ type Config struct {

// debug

Debug bool `json:"debug"`
Debug bool `json:"debug"`
LogPkgLevels string `json:"log-package-levels"`
EnablePprof bool `json:"enable-pprof"`
Metrics string `json:"metrics"`
Expand Down
12 changes: 12 additions & 0 deletions etcdmain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ import (
"flag"
"fmt"
"io/ioutil"
"net/url"
"os"
"runtime"
"strings"

"github.com/coreos/etcd/embed"
"github.com/coreos/etcd/pkg/flags"
"github.com/coreos/etcd/pkg/types"
"github.com/coreos/etcd/version"
"github.com/ghodss/yaml"
)
Expand Down Expand Up @@ -131,6 +133,7 @@ func newConfig() *config {
fs.StringVar(&cfg.WalDir, "wal-dir", cfg.WalDir, "Path to the dedicated wal directory.")
fs.Var(flags.NewURLsValue(embed.DefaultListenPeerURLs), "listen-peer-urls", "List of URLs to listen on for peer traffic.")
fs.Var(flags.NewURLsValue(embed.DefaultListenClientURLs), "listen-client-urls", "List of URLs to listen on for client traffic.")
fs.StringVar(&cfg.ListenMetricsUrlsJSON, "listen-metrics-urls", "", "List of URLs to listen on for metrics.")
fs.UintVar(&cfg.MaxSnapFiles, "max-snapshots", cfg.MaxSnapFiles, "Maximum number of snapshot files to retain (0 is unlimited).")
fs.UintVar(&cfg.MaxWalFiles, "max-wals", cfg.MaxWalFiles, "Maximum number of wal files to retain (0 is unlimited).")
fs.StringVar(&cfg.Name, "name", cfg.Name, "Human-readable name for this member.")
Expand Down Expand Up @@ -264,6 +267,15 @@ func (cfg *config) configFromCmdLine() error {
cfg.APUrls = flags.URLsFromFlag(cfg.FlagSet, "initial-advertise-peer-urls")
cfg.LCUrls = flags.URLsFromFlag(cfg.FlagSet, "listen-client-urls")
cfg.ACUrls = flags.URLsFromFlag(cfg.FlagSet, "advertise-client-urls")

if len(cfg.ListenMetricsUrlsJSON) > 0 {
u, err := types.NewURLs(strings.Split(cfg.ListenMetricsUrlsJSON, ","))
if err != nil {
plog.Fatalf("unexpected error setting up listen-metrics-urls: %v", err)
}
cfg.ListenMetricsUrls = []url.URL(u)
}

cfg.ClusterState = cfg.clusterState.String()
cfg.Fallback = cfg.fallback.String()
cfg.Proxy = cfg.proxy.String()
Expand Down
2 changes: 1 addition & 1 deletion etcdmain/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func startProxy(cfg *config) error {
go func() {
plog.Info("proxy: listening for client requests on ", host)
mux := http.NewServeMux()
mux.Handle("/metrics", prometheus.Handler())
mux.Handle("/metrics", prometheus.Handler()) // v2 proxy just uses the same port
mux.Handle("/", ph)
plog.Fatal(http.Serve(l, mux))
}()
Expand Down
6 changes: 5 additions & 1 deletion etcdmain/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ member flags:
comma-separated whitelist of origins for CORS (cross-origin resource sharing).
--quota-backend-bytes '0'
raise alarms when backend size exceeds the given quota (0 defaults to low space quota).
--max-txn-ops '128'
maximum number of operations permitted in a transaction.
--max-request-bytes '1572864'
maximum client request size in bytes the server will accept.
--grpc-keepalive-min-time '5s'
Expand Down Expand Up @@ -174,7 +176,9 @@ profiling flags:
--enable-pprof 'false'
Enable runtime profiling data via HTTP server. Address is at client URL + "/debug/pprof/"
--metrics 'basic'
Set level of detail for exported metrics, specify 'extensive' to include histogram metrics.
Set level of detail for exported metrics, specify 'extensive' to include histogram metrics.
--listen-metrics-urls ''
List of URLs to listen on for metrics.
auth flags:
--auth-token 'simple'
Expand Down

0 comments on commit 0de9ea3

Please sign in to comment.