daemon: env var for autostarting pprof endpoint

This commit is contained in:
Christian Schwarz
2019-09-07 19:50:57 +02:00
parent a0cf9cff2a
commit 921b34235e
2 changed files with 19 additions and 0 deletions
+7
View File
@@ -16,6 +16,7 @@ import (
"github.com/zrepl/zrepl/daemon/job"
"github.com/zrepl/zrepl/daemon/nethelpers"
"github.com/zrepl/zrepl/logger"
"github.com/zrepl/zrepl/util/envconst"
"github.com/zrepl/zrepl/version"
"github.com/zrepl/zrepl/zfs"
)
@@ -86,6 +87,12 @@ func (j *controlJob) Run(ctx context.Context) {
}
pprofServer := NewPProfServer(ctx)
if listen := envconst.String("ZREPL_DAEMON_AUTOSTART_PPROF_SERVER", ""); listen != "" {
pprofServer.Control(PprofServerControlMsg{
Run: true,
HttpListenAddress: listen,
})
}
mux := http.NewServeMux()
mux.Handle(ControlJobEndpointPProf,