Commit 3bade2c
committed
Merge #1545: Overhaul stats: Allow removing peerless torrents without affecting global torrent downloads metric
92242f8 fix: [#1543] Remove peerless torrents when it's enabled in the tracker policy (Jose Celano)
43c7179 refactor: [#1543] rename Metrics to ProtocolMetrics (Jose Celano)
b0e7443 fix: [#1543] return always in API the downloads number from tracker-core (Jose Celano)
8d3a6fe refactor: [#1543] extract methods (Jose Celano)
02c33f6 fix: [#1543] the downloads counter values returned in the API (Jose Celano)
762bf69 refactor: [#1543] Optimization: Don't load number of downloads from DB if not needed (Jose Celano)
e107614 chore: [#1543] remove comment on tracker-core handle_announcement (Jose Celano)
3d6fc65 refactor: [#1543] rename AggregateSwarmMetadata to AggregateActiveSwarmMetadata (Jose Celano)
Pull request description:
### Subtasks
- [x] Rename AggregateSwarmMetadata to AggregateActiveSwarmMetadata. Aggregate values are only for active swarms. For example, it does not count downloads for torrents that are not currently active.
- [x] Little optimisation. Avoid loading the number of downloads for a torrent from the DB if it's not needed.
- [x] Fix the downloads counter values returned in the API.
- [x] Remove peerless torrents when it's enabled in the tracker policy. It was not allowed because it affected the global number of downloads exposed via the API. That problem has been solved in the PR.
After merging this PR, the tracker will save memory because peerless torrents will be removed from memory (when that policy is enabled) even when stats is enabled.
ACKs for top commit:
josecelano:
ACK 92242f8
Tree-SHA512: 3b6d639c01dfd90c974769c7b76930b7e94dec746691fbb070cb94c76f97c74e8f30c8a4736ce9023fae404e1322435e184bf5b6932342eeabe2f323c60f55f9File tree
28 files changed
+231
-141
lines changed- packages
- axum-rest-tracker-api-server/src/v1/context/stats
- http-tracker-core/src/statistics
- primitives/src
- rest-tracker-api-core
- src/statistics
- torrent-repository-benchmarking
- src/repository
- tests
- common
- repository
- torrent-repository/src
- tracker-client/src/http/client/requests
- tracker-core/src
- statistics
- torrent/repository
- udp-tracker-core/src/statistics
- udp-tracker-server/src/statistics
28 files changed
+231
-141
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| |||
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | | - | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
| |||
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
148 | | - | |
| 147 | + | |
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
153 | 152 | | |
154 | | - | |
| 153 | + | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 51 | + | |
| 52 | + | |
54 | 53 | | |
55 | 54 | | |
56 | | - | |
| 55 | + | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
| 58 | + | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
| 65 | + | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
2 | 31 | | |
3 | 32 | | |
4 | 33 | | |
| |||
7 | 36 | | |
8 | 37 | | |
9 | 38 | | |
10 | | - | |
| 39 | + | |
11 | 40 | | |
12 | 41 | | |
13 | 42 | | |
| |||
Lines changed: 73 additions & 47 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
36 | 60 | | |
37 | 61 | | |
38 | 62 | | |
| |||
42 | 66 | | |
43 | 67 | | |
44 | 68 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 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 | + | |
78 | 99 | | |
79 | 100 | | |
80 | 101 | | |
| |||
89 | 110 | | |
90 | 111 | | |
91 | 112 | | |
92 | | - | |
93 | 113 | | |
94 | 114 | | |
95 | 115 | | |
| |||
138 | 158 | | |
139 | 159 | | |
140 | 160 | | |
141 | | - | |
| 161 | + | |
142 | 162 | | |
143 | 163 | | |
144 | 164 | | |
145 | 165 | | |
146 | 166 | | |
147 | | - | |
| 167 | + | |
148 | 168 | | |
| 169 | + | |
149 | 170 | | |
150 | | - | |
| 171 | + | |
151 | 172 | | |
152 | 173 | | |
153 | 174 | | |
| |||
157 | 178 | | |
158 | 179 | | |
159 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
160 | 186 | | |
161 | | - | |
162 | 187 | | |
163 | 188 | | |
164 | 189 | | |
| |||
177 | 202 | | |
178 | 203 | | |
179 | 204 | | |
180 | | - | |
| 205 | + | |
181 | 206 | | |
| 207 | + | |
182 | 208 | | |
183 | 209 | | |
184 | 210 | | |
| |||
187 | 213 | | |
188 | 214 | | |
189 | 215 | | |
190 | | - | |
191 | | - | |
| 216 | + | |
| 217 | + | |
192 | 218 | | |
193 | 219 | | |
194 | 220 | | |
| |||
0 commit comments