Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hubble-relay: add an option to run pprof #11465

Merged
merged 1 commit into from May 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions hubble-relay/cmd/serve/serve.go
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/cilium/cilium/pkg/hubble/relay"
"github.com/cilium/cilium/pkg/hubble/relay/relayoption"
"github.com/cilium/cilium/pkg/pprof"

"github.com/google/gops/agent"
"github.com/spf13/cobra"
Expand All @@ -30,6 +31,7 @@ import (

type flags struct {
debug bool
pprof bool
gops bool
dialTimeout time.Duration
listenAddress string
Expand All @@ -51,6 +53,9 @@ func New() *cobra.Command {
cmd.Flags().BoolVarP(
&f.debug, "debug", "D", false, "Run in debug mode",
)
cmd.Flags().BoolVar(
Copy link
Member

@sayboras sayboras May 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that there is already such an option for the cilium agent, I'd say that it'd be good to have for hubble-relay as well, yes.

&f.pprof, "pprof", false, "Enable serving the pprof debugging API",
)
cmd.Flags().BoolVar(
&f.gops, "gops", true, "Run gops agent",
)
Expand Down Expand Up @@ -83,6 +88,9 @@ func runServe(f flags) error {
if f.debug {
opts = append(opts, relayoption.WithDebug())
}
if f.pprof {
pprof.Enable()
}
if f.gops {
if err := agent.Listen(agent.Options{}); err != nil {
return fmt.Errorf("failed to start gops agent: %v", err)
Expand Down