Add pprof endpoint
Some checks failed
/ golint (push) Has been cancelled

This commit is contained in:
Eli Ribble 2026-05-19 00:39:38 +00:00
parent 15d8966971
commit 2d4a0347d6
No known key found for this signature in database

15
main.go
View file

@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"runtime/debug"
@ -147,6 +148,20 @@ func main() {
log.Debug().Str("report url", config.DomainRMO).Str("sync url", config.DomainNidus).Msg("Serving at URLs")
// Start pprof debug server on a separate port (localhost-only for security).
// Tunnels and Staging builds can set PPROF_BIND to override.
// Access via: curl http://localhost:6060/debug/pprof/goroutine?debug=1
pprofBind := os.Getenv("PPROF_BIND")
if pprofBind == "" {
pprofBind = "localhost:6060"
}
go func() {
log.Info().Str("address", pprofBind).Msg("Starting pprof debug server")
if err := http.ListenAndServe(pprofBind, nil); err != nil {
log.Error().Err(err).Msg("pprof server stopped")
}
}()
openai_logger := log.With().Logger()
err = llm.CreateOpenAIClient(ctx, &openai_logger)
if err != nil {