mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-26 05:55:27 +00:00
56d44609ea
https://rafallorenz.com/go/go-profiling-http-service-with-pprof-and-expvar/ Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/323 Co-authored-by: crapStone <me@crapstone.dev> Co-committed-by: crapStone <me@crapstone.dev>
22 lines
400 B
Go
22 lines
400 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
_ "net/http/pprof"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func StartProfilingServer(listeningAddress string) {
|
|
server := &http.Server{
|
|
Addr: listeningAddress,
|
|
Handler: http.DefaultServeMux,
|
|
}
|
|
|
|
log.Info().Msgf("Starting debug server on %s", listeningAddress)
|
|
|
|
go func() {
|
|
log.Fatal().Err(server.ListenAndServe()).Msg("Failed to start debug server")
|
|
}()
|
|
}
|