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

NETOBSERV-754: add pprof, improve memory footprint #449

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not start pprof listener: manager already does it
  • Loading branch information
jotak committed Oct 6, 2023
commit fa10f41b9ae0c68bc6b1727047253b96f8d1b50e
14 changes: 2 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ import (
"context"
"flag"
"fmt"
"net/http"
_ "net/http/pprof"
"os"

"go.uber.org/zap/zapcore"

"github.com/netobserv/network-observability-operator/controllers/operator"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
osv1alpha1 "github.com/openshift/api/console/v1alpha1"
Expand All @@ -52,6 +48,7 @@ import (
flowsv1beta1 "github.com/netobserv/network-observability-operator/api/v1beta1"
"github.com/netobserv/network-observability-operator/controllers"
"github.com/netobserv/network-observability-operator/controllers/constants"
"github.com/netobserv/network-observability-operator/controllers/operator"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -120,14 +117,6 @@ func main() {
os.Exit(1)
}

if pprofAddr != "" {
setupLog.WithValues("address", pprofAddr).Info("starting profiling server")
go func() {
err := http.ListenAndServe(pprofAddr, nil)
setupLog.Error(err, "stopped profiling server")
}()
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: server.Options{
Expand All @@ -136,6 +125,7 @@ func main() {
WebhookServer: webhook.NewServer(webhook.Options{
Port: 9443,
}),
PprofBindAddress: pprofAddr,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "7a7ecdcd.netobserv.io",
Expand Down