Commit da5ee4c
authored
fix(prometheus): add graceful shutdown for server (#137)
fix: add graceful shutdown for Prometheus metrics server
Refactor Prometheus server to match pprof pattern:
- Use dedicated http.ServeMux instead of default mux
- Manage server lifecycle with errgroup
- Add graceful shutdown handler with 5s timeout
- Proper error propagation instead of fire-and-forget goroutine
This ensures the Prometheus server shuts down cleanly on SIGTERM/SIGINT
and errors are properly tracked by the errgroup.1 parent 4168185 commit da5ee4c
1 file changed
+28
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
| 127 | + | |
| 128 | + | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
134 | 141 | | |
135 | | - | |
136 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
137 | 157 | | |
138 | 158 | | |
139 | 159 | | |
| |||
0 commit comments