ipn/{ipnlocal,localapi}: export varz via v2n, peerapi and localapi

Updates #cleanup

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
knyar/varz
Anton Tolchanov 4 months ago
parent e1bd7488d0
commit fd1b9e1aec

@ -752,10 +752,8 @@ func newNetstack(logf logger.Logf, sys *tsd.System) (*netstack.Impl, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Only register debug info if we have a debug mux // These are exposed via the local debug server, c2n, peerapi and localapi.
if debugMux != nil { expvar.Publish("netstack", ret.ExpVar())
expvar.Publish("netstack", ret.ExpVar())
}
return ret, nil return ret, nil
} }

@ -29,6 +29,7 @@ import (
"tailscale.com/net/sockstats" "tailscale.com/net/sockstats"
"tailscale.com/posture" "tailscale.com/posture"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
"tailscale.com/tsweb/varz"
"tailscale.com/util/clientmetric" "tailscale.com/util/clientmetric"
"tailscale.com/util/goroutines" "tailscale.com/util/goroutines"
"tailscale.com/util/set" "tailscale.com/util/set"
@ -146,6 +147,7 @@ func handleC2NDebugPrefs(b *LocalBackend, w http.ResponseWriter, r *http.Request
func handleC2NDebugMetrics(_ *LocalBackend, w http.ResponseWriter, r *http.Request) { func handleC2NDebugMetrics(_ *LocalBackend, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
varz.Handler(w, r)
clientmetric.WritePrometheusExpositionFormat(w) clientmetric.WritePrometheusExpositionFormat(w)
} }

@ -39,6 +39,7 @@ import (
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
"tailscale.com/taildrop" "tailscale.com/taildrop"
"tailscale.com/tailfs" "tailscale.com/tailfs"
"tailscale.com/tsweb/varz"
"tailscale.com/types/views" "tailscale.com/types/views"
"tailscale.com/util/clientmetric" "tailscale.com/util/clientmetric"
"tailscale.com/util/httphdr" "tailscale.com/util/httphdr"
@ -797,6 +798,7 @@ func (h *peerAPIHandler) handleServeMetrics(w http.ResponseWriter, r *http.Reque
return return
} }
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
varz.Handler(w, r)
clientmetric.WritePrometheusExpositionFormat(w) clientmetric.WritePrometheusExpositionFormat(w)
} }

@ -46,6 +46,7 @@ import (
"tailscale.com/tailfs" "tailscale.com/tailfs"
"tailscale.com/tka" "tailscale.com/tka"
"tailscale.com/tstime" "tailscale.com/tstime"
"tailscale.com/tsweb/varz"
"tailscale.com/types/key" "tailscale.com/types/key"
"tailscale.com/types/logger" "tailscale.com/types/logger"
"tailscale.com/types/logid" "tailscale.com/types/logid"
@ -545,6 +546,7 @@ func (h *Handler) serveMetrics(w http.ResponseWriter, r *http.Request) {
return return
} }
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
varz.Handler(w, r)
clientmetric.WritePrometheusExpositionFormat(w) clientmetric.WritePrometheusExpositionFormat(w)
} }

Loading…
Cancel
Save