chore(e2e): Added build tag for enabling pprof tracing (#5839)
* added pprof tag and make command * updated tracing readme
This commit is contained in:
1 parent
7040374b6f
commit
828148934b
6 files changed
+54
-16
No files matched your search
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
//go:build !pprof
|
||||
// +build !pprof
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func StartPprof(_ context.Context) {
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
//go:build pprof
|
||||
// +build pprof
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/event"
|
||||
|
||||
_ "net/http/pprof"
|
||||
)
|
||||
|
||||
func StartPprof(ctx context.Context) {
|
||||
const op = "base.StartPprof"
|
||||
go func() {
|
||||
const addr = "localhost:6060"
|
||||
event.WriteSysEvent(ctx, op, "starting pprof HTTP server", "addr", addr)
|
||||
if err := http.ListenAndServe(addr, nil); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
event.WriteSysEvent(ctx, op, "failed to serve pprof HTTP server", "error", err.Error())
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -722,6 +722,8 @@ func (c *Command) Run(args []string) int {
|
||||
return base.CommandCliError
|
||||
}
|
||||
|
||||
base.StartPprof(c.Context)
|
||||
|
||||
if c.flagRecoveryKey != "" {
|
||||
c.Config.DevRecoveryKey = c.flagRecoveryKey
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@ func (c *Command) Run(args []string) int {
|
||||
c.WorkerAuthDebuggingEnabled.Store(c.Config.EnableWorkerAuthDebugging)
|
||||
|
||||
base.StartMemProfiler(c.Context)
|
||||
base.StartPprof(c.Context)
|
||||
|
||||
// Note: the checks directly after this must remain where they are because
|
||||
// they rely on the state of configured KMSes.
|
||||
|
||||
Reference in new issue
Block a user