2023-09-25 15:24:17 +00:00
|
|
|
package diagnostics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/ledgerwatch/erigon/turbo/node"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Setup(ctx *cli.Context, metricsMux *http.ServeMux, node *node.ErigonNode) {
|
|
|
|
debugMux := http.NewServeMux()
|
|
|
|
|
|
|
|
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)
|
2023-09-28 13:02:02 +00:00
|
|
|
SetupPeersAccess(ctx, debugMux, node)
|
|
|
|
|
2023-09-25 15:24:17 +00:00
|
|
|
}
|