File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,19 @@ There is also a `cli` provided in the container which can be used to make calls
145145docker run -it --rm --entrypoint /cli ghcr.io/metal-stack/go-ipam
146146```
147147
148+ ## Metrics
149+
150+ ``` bash
151+ http://localhost:2112/metrics
152+ ```
153+
154+ ## pprof
155+
156+ ``` bash
157+ go tool pprof -http :8080 localhost:2113/debug/pprof/heap
158+ go tool pprof -http :8080 localhost:2113/debug/pprof/goroutine
159+ ```
160+
148161## Docker Compose example
149162
150163Ensure you have docker with compose support installed. Then execute the following command:
Original file line number Diff line number Diff line change 44 "fmt"
55 "log/slog"
66 "net/http"
7+ _ "net/http/pprof" // nolint:gosec
78 "time"
89
910 "connectrpc.com/connect"
@@ -73,6 +74,21 @@ func (s *server) Run() error {
7374 return
7475 }
7576 }()
77+ go func () {
78+ s .log .Info ("starting pprof endpoint of :2113" )
79+ // inspect via
80+ // go tool pprof -http :8080 localhost:2113/debug/pprof/heap
81+ // go tool pprof -http :8080 localhost:2113/debug/pprof/goroutine
82+ server := http.Server {
83+ Addr : ":2113" ,
84+ ReadHeaderTimeout : 1 * time .Minute ,
85+ }
86+ err := server .ListenAndServe ()
87+ if err != nil {
88+ s .log .Error ("failed to start pprof endpoint" , "error" , err )
89+ return
90+ }
91+ }()
7692
7793 otelInterceptor , err := otelconnect .NewInterceptor (otelconnect .WithMeterProvider (provider ))
7894 if err != nil {
You can’t perform that action at this time.
0 commit comments