From 64e4be2865fea91cfc29eee76c80daf7f0b02046 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 15 Aug 2024 15:08:55 +0200 Subject: [PATCH] client/web: move metrics behind envvar Signed-off-by: Kristoffer Dalby --- client/web/web.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/web/web.go b/client/web/web.go index 85f549fab..9114e617a 100644 --- a/client/web/web.go +++ b/client/web/web.go @@ -41,6 +41,10 @@ import ( "tailscale.com/version/distro" ) +// TODO(kradalby): Remove this once we have landed on a final set of +// metrics to export to clients and consider the metrics stable. +var debugUsermetricsEndpoint = envknob.RegisterBool("TS_DEBUG_USER_METRICS") + // ListenPort is the static port used for the web client when run inside tailscaled. // (5252 are the numbers above the letters "TSTS" on a qwerty keyboard.) const ListenPort = 5252 @@ -284,7 +288,7 @@ func (s *Server) serve(w http.ResponseWriter, r *http.Request) { } } - if strings.HasPrefix(r.URL.Path, "/metrics") { + if debugUsermetricsEndpoint() && strings.HasPrefix(r.URL.Path, "/metrics") { usermetric.Handler(w, r) return }