mirror of
https://github.com/livekit/livekit.git
synced 2026-08-28 05:04:10 +00:00
endpoint to dump stacktraces
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"runtime/pprof"
|
||||
"time"
|
||||
|
||||
"github.com/pion/turn/v2"
|
||||
@@ -68,6 +69,9 @@ func NewLivekitServer(conf *config.Config,
|
||||
mux.Handle(s.roomServer.PathPrefix(), s.roomServer)
|
||||
mux.Handle("/rtc", rtcService)
|
||||
mux.HandleFunc("/", s.healthCheck)
|
||||
if conf.Development {
|
||||
mux.HandleFunc("/debug/goroutine", s.debugGoroutines)
|
||||
}
|
||||
|
||||
s.httpServer = &http.Server{
|
||||
Addr: fmt.Sprintf(":%d", conf.Port),
|
||||
@@ -208,6 +212,10 @@ func (s *LivekitServer) RoomManager() *RoomManager {
|
||||
return s.roomManager
|
||||
}
|
||||
|
||||
func (s *LivekitServer) debugGoroutines(w http.ResponseWriter, r *http.Request) {
|
||||
_ = pprof.Lookup("goroutine").WriteTo(w, 2)
|
||||
}
|
||||
|
||||
func (s *LivekitServer) healthCheck(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user