Commit 776e026
Log original request ID when reusing shared in-flight quote requests (#4300)
## Background
Fast and optimal quoters share the same `ExternalTradeFinder` instance
(via `Arc<dyn TradeFinding>`), so `RequestSharing` already deduplicates
identical concurrent requests. However, when a hitchhiker reused an
in-flight request, there was no trace linking it back to the original
HTTP call, making it hard to debug why the optimal quoter failed to
provide solutions, while the fast one succeeded for basically the same
quote competition or vice versa.
## Changes
- Extended `RequestSharing::shared_or_else` to return a `SharedResult`
that indicates whether an existing in-flight request was reused
(`is_shared` flag), improving observability of request deduplication.
- In `ExternalTradeFinder`, the HTTP request ID (`X-REQUEST-ID`) is now
embedded in the shared future's result. When a caller (e.g. the fast or
optimal quoter) reuses an in-flight request instead of sending a new
one, a debug log is emitted with the `original_request_id` — making it
possible to trace which HTTP request produced a given quote result.
- All other `shared_or_else` callers updated to use the new `.future`
field (no behavioral change).
## How to test
Using staging, use the cowswap UI to get some quotes. Search for the new
log.1 parent 0a42e7c commit 776e026
File tree
3 files changed
+98
-47
lines changed- crates
- liquidity-sources/src
- price-estimation/src/trade_finding
- request-sharing/src
3 files changed
+98
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
| 283 | + | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| |||
| 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 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
36 | | - | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| |||
83 | 92 | | |
84 | 93 | | |
85 | 94 | | |
86 | | - | |
87 | | - | |
| 95 | + | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
97 | 127 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
114 | 131 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
119 | 144 | | |
120 | 145 | | |
121 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
42 | 66 | | |
43 | 67 | | |
44 | 68 | | |
| |||
100 | 124 | | |
101 | 125 | | |
102 | 126 | | |
103 | | - | |
| 127 | + | |
104 | 128 | | |
105 | 129 | | |
106 | 130 | | |
| |||
113 | 137 | | |
114 | 138 | | |
115 | 139 | | |
116 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
117 | 144 | | |
118 | 145 | | |
119 | 146 | | |
| |||
129 | 156 | | |
130 | 157 | | |
131 | 158 | | |
132 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
133 | 163 | | |
134 | 164 | | |
135 | 165 | | |
| |||
165 | 195 | | |
166 | 196 | | |
167 | 197 | | |
168 | | - | |
169 | | - | |
| 198 | + | |
| 199 | + | |
170 | 200 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 201 | + | |
| 202 | + | |
175 | 203 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 204 | + | |
| 205 | + | |
180 | 206 | | |
181 | | - | |
| 207 | + | |
182 | 208 | | |
183 | 209 | | |
184 | 210 | | |
185 | 211 | | |
186 | | - | |
187 | | - | |
| 212 | + | |
| 213 | + | |
188 | 214 | | |
189 | 215 | | |
190 | 216 | | |
191 | | - | |
| 217 | + | |
192 | 218 | | |
193 | 219 | | |
194 | 220 | | |
0 commit comments