feat(pprof): add pprof HTTP server (#807)

- `PPROF_ENABLED=no`
- `PPROF_BLOCK_PROFILE_RATE=0`
- `PPROF_MUTEX_PROFILE_RATE=0`
- `PPROF_HTTP_SERVER_ADDRESS=":6060"`
This commit is contained in:
Quentin McGaw
2022-01-26 17:23:55 -05:00
committed by GitHub
parent 55e609cbf4
commit 9de6428585
26 changed files with 1659 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package helpers
import (
"net"
"net/http"
"time"
"github.com/qdm12/golibs/logging"
@@ -24,6 +25,13 @@ func OverrideWithString(existing, other string) (result string) {
return other
}
func OverrideWithInt(existing, other int) (result int) {
if other == 0 {
return existing
}
return other
}
func OverrideWithStringPtr(existing, other *string) (result *string) {
if other == nil {
return existing
@@ -33,7 +41,7 @@ func OverrideWithStringPtr(existing, other *string) (result *string) {
return result
}
func OverrideWithInt(existing, other *int) (result *int) {
func OverrideWithIntPtr(existing, other *int) (result *int) {
if other == nil {
return existing
}
@@ -87,6 +95,13 @@ func OverrideWithLogLevel(existing, other *logging.Level) (result *logging.Level
return result
}
func OverrideWithHTTPHandler(existing, other http.Handler) (result http.Handler) {
if other != nil {
return other
}
return existing
}
func OverrideWithStringSlice(existing, other []string) (result []string) {
if other == nil {
return existing