-
Notifications
You must be signed in to change notification settings - Fork 10
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
Added pprof profiling to monitor heap memory #318
base: master
Are you sure you want to change the base?
Conversation
cmd/service/metro/metro.go
Outdated
logger.Ctx(ctx).Infow("initialising pprof profiles") | ||
go func() { | ||
if componentName == Web { | ||
http.ListenAndServe("metro-web-pprof.concierge.stage.razorpay.in:8080", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found an HTTP server without TLS. Use 'http.ListenAndServeTLS' instead. See https://golang.org/pkg/net/http/#ListenAndServeTLS for more information.
🔴 Fix or ignore this finding to merge your pull request.🙈 From go.lang.security.audit.net.use-tls.use-tls.
cmd/service/metro/metro.go
Outdated
if componentName == Web { | ||
http.ListenAndServe("metro-web-pprof.concierge.stage.razorpay.in:8080", nil) | ||
} else if componentName == Worker { | ||
http.ListenAndServe("metro-worker-pprof.concierge.stage.razorpay.in:8080", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The profiling 'pprof' endpoint is automatically exposed on /debug/pprof. This could leak information about the server. Instead, use import "net/http/pprof"
. See https://www.farsightsecurity.com/blog/txt-record/go-remote-profiling-20161028/ for more information and mitigation.
🙈 From go.lang.security.audit.net.pprof.pprof-debug-exposure.
cmd/service/metro/metro.go
Outdated
if componentName == Web { | ||
http.ListenAndServe("metro-web-pprof.concierge.stage.razorpay.in:8080", nil) | ||
} else if componentName == Worker { | ||
http.ListenAndServe("metro-worker-pprof.concierge.stage.razorpay.in:8080", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found an HTTP server without TLS. Use 'http.ListenAndServeTLS' instead. See https://golang.org/pkg/net/http/#ListenAndServeTLS for more information.
🔴 Fix or ignore this finding to merge your pull request.🙈 From go.lang.security.audit.net.use-tls.use-tls.
cmd/service/metro/metro.go
Outdated
logger.Ctx(ctx).Infow("initialising pprof profiles") | ||
go func() { | ||
if componentName == Web { | ||
http.ListenAndServe("metro-web-pprof.concierge.stage.razorpay.in:8080", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The profiling 'pprof' endpoint is automatically exposed on /debug/pprof. This could leak information about the server. Instead, use import "net/http/pprof"
. See https://www.farsightsecurity.com/blog/txt-record/go-remote-profiling-20161028/ for more information and mitigation.
🙈 From go.lang.security.audit.net.pprof.pprof-debug-exposure.
logger.Ctx(ctx).Infow("initialising pprof profiles") | ||
go func() { | ||
myMux := http.DefaultServeMux | ||
if err := http.ListenAndServe("localhost:8080", myMux); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found an HTTP server without TLS. Use 'http.ListenAndServeTLS' instead. See https://golang.org/pkg/net/http/#ListenAndServeTLS for more information.
🔴 Fix or ignore this finding to merge your pull request.🙈 From go.lang.security.audit.net.use-tls.use-tls.
Codecov Report
@@ Coverage Diff @@
## master #318 +/- ##
==========================================
- Coverage 59.28% 59.26% -0.03%
==========================================
Files 124 124
Lines 9506 9506
==========================================
- Hits 5636 5634 -2
- Misses 3515 3516 +1
- Partials 355 356 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
"net/http" | ||
|
||
// blank import added for testing. | ||
_ "net/http/pprof" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
G108: Profiling endpoint is automatically exposed on /debug/pprof (gosec)
@@ -119,3 +126,14 @@ | |||
|
|||
logger.Ctx(ctx).Infow("stopped metro") | |||
} | |||
|
|||
// sets up pprof profile for perfomance monitoring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶perfomance
is a misspelling of performance
(misspell)
|
||
// sets up pprof profile for perfomance monitoring | ||
func setPprofProfiles(ctx context.Context, componentName string) { | ||
logger.Ctx(ctx).Infow("initialising pprof profiles") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶initialising
is a misspelling of initializing
(misspell)
No description provided.