Commit e152487
feat(monitoring): add byte metrics with aggregate Prometheus gauges
Add bytes_received/bytes_sent tracking across all three components
(pool, jd-client, translator) for SV2 channels and SV1 clients.
SV2 byte tracking:
- Per-channel (bytes_received, bytes_sent) counters in pool, jd-client,
and translator, keyed by channel_id in bytes_by_channel maps
- Shared mining_message_channel_id() helper in protocol_message_type.rs
to extract channel_id from parsed Mining messages
- Raw frame payload guard (len >= 4) for channel_id extraction from
unparsed upstream frames in jd-client and translator
- Cleanup in all CloseChannel handlers and ChannelManagerData::reset()
- JDC record_upstream_sent_bytes() eliminates double-lock on sends
SV1 byte tracking (translator only):
- Arc<AtomicU64> counters in ConnectionSV1, shared with DownstreamData
- Reader counts line.len()+1 (newline stripped by LinesCodec)
- Writer counts serialized JSON bytes before write_all
Prometheus metrics (fixed cardinality):
- sv2_server_bytes_{received,sent}_total — aggregate scalar Gauges
- sv2_client_bytes_{received,sent}_total — aggregate scalar Gauges
- sv1_client_bytes_{received,sent}_total — per-client GaugeVec
(1:1 with TCP connections, appropriate granularity)
Per-channel byte detail remains available via the JSON REST API
(/api/v1/server/channels, /api/v1/clients/{id}/channels,
/api/v1/sv1/clients) for drill-down without inflating Prometheus
time series cardinality.
Aggregate byte totals added to ServerSummary and Sv2ClientsSummary
so /api/v1/global includes byte totals alongside hashrate and
channel counts.1 parent 72cc650 commit e152487
26 files changed
Lines changed: 531 additions & 39 deletions
File tree
- miner-apps
- jd-client/src/lib
- channel_manager
- downstream
- translator/src/lib
- sv1
- downstream
- sv1_server
- sv2/channel_manager
- pool-apps/pool/src/lib
- channel_manager
- downstream
- stratum-apps/src
- monitoring
- network_helpers
- utils
Lines changed: 11 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 100 | + | |
| 101 | + | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
| |||
113 | 111 | | |
114 | 112 | | |
115 | 113 | | |
| 114 | + | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
453 | 454 | | |
454 | 455 | | |
455 | 456 | | |
456 | | - | |
| 457 | + | |
457 | 458 | | |
458 | 459 | | |
459 | 460 | | |
| |||
716 | 717 | | |
717 | 718 | | |
718 | 719 | | |
719 | | - | |
| 720 | + | |
720 | 721 | | |
721 | 722 | | |
722 | 723 | | |
| |||
911 | 912 | | |
912 | 913 | | |
913 | 914 | | |
914 | | - | |
| 915 | + | |
915 | 916 | | |
916 | 917 | | |
917 | 918 | | |
| |||
1111 | 1112 | | |
1112 | 1113 | | |
1113 | 1114 | | |
1114 | | - | |
| 1115 | + | |
1115 | 1116 | | |
1116 | 1117 | | |
1117 | 1118 | | |
| |||
1334 | 1335 | | |
1335 | 1336 | | |
1336 | 1337 | | |
1337 | | - | |
| 1338 | + | |
1338 | 1339 | | |
1339 | 1340 | | |
1340 | 1341 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
| 231 | + | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| |||
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| 185 | + | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| |||
321 | 324 | | |
322 | 325 | | |
323 | 326 | | |
| 327 | + | |
324 | 328 | | |
325 | 329 | | |
326 | 330 | | |
| |||
692 | 696 | | |
693 | 697 | | |
694 | 698 | | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
695 | 721 | | |
696 | 722 | | |
697 | 723 | | |
| |||
700 | 726 | | |
701 | 727 | | |
702 | 728 | | |
| 729 | + | |
703 | 730 | | |
704 | 731 | | |
705 | 732 | | |
706 | 733 | | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
707 | 747 | | |
708 | 748 | | |
709 | 749 | | |
| |||
812 | 852 | | |
813 | 853 | | |
814 | 854 | | |
| 855 | + | |
815 | 856 | | |
816 | 857 | | |
817 | 858 | | |
818 | 859 | | |
819 | 860 | | |
820 | 861 | | |
821 | 862 | | |
| 863 | + | |
822 | 864 | | |
823 | 865 | | |
824 | 866 | | |
| |||
873 | 915 | | |
874 | 916 | | |
875 | 917 | | |
| 918 | + | |
876 | 919 | | |
877 | 920 | | |
878 | 921 | | |
879 | 922 | | |
880 | 923 | | |
881 | 924 | | |
882 | 925 | | |
| 926 | + | |
883 | 927 | | |
884 | 928 | | |
885 | 929 | | |
| |||
1175 | 1219 | | |
1176 | 1220 | | |
1177 | 1221 | | |
1178 | | - | |
| 1222 | + | |
1179 | 1223 | | |
1180 | 1224 | | |
1181 | 1225 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
589 | | - | |
| 589 | + | |
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| 264 | + | |
263 | 265 | | |
264 | 266 | | |
265 | 267 | | |
| |||
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
| 289 | + | |
287 | 290 | | |
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
291 | 294 | | |
| 295 | + | |
292 | 296 | | |
293 | 297 | | |
294 | 298 | | |
| |||
336 | 340 | | |
337 | 341 | | |
338 | 342 | | |
| 343 | + | |
339 | 344 | | |
340 | 345 | | |
341 | 346 | | |
| |||
476 | 481 | | |
477 | 482 | | |
478 | 483 | | |
479 | | - | |
| 484 | + | |
480 | 485 | | |
481 | 486 | | |
482 | 487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | | - | |
37 | | - | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
| 151 | + | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
| |||
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
| 278 | + | |
273 | 279 | | |
274 | 280 | | |
| 281 | + | |
275 | 282 | | |
276 | 283 | | |
277 | 284 | | |
| |||
282 | 289 | | |
283 | 290 | | |
284 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
285 | 299 | | |
286 | 300 | | |
287 | 301 | | |
| |||
293 | 307 | | |
294 | 308 | | |
295 | 309 | | |
| 310 | + | |
296 | 311 | | |
297 | 312 | | |
298 | 313 | | |
| |||
305 | 320 | | |
306 | 321 | | |
307 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
308 | 329 | | |
309 | 330 | | |
310 | 331 | | |
| |||
0 commit comments