We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 505f879 commit 98fc303Copy full SHA for 98fc303
server/server.go
@@ -6,7 +6,9 @@ import (
6
"fmt"
7
"log"
8
"net/http"
9
+ _ "net/http/pprof" // pprof magic
10
"os"
11
+ "strconv"
12
"time"
13
14
"github.com/brave-intl/bat-go/middleware"
@@ -60,6 +62,17 @@ func StartServer() {
60
62
}
61
63
}()
64
65
+ // Add profiling flag to enable profiling routes.
66
+ if on, _ := strconv.ParseBool(os.Getenv("PPROF_ENABLED")); on {
67
+ // pprof attaches routes to default serve mux
68
+ // host:6061/debug/pprof/
69
+ go func() {
70
+ if err := http.ListenAndServe(":6061", http.DefaultServeMux); err != nil {
71
+ logger.WithError(err).Error("Server failed to start")
72
+ }
73
+ }()
74
75
+
76
serverCtx, r := setupRouter(serverCtx, logger, false)
77
port := ":8192"
78
fmt.Printf("Starting server: http://localhost%s", port)
0 commit comments