File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ docker build .
33
33
* ` NSM_TARGET_PORT ` - TCP/UDP target port
34
34
* ` NSM_PROTOCOL ` - TCP or UDP protocol
35
35
* ` NSM_SELECTOR ` - labels for the load balancer selector labels
36
+ * ` NSM_PPROF_ENABLED ` - is pprof enabled (default: "false")
37
+ * ` NSM_PPROF_LISTEN_ON ` - pprof URL to ListenAndServe (default: "localhost:6060")
36
38
37
39
# Testing
38
40
Original file line number Diff line number Diff line change 1
- // Copyright (c) 2023 Cisco and/or its affiliates.
1
+ // Copyright (c) 2023-2024 Cisco and/or its affiliates.
2
2
//
3
3
// Copyright (c) 2024 OpenInfra Foundation Europe. All rights reserved.
4
4
//
@@ -41,6 +41,8 @@ type Config struct {
41
41
LogLevel string `default:"INFO" desc:"Log level" split_words:"true"`
42
42
OpenTelemetryEndpoint string `default:"otel-collector.observability.svc.cluster.local:4317" desc:"OpenTelemetry Collector Endpoint" split_words:"true"`
43
43
MetricsExportInterval time.Duration `default:"10s" desc:"interval between mertics exports" split_words:"true"`
44
+ PprofEnabled bool `default:"false" desc:"is pprof enabled" split_words:"true"`
45
+ PprofListenOn string `default:"localhost:6060" desc:"pprof URL to ListenAndServe" split_words:"true"`
44
46
45
47
Port uint16 `default:"" desc:"TCP/UDP service port" split_words:"true"`
46
48
TargetPort uint16 `default:"" desc:"TCP/UDP target port" split_words:"true"`
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import (
28
28
_ "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
29
29
_ "github.com/networkservicemesh/sdk/pkg/tools/nsurl"
30
30
_ "github.com/networkservicemesh/sdk/pkg/tools/opentelemetry"
31
+ _ "github.com/networkservicemesh/sdk/pkg/tools/pprofutils"
31
32
_ "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
32
33
_ "github.com/networkservicemesh/sdk/pkg/tools/token"
33
34
_ "github.com/networkservicemesh/sdk/pkg/tools/tracing"
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ import (
60
60
"github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
61
61
"github.com/networkservicemesh/sdk/pkg/tools/nsurl"
62
62
"github.com/networkservicemesh/sdk/pkg/tools/opentelemetry"
63
+ "github.com/networkservicemesh/sdk/pkg/tools/pprofutils"
63
64
"github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
64
65
"github.com/networkservicemesh/sdk/pkg/tools/token"
65
66
"github.com/networkservicemesh/sdk/pkg/tools/tracing"
@@ -128,6 +129,13 @@ func main() {
128
129
}()
129
130
}
130
131
132
+ // ********************************************************************************
133
+ // Configure pprof
134
+ // ********************************************************************************
135
+ if c .PprofEnabled {
136
+ go pprofutils .ListenAndServe (ctx , c .PprofListenOn )
137
+ }
138
+
131
139
// ********************************************************************************
132
140
log .FromContext (ctx ).Infof ("executing phase 2: run vpp and get a connection to it (time since start: %s)" , time .Since (starttime ))
133
141
// ********************************************************************************
You can’t perform that action at this time.
0 commit comments