mirror of https://github.com/tailscale/tailscale/
tsweb: don't hook up pprof handlers in javascript builds
Updates #15160 Signed-off-by: David Anderson <dave@tailscale.com>dependabot/go_modules/gokrazy/tsapp/builddir/github.com/gokrazy/gokrazy/cmd/dhcp/golang.org/x/net-0.38.0
parent
37f5fd2ec1
commit
a3cc7123ff
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
//go:build !js
|
||||||
|
|
||||||
|
package tsweb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/http/pprof"
|
||||||
|
)
|
||||||
|
|
||||||
|
func addProfilingHandlers(d *DebugHandler) {
|
||||||
|
// pprof.Index serves everything that runtime/pprof.Lookup finds:
|
||||||
|
// goroutine, threadcreate, heap, allocs, block, mutex
|
||||||
|
d.Handle("pprof/", "pprof (index)", http.HandlerFunc(pprof.Index))
|
||||||
|
// But register the other ones from net/http/pprof directly:
|
||||||
|
d.HandleSilent("pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
|
||||||
|
d.HandleSilent("pprof/profile", http.HandlerFunc(pprof.Profile))
|
||||||
|
d.HandleSilent("pprof/symbol", http.HandlerFunc(pprof.Symbol))
|
||||||
|
d.HandleSilent("pprof/trace", http.HandlerFunc(pprof.Trace))
|
||||||
|
d.URL("/debug/pprof/goroutine?debug=1", "Goroutines (collapsed)")
|
||||||
|
d.URL("/debug/pprof/goroutine?debug=2", "Goroutines (full)")
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
package tsweb
|
||||||
|
|
||||||
|
func addProfilingHandlers(d *DebugHandler) {
|
||||||
|
// No pprof in js builds, pprof doesn't work and bloats the build.
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue