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

Updates #cleanup

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
pull/11249/head
Anton Tolchanov 9 months ago committed by Kristoffer Dalby
parent 34de96d06e
commit 4aff179064
No known key found for this signature in database

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

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

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

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

Loading…
Cancel
Save