From b87396b5d91f3e3b07116bef77cc699aaad8517d Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 23 Jun 2020 13:59:48 -0700 Subject: [PATCH] cmd/derper, derp: add some more varz and consistency check handler I'm trying to hunt down a slow drift in numbers not agreeing. --- cmd/derper/derper.go | 10 +++++++++ derp/derp_server.go | 49 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/cmd/derper/derper.go b/cmd/derper/derper.go index ef7a56f52..bad33d683 100644 --- a/cmd/derper/derper.go +++ b/cmd/derper/derper.go @@ -204,6 +204,15 @@ func main() { func debugHandler(s *derp.Server) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.RequestURI == "/debug/check" { + err := s.ConsistencyCheck() + if err != nil { + http.Error(w, err.Error(), 500) + } else { + io.WriteString(w, "derp.Server ConsistencyCheck okay") + } + return + } f := func(format string, args ...interface{}) { fmt.Fprintf(w, format, args...) } f(`

DERP debug

@@ -218,6 +227,7 @@ func debugHandler(s *derp.Server) http.Handler {
  • /debug/pprof/
  • /debug/pprof/goroutine (collapsed)
  • /debug/pprof/goroutine (full)
  • +
  • /debug/check internal consistency check