diff --git a/pkg/o11y/debug-info.html b/pkg/o11y/debug-info.html
new file mode 100644
index 0000000..39d9f4c
--- /dev/null
+++ b/pkg/o11y/debug-info.html
@@ -0,0 +1,39 @@
+
+
+ Application build information
+
+
+
+ Application build information
+ Base info
+
+ - Go version
+ - {{ .GoVersion }}
+
+ Module
+
+ - Path
+ - {{ .Main.Path }}
+ - Version
+ - {{ .Main.Version }}
+ - Sum
+ - {{ .Main.Sum }}
+
+ Settings
+
+ {{ range .Settings }}
+ - {{ .Key }}
+ - {{ .Value }}
+ {{ end }}
+
+ Modules
+
+ {{ range .Deps }}
+ - {{ .Path }} {{ .Version }}
+ {{ end }}
+
+
\ No newline at end of file
diff --git a/pkg/o11y/pprof.go b/pkg/o11y/pprof.go
index 6e9e751..926e7c3 100644
--- a/pkg/o11y/pprof.go
+++ b/pkg/o11y/pprof.go
@@ -1,19 +1,41 @@
package o11y
import (
+ _ "embed"
+ "html/template"
"log/slog"
"net/http"
_ "net/http/pprof"
+ "runtime/debug"
)
func StartPProfServer() {
go runPProfServer()
}
+//go:embed debug-info.html
+var debugInfoPage string
+
+var debugInfoTPL = template.Must(template.New("debug-info").Parse(debugInfoPage))
+
// runPProfServer starts an HTTP server on port 6060 that exposes /debug/pprof
// This function blocks until an error occurs
// This is a separate function to make stacktraces more readable
func runPProfServer() {
+ http.HandleFunc("/debug/info", func(w http.ResponseWriter, r *http.Request) {
+ debugInfo, ok := debug.ReadBuildInfo()
+ if !ok {
+ http.Error(w, "unable to load build info", http.StatusInternalServerError)
+ return
+ }
+
+ err := debugInfoTPL.ExecuteTemplate(w, "debug-info", debugInfo)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ })
+
err := http.ListenAndServe(":6060", nil)
if err != nil {
slog.Warn("pprof http server shut down", slog.Any("error", err))