Commit 7451712
committed
Merge #1383: Overhaul stats events: merge UDP server events with a different IP version
9a8a0dc refactor: [#1382] rename UDP server event enum variants (Jose Celano)
27e2db4 refactor: [#1382] include req kin in UDP error response if it's known (Jose Celano)
625d20a refactor: [#1382] rename torrust_udp_tracker_server::statistics::event::Event::UdpRequest (Jose Celano)
203a1b4 refactor: [#1382] merge UDP server stats events with different IP version (Jose Celano)
e4c6000 refactor: [#1382] add connection context to UDP server events (Jose Celano)
74ffa4c refactor: [#1382] error request kind in UDP req does not make sense (Jose Celano)
Pull request description:
Change events in `torrust_udp_tracker_server::statistics::event::Event` from this:
```rust
pub enum Event {
UdpRequestAborted,
UdpRequestBanned,
// UDP4
Udp4IncomingRequest,
Udp4Request {
kind: UdpResponseKind,
},
Udp4Response {
kind: UdpResponseKind,
req_processing_time: Duration,
},
Udp4Error,
// UDP6
Udp6IncomingRequest,
Udp6Request {
kind: UdpResponseKind,
},
Udp6Response {
kind: UdpResponseKind,
req_processing_time: Duration,
},
Udp6Error,
}
pub enum UdpRequestKind {
Connect,
Announce,
Scrape,
Error,
}
```
To this:
```rust
pub enum Event {
UdpRequestReceived {
context: ConnectionContext,
},
UdpRequestAborted {
context: ConnectionContext,
},
UdpRequestBanned {
context: ConnectionContext,
},
UdpRequestAccepted {
context: ConnectionContext,
kind: UdpRequestKind,
},
UdpResponseSent {
context: ConnectionContext,
kind: UdpResponseKind,
req_processing_time: Duration,
},
UdpError {
context: ConnectionContext,
},
}
pub enum UdpRequestKind {
Connect,
Announce,
Scrape,
}
pub enum UdpResponseKind {
Ok { req_kind: UdpRequestKind },
Error { opt_req_kind: Option<UdpRequestKind> },
}
pub struct ConnectionContext {
client_socket_addr: SocketAddr,
server_socket_addr: SocketAddr,
}
```
### Sub-tasks
- [x] Add enum `UdpResponseKind`. `UdpRequestKind::Error` variant does not make sense.
- [x] Add `ConnectionContext` to events.
- [x] Merge events with the same request type (`connect`, `announce` and `scrape`).
ACKs for top commit:
josecelano:
ACK 9a8a0dc
Tree-SHA512: 3d81ebed7e0005aacb135d801ad64043bb2dccafc07476538ed372dcc256ac60faced20ded3794f0d78ee2f7295b11e6d0d45b286c896501a097aa4371227123File tree
11 files changed
+437
-295
lines changed- packages
- udp-tracker-core/src/statistics/event
- udp-tracker-server/src
- handlers
- server
- statistics
- event
11 files changed
+437
-295
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
60 | 50 | | |
61 | 51 | | |
62 | 52 | | |
63 | 53 | | |
64 | 54 | | |
65 | | - | |
| 55 | + | |
66 | 56 | | |
67 | 57 | | |
68 | 58 | | |
| |||
226 | 216 | | |
227 | 217 | | |
228 | 218 | | |
229 | | - | |
| 219 | + | |
230 | 220 | | |
231 | 221 | | |
232 | 222 | | |
| |||
429 | 419 | | |
430 | 420 | | |
431 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
432 | 425 | | |
433 | 426 | | |
434 | 427 | | |
435 | | - | |
436 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
437 | 431 | | |
438 | 432 | | |
439 | 433 | | |
| |||
443 | 437 | | |
444 | 438 | | |
445 | 439 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | 440 | | |
450 | 441 | | |
451 | 442 | | |
| |||
549 | 540 | | |
550 | 541 | | |
551 | 542 | | |
552 | | - | |
| 543 | + | |
553 | 544 | | |
554 | 545 | | |
555 | 546 | | |
| |||
771 | 762 | | |
772 | 763 | | |
773 | 764 | | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
774 | 768 | | |
775 | 769 | | |
776 | 770 | | |
777 | | - | |
778 | | - | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
779 | 774 | | |
780 | 775 | | |
781 | 776 | | |
| |||
785 | 780 | | |
786 | 781 | | |
787 | 782 | | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | 783 | | |
792 | 784 | | |
793 | 785 | | |
| |||
819 | 811 | | |
820 | 812 | | |
821 | 813 | | |
822 | | - | |
823 | 814 | | |
824 | 815 | | |
825 | 816 | | |
| |||
830 | 821 | | |
831 | 822 | | |
832 | 823 | | |
833 | | - | |
| 824 | + | |
834 | 825 | | |
835 | 826 | | |
836 | 827 | | |
| |||
860 | 851 | | |
861 | 852 | | |
862 | 853 | | |
863 | | - | |
| 854 | + | |
864 | 855 | | |
865 | 856 | | |
866 | 857 | | |
| |||
870 | 861 | | |
871 | 862 | | |
872 | 863 | | |
873 | | - | |
874 | | - | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
875 | 867 | | |
876 | 868 | | |
877 | 869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
42 | 32 | | |
43 | 33 | | |
44 | 34 | | |
45 | | - | |
| 35 | + | |
46 | 36 | | |
47 | 37 | | |
48 | 38 | | |
| |||
70 | 60 | | |
71 | 61 | | |
72 | 62 | | |
73 | | - | |
74 | 63 | | |
75 | 64 | | |
76 | 65 | | |
| |||
79 | 68 | | |
80 | 69 | | |
81 | 70 | | |
82 | | - | |
| 71 | + | |
83 | 72 | | |
84 | 73 | | |
85 | 74 | | |
| |||
214 | 203 | | |
215 | 204 | | |
216 | 205 | | |
217 | | - | |
218 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
219 | 209 | | |
220 | 210 | | |
221 | 211 | | |
| |||
244 | 234 | | |
245 | 235 | | |
246 | 236 | | |
247 | | - | |
| 237 | + | |
248 | 238 | | |
249 | 239 | | |
250 | 240 | | |
| |||
254 | 244 | | |
255 | 245 | | |
256 | 246 | | |
257 | | - | |
258 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
259 | 250 | | |
260 | 251 | | |
261 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
72 | 67 | | |
73 | 68 | | |
74 | 69 | | |
| |||
0 commit comments