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
145
145
docker run -it --rm --entrypoint /cli ghcr.io/metal-stack/go-ipam
146
146
```
147
147
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
+
148
161
## Docker Compose example
149
162
150
163
Ensure you have docker with compose support installed. Then execute the following command:
Original file line number Diff line number Diff line change 4
4
"fmt"
5
5
"log/slog"
6
6
"net/http"
7
+ _ "net/http/pprof" // nolint:gosec
7
8
"time"
8
9
9
10
"connectrpc.com/connect"
@@ -73,6 +74,21 @@ func (s *server) Run() error {
73
74
return
74
75
}
75
76
}()
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
+ }()
76
92
77
93
otelInterceptor , err := otelconnect .NewInterceptor (otelconnect .WithMeterProvider (provider ))
78
94
if err != nil {
You can’t perform that action at this time.
0 commit comments