forked from ledgerwatch/erigon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.go
35 lines (28 loc) · 932 Bytes
/
setup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package diagnostics
import (
"net/http"
"strings"
"github.com/nebojsa94/erigon/turbo/node"
"github.com/urfave/cli/v2"
)
func Setup(ctx *cli.Context, metricsMux *http.ServeMux, node *node.ErigonNode) {
debugMux := http.NewServeMux()
diagnostic := NewDiagnosticClient(ctx, debugMux, node)
diagnostic.Setup()
metricsMux.HandleFunc("/debug/", func(w http.ResponseWriter, r *http.Request) {
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/debug")
r.URL.RawPath = strings.TrimPrefix(r.URL.RawPath, "/debug")
debugMux.ServeHTTP(w, r)
})
SetupLogsAccess(ctx, debugMux)
SetupDbAccess(ctx, debugMux)
SetupCmdLineAccess(debugMux)
SetupFlagsAccess(ctx, debugMux)
SetupVersionAccess(debugMux)
SetupBlockBodyDownload(debugMux)
SetupHeaderDownloadStats(debugMux)
SetupNodeInfoAccess(debugMux, node)
SetupPeersAccess(ctx, debugMux, node)
SetupBootnodesAccess(debugMux, node)
SetupStagesAccess(debugMux, diagnostic)
}