Commit 722e240
authored
feat(supervisor): add prometheus metric for outbound http requests (#4350)
Adds Prometheus metrics so the supervisor's outbound HTTP calls are
observable - including client-side failures that previously only
surfaced as a log line.
- `supervisor_outbound_request_total{name, method, status, outcome}` -
counts every outbound request. `outcome` separates a transport failure
(`network_error`), an HTTP error response (`http_error`), a response
that failed schema validation (`invalid_response`), and success (`ok`).
- `supervisor_outbound_request_duration_seconds{name, outcome}` -
latency histogram. Leaner labels than the counter (no `status`) to avoid
bucket×label cardinality; buckets match the existing dequeue-latency
histogram since these calls share the same retrying HTTP client and
long-poll envelope.
Coverage:
- The warm-start request (a one-off `fetch`) - instrumented inline; the
response status code is now also included in the failure log (it was
previously dropped).
- All worker API client calls (`SupervisorHttpClient`: dequeue, run
attempt start/complete, heartbeats, snapshots, continue, suspend,
debug-log, connect) - routed through a single instrumented `request()`
helper that reports via an optional `onHttpRequestComplete` callback on
the client, which the supervisor wires into the counter + histogram.
Low cardinality by design: `name` is a **static per-endpoint label**
(e.g. `dequeue`, `start_run_attempt`), never the interpolated URL - so
no run/snapshot IDs land in labels, mirroring the templated `route`
labels on the inbound HTTP server.
Registered on the existing metrics registry, exposed on `/metrics` with
no new wiring. Internal-only change (no package release needed), so the
changelog note is a single `.server-changes` entry.1 parent 88ca009 commit 722e240
4 files changed
Lines changed: 127 additions & 15 deletions
File tree
- .server-changes
- apps/supervisor/src
- packages/core/src/v3/runEngineWorker/supervisor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
63 | 78 | | |
64 | 79 | | |
65 | 80 | | |
| |||
322 | 337 | | |
323 | 338 | | |
324 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
325 | 344 | | |
326 | 345 | | |
327 | 346 | | |
| |||
692 | 711 | | |
693 | 712 | | |
694 | 713 | | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
695 | 726 | | |
696 | 727 | | |
697 | 728 | | |
| |||
700 | 731 | | |
701 | 732 | | |
702 | 733 | | |
| 734 | + | |
703 | 735 | | |
704 | 736 | | |
| 737 | + | |
705 | 738 | | |
706 | 739 | | |
707 | 740 | | |
| |||
710 | 743 | | |
711 | 744 | | |
712 | 745 | | |
| 746 | + | |
713 | 747 | | |
714 | 748 | | |
715 | 749 | | |
716 | 750 | | |
717 | 751 | | |
718 | 752 | | |
719 | 753 | | |
| 754 | + | |
| 755 | + | |
720 | 756 | | |
721 | 757 | | |
| 758 | + | |
722 | 759 | | |
723 | 760 | | |
724 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
62 | 110 | | |
63 | | - | |
| 111 | + | |
| 112 | + | |
64 | 113 | | |
65 | 114 | | |
66 | 115 | | |
| |||
75 | 124 | | |
76 | 125 | | |
77 | 126 | | |
78 | | - | |
| 127 | + | |
| 128 | + | |
79 | 129 | | |
80 | 130 | | |
81 | 131 | | |
| |||
91 | 141 | | |
92 | 142 | | |
93 | 143 | | |
94 | | - | |
| 144 | + | |
| 145 | + | |
95 | 146 | | |
96 | 147 | | |
97 | 148 | | |
| |||
104 | 155 | | |
105 | 156 | | |
106 | 157 | | |
107 | | - | |
| 158 | + | |
| 159 | + | |
108 | 160 | | |
109 | 161 | | |
110 | 162 | | |
| |||
124 | 176 | | |
125 | 177 | | |
126 | 178 | | |
127 | | - | |
| 179 | + | |
| 180 | + | |
128 | 181 | | |
129 | 182 | | |
130 | 183 | | |
| |||
146 | 199 | | |
147 | 200 | | |
148 | 201 | | |
149 | | - | |
| 202 | + | |
| 203 | + | |
150 | 204 | | |
151 | 205 | | |
152 | 206 | | |
| |||
168 | 222 | | |
169 | 223 | | |
170 | 224 | | |
171 | | - | |
| 225 | + | |
| 226 | + | |
172 | 227 | | |
173 | 228 | | |
174 | 229 | | |
| |||
184 | 239 | | |
185 | 240 | | |
186 | 241 | | |
187 | | - | |
| 242 | + | |
| 243 | + | |
188 | 244 | | |
189 | 245 | | |
190 | 246 | | |
| |||
204 | 260 | | |
205 | 261 | | |
206 | 262 | | |
207 | | - | |
| 263 | + | |
| 264 | + | |
208 | 265 | | |
209 | 266 | | |
210 | 267 | | |
| |||
224 | 281 | | |
225 | 282 | | |
226 | 283 | | |
227 | | - | |
| 284 | + | |
| 285 | + | |
228 | 286 | | |
229 | 287 | | |
230 | 288 | | |
| |||
252 | 310 | | |
253 | 311 | | |
254 | 312 | | |
255 | | - | |
| 313 | + | |
| 314 | + | |
256 | 315 | | |
257 | 316 | | |
258 | 317 | | |
| |||
292 | 351 | | |
293 | 352 | | |
294 | 353 | | |
295 | | - | |
| 354 | + | |
| 355 | + | |
296 | 356 | | |
297 | 357 | | |
298 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
3 | 11 | | |
4 | 12 | | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
8 | 16 | | |
9 | 17 | | |
| 18 | + | |
10 | 19 | | |
11 | 20 | | |
12 | 21 | | |
| |||
0 commit comments