mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
Move pprof to metrics router (#1902)
This commit is contained in:
parent
9375b09206
commit
bd047928f7
1 changed files with 2 additions and 6 deletions
|
@ -453,7 +453,6 @@ func (h *Headscale) ensureUnixSocketIsAbsent() error {
|
||||||
func (h *Headscale) createRouter(grpcMux *grpcRuntime.ServeMux) *mux.Router {
|
func (h *Headscale) createRouter(grpcMux *grpcRuntime.ServeMux) *mux.Router {
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
router.Use(prometheusMiddleware)
|
router.Use(prometheusMiddleware)
|
||||||
router.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux)
|
|
||||||
|
|
||||||
router.HandleFunc(ts2021UpgradePath, h.NoiseUpgradeHandler).Methods(http.MethodPost)
|
router.HandleFunc(ts2021UpgradePath, h.NoiseUpgradeHandler).Methods(http.MethodPost)
|
||||||
|
|
||||||
|
@ -681,7 +680,7 @@ func (h *Headscale) Serve() error {
|
||||||
// HTTP setup
|
// HTTP setup
|
||||||
//
|
//
|
||||||
// This is the regular router that we expose
|
// This is the regular router that we expose
|
||||||
// over our main Addr. It also serves the legacy Tailcale API
|
// over our main Addr
|
||||||
router := h.createRouter(grpcGatewayMux)
|
router := h.createRouter(grpcGatewayMux)
|
||||||
|
|
||||||
httpServer := &http.Server{
|
httpServer := &http.Server{
|
||||||
|
@ -711,11 +710,10 @@ func (h *Headscale) Serve() error {
|
||||||
Msgf("listening and serving HTTP on: %s", h.cfg.Addr)
|
Msgf("listening and serving HTTP on: %s", h.cfg.Addr)
|
||||||
|
|
||||||
debugMux := http.NewServeMux()
|
debugMux := http.NewServeMux()
|
||||||
|
debugMux.Handle("/debug/pprof/", http.DefaultServeMux)
|
||||||
debugMux.HandleFunc("/debug/notifier", func(w http.ResponseWriter, r *http.Request) {
|
debugMux.HandleFunc("/debug/notifier", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(h.nodeNotifier.String()))
|
w.Write([]byte(h.nodeNotifier.String()))
|
||||||
|
|
||||||
return
|
|
||||||
})
|
})
|
||||||
debugMux.HandleFunc("/debug/mapresp", func(w http.ResponseWriter, r *http.Request) {
|
debugMux.HandleFunc("/debug/mapresp", func(w http.ResponseWriter, r *http.Request) {
|
||||||
h.mapSessionMu.Lock()
|
h.mapSessionMu.Lock()
|
||||||
|
@ -729,8 +727,6 @@ func (h *Headscale) Serve() error {
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(b.String()))
|
w.Write([]byte(b.String()))
|
||||||
|
|
||||||
return
|
|
||||||
})
|
})
|
||||||
debugMux.Handle("/metrics", promhttp.Handler())
|
debugMux.Handle("/metrics", promhttp.Handler())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue