add debug endpoints
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-27 20:14:52 +10:00
parent 3501967c9e
commit fb47006809
2 changed files with 8 additions and 1 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"log/slog"
_ "net/http/pprof"
"os"
"runtime"
"time"

View File

@@ -3,6 +3,7 @@ package router
import (
"log/slog"
"net/http"
"net/http/pprof"
"vctp/db"
"vctp/dist"
"vctp/internal/secrets"
@@ -42,5 +43,12 @@ func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver st
// endpoint for encrypting vcenter credential
mux.HandleFunc("/api/encrypt", h.EncryptData)
// Register pprof handlers
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
return middleware.NewLoggingMiddleware(logger, mux)
}