From cab2b2b59ec9d97edf5f7f67ea2811ec34429858 Mon Sep 17 00:00:00 2001 From: Andrew Dunham Date: Tue, 7 Feb 2023 11:43:55 -0500 Subject: [PATCH] ipn/localapi: print envknobs on bugreport Previously, we only printed these at startup; print those when the user generates a bugreport as we so we don't have to go spelunking through the logs. Signed-off-by: Andrew Dunham Change-Id: If5b0970f09fcb4cf8839958af5d37f84e0ba6ed2 --- ipn/localapi/localapi.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ipn/localapi/localapi.go b/ipn/localapi/localapi.go index 383e98133..d4e48a97f 100644 --- a/ipn/localapi/localapi.go +++ b/ipn/localapi/localapi.go @@ -316,6 +316,8 @@ func (h *Handler) serveBugReport(w http.ResponseWriter, r *http.Request) { } else { h.logf("user bugreport health: ok") } + + // Information about the current node from the netmap if nm := h.b.NetMap(); nm != nil { if self := nm.SelfNode; self != nil { h.logf("user bugreport node info: nodeid=%q stableid=%q expiry=%q", self.ID, self.StableID, self.KeyExpiry.Format(time.RFC3339)) @@ -324,6 +326,12 @@ func (h *Handler) serveBugReport(w http.ResponseWriter, r *http.Request) { } else { h.logf("user bugreport netmap: no active netmap") } + + // Print all envknobs; we otherwise only print these on startup, and + // printing them here ensures we don't have to go spelunking through + // logs for them. + envknob.LogCurrent(logger.WithPrefix(h.logf, "user bugreport: ")) + if defBool(r.URL.Query().Get("diagnose"), false) { h.b.Doctor(r.Context(), logger.WithPrefix(h.logf, "diag: ")) }