1
0
Fork 0

Always-on expvar and pprof

master
Philip O'Toole 1 year ago
parent 794944f969
commit e050b9d05f

@ -131,12 +131,6 @@ type Config struct {
// DiscoConfig sets the path to any discovery configuration file. May not be set.
DiscoConfig string
// Expvar enables go/expvar information. Defaults to true.
Expvar bool
// PprofEnabled enables Go PProf information. Defaults to true.
PprofEnabled bool
// OnDiskPath sets the path to the SQLite file. May not be set.
OnDiskPath string
@ -453,8 +447,6 @@ func ParseFlags(name, desc string, build *BuildInfo) (*Config, error) {
flag.StringVar(&config.DiscoMode, "disco-mode", "", "Choose clustering discovery mode. If not set, no node discovery is performed")
flag.StringVar(&config.DiscoKey, "disco-key", "rqlite", "Key prefix for cluster discovery service")
flag.StringVar(&config.DiscoConfig, "disco-config", "", "Set discovery config, or path to cluster discovery config file")
flag.BoolVar(&config.Expvar, "expvar", true, "Serve expvar data on HTTP server")
flag.BoolVar(&config.PprofEnabled, "pprof", true, "Serve pprof data on HTTP server")
flag.StringVar(&config.OnDiskPath, "on-disk-path", "", "Path for SQLite on-disk database file. If not set, use a file in data directory")
flag.BoolVar(&config.FKConstraints, "fk", false, "Enable SQLite foreign key constraints")
flag.BoolVar(&showVersion, "version", false, "Show version information and exit")

@ -372,8 +372,6 @@ func startHTTPService(cfg *Config, str *store.Store, cltr *cluster.Client, credS
s.CertFile = cfg.HTTPx509Cert
s.KeyFile = cfg.HTTPx509Key
s.ClientVerify = cfg.HTTPVerifyClient
s.Expvar = cfg.Expvar
s.Pprof = cfg.PprofEnabled
s.DefaultQueueCap = cfg.WriteQueueCap
s.DefaultQueueBatchSz = cfg.WriteQueueBatchSz
s.DefaultQueueTimeout = cfg.WriteQueueTimeout

@ -323,9 +323,6 @@ type Service struct {
credentialStore CredentialStore
Expvar bool
Pprof bool
BuildInfo map[string]interface{}
logger *log.Logger
@ -463,9 +460,9 @@ func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case strings.HasPrefix(r.URL.Path, "/readyz"):
stats.Add(numReadyz, 1)
s.handleReadyz(w, r)
case r.URL.Path == "/debug/vars" && s.Expvar:
case r.URL.Path == "/debug/vars":
s.handleExpvar(w, r)
case strings.HasPrefix(r.URL.Path, "/debug/pprof") && s.Pprof:
case strings.HasPrefix(r.URL.Path, "/debug/pprof"):
s.handlePprof(w, r)
default:
w.WriteHeader(http.StatusNotFound)

@ -343,8 +343,6 @@ func Test_401Routes_NoBasicAuth(t *testing.T) {
m := &MockStore{}
n := &mockClusterService{}
s := New("127.0.0.1:0", m, n, c)
s.Expvar = true
s.Pprof = true
if err := s.Start(); err != nil {
t.Fatalf("failed to start service")
}
@ -386,8 +384,6 @@ func Test_401Routes_BasicAuthBadPassword(t *testing.T) {
m := &MockStore{}
n := &mockClusterService{}
s := New("127.0.0.1:0", m, n, c)
s.Expvar = true
s.Pprof = true
if err := s.Start(); err != nil {
t.Fatalf("failed to start service")
}
@ -434,8 +430,6 @@ func Test_401Routes_BasicAuthBadPerm(t *testing.T) {
m := &MockStore{}
n := &mockClusterService{}
s := New("127.0.0.1:0", m, n, c)
s.Expvar = true
s.Pprof = true
if err := s.Start(); err != nil {
t.Fatalf("failed to start service")
}

Loading…
Cancel
Save