From c12b90f0cd31af1580e6273c7e8acbc712254fde Mon Sep 17 00:00:00 2001 From: a Date: Tue, 25 Oct 2022 22:43:00 -0500 Subject: [PATCH] add debug endpoint --- cmd/otter/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/otter/server.go b/cmd/otter/server.go index 1814510..3188a8e 100644 --- a/cmd/otter/server.go +++ b/cmd/otter/server.go @@ -10,6 +10,7 @@ import ( "gfx.cafe/open/4bytes/triemap" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" + "github.com/ledgerwatch/erigon/common/debug" "github.com/wmitsuda/otterscan/cmd/otter/cli/httpcfg" "github.com/wmitsuda/otterscan/lib/resources" ) @@ -23,6 +24,9 @@ func RouteServer(r chi.Router, cfg httpcfg.HttpCfg) { r.HandleFunc("/topic0/{hash}", triemap.HttpHandler(topics.Both)) r.Handle("/chains/{chainId}", http.FileServer(resources.ChainsServer)) r.Handle("/tokens/{chainId}/{address}/logo.png", http.FileServer(resources.AssetsServer)) + r.HandleFunc("/memstats", func(w http.ResponseWriter, r *http.Request) { + debug.PrintMemStats(false) + }) r.HandleFunc("/config.json", func(w http.ResponseWriter, r *http.Request) { json.NewEncoder(w).Encode(map[string]any{ "erigonURL": cfg.OtsRpcDaemonUrl,