Skip to content

Commit

Permalink
Merge pull request #470 from Ex4amp1e/add-pprof-enable-conf-update
Browse files Browse the repository at this point in the history
Update configuration for turning profiling on/off
  • Loading branch information
denis-tingaikin authored Aug 14, 2024
2 parents acc9394 + c62b908 commit d74fb18
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ docker build .
* `NSM_OPEN_TELEMETRY_ENDPOINT` - OpenTelemetry Collector Endpoint (default: "otel-collector.observability.svc.cluster.local:4317")
* `NSM_METRICS_EXPORT_INTERVAL` - interval between mertics exports (default: "10s")
* `NSM_PPROF_ENABLED` - is pprof enabled (default: "false")
* `NSM_PPROF_PORT` - pprof port (default: "6060")
* `NSM_PPROF_LISTEN_ON` - pprof URL to ListenAndServe (default: "localhost:6060")
* `NSM_KUBELET_QPS` - kubelet config settings (default: "205")

# Testing
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/edwarnicke/grpcfd v1.1.4
github.com/kelseyhightower/envconfig v1.4.0
github.com/networkservicemesh/sdk v0.5.1-0.20240808113433-ce2c8f56bdd3
github.com/networkservicemesh/sdk v0.5.1-0.20240812103952-7e0cf2c383fb
github.com/networkservicemesh/sdk-k8s v0.0.0-20240808144602-8fb8c883a89f
github.com/sirupsen/logrus v1.9.0
github.com/spiffe/go-spiffe/v2 v2.1.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/networkservicemesh/api v1.13.1-0.20240424210452-d0df98851760 h1:EaWGgdwbUP404Hlee80R+jSxgzjOh/tW5Fm4/9NE4B0=
github.com/networkservicemesh/api v1.13.1-0.20240424210452-d0df98851760/go.mod h1:B8FmS3XZ7NZY7ZEtdcNg2NHYppDHlr4kl4eecdZN9eI=
github.com/networkservicemesh/sdk v0.5.1-0.20240808113433-ce2c8f56bdd3 h1:EukdHtlzP75dfF3vG6kukJ0oqBhzxZKOlbKP4rAquhg=
github.com/networkservicemesh/sdk v0.5.1-0.20240808113433-ce2c8f56bdd3/go.mod h1:soFR6Mg5LTVvEI0zXNcbWoBnn4hqUK7ItZBQJ3Jbszo=
github.com/networkservicemesh/sdk v0.5.1-0.20240812103952-7e0cf2c383fb h1:p+JeHErfPxRMfF/RF2Dzx23Nr1Q5MQxvS4tvRO7S0X0=
github.com/networkservicemesh/sdk v0.5.1-0.20240812103952-7e0cf2c383fb/go.mod h1:soFR6Mg5LTVvEI0zXNcbWoBnn4hqUK7ItZBQJ3Jbszo=
github.com/networkservicemesh/sdk-k8s v0.0.0-20240808144602-8fb8c883a89f h1:926eUXIDu6drC4VcIxLXxHsynKFYsuHKs28vkXnAuGQ=
github.com/networkservicemesh/sdk-k8s v0.0.0-20240808144602-8fb8c883a89f/go.mod h1:lvKRS5MmkeplIgdNtXQSJAfQSceqJKZSRVIxSsok22g=
github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE=
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import (
"github.com/networkservicemesh/sdk/pkg/tools/grpcutils"
"github.com/networkservicemesh/sdk/pkg/tools/log"
"github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
"github.com/networkservicemesh/sdk/pkg/tools/pprof"
"github.com/networkservicemesh/sdk/pkg/tools/pprofutils"
)

// Config is configuration for cmd-registry-memory
Expand All @@ -66,7 +66,7 @@ type Config struct {
OpenTelemetryEndpoint string `default:"otel-collector.observability.svc.cluster.local:4317" desc:"OpenTelemetry Collector Endpoint" split_words:"true"`
MetricsExportInterval time.Duration `default:"10s" desc:"interval between mertics exports" split_words:"true"`
PprofEnabled bool `default:"false" desc:"is pprof enabled" split_words:"true"`
PprofPort uint16 `default:"6060" desc:"pprof port" split_words:"true"`
PprofListenOn string `default:"localhost:6060" desc:"pprof URL to ListenAndServe" split_words:"true"`
// The QPS value is calculated for 40 NSEs, 40 NSCs and 5 FWDs.
// NSC, FWD and NSE refreshes occur every second
// NSE Refreshes: 1 refresh per sec. * 40 nses
Expand Down Expand Up @@ -131,7 +131,7 @@ func main() {

// Configure pprof
if config.PprofEnabled {
go pprof.Init(ctx, config.PprofPort)
go pprofutils.ListenAndServe(ctx, config.PprofListenOn)
}

// Get a X509Source
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/imports/imports_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d74fb18

Please sign in to comment.