endpoint to dump stacktraces
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime/pprof"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pion/turn/v2"
|
"github.com/pion/turn/v2"
|
||||||
@@ -68,6 +69,9 @@ func NewLivekitServer(conf *config.Config,
|
|||||||
mux.Handle(s.roomServer.PathPrefix(), s.roomServer)
|
mux.Handle(s.roomServer.PathPrefix(), s.roomServer)
|
||||||
mux.Handle("/rtc", rtcService)
|
mux.Handle("/rtc", rtcService)
|
||||||
mux.HandleFunc("/", s.healthCheck)
|
mux.HandleFunc("/", s.healthCheck)
|
||||||
|
if conf.Development {
|
||||||
|
mux.HandleFunc("/debug/goroutine", s.debugGoroutines)
|
||||||
|
}
|
||||||
|
|
||||||
s.httpServer = &http.Server{
|
s.httpServer = &http.Server{
|
||||||
Addr: fmt.Sprintf(":%d", conf.Port),
|
Addr: fmt.Sprintf(":%d", conf.Port),
|
||||||
@@ -208,6 +212,10 @@ func (s *LivekitServer) RoomManager() *RoomManager {
|
|||||||
return s.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) {
|
func (s *LivekitServer) healthCheck(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user