Commit 2c9077a
authored
[datafusion-cli] Implement average LIST duration for object store profiling (#19127)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Closes #18138
## Rationale for this change
The `list` operation returns a stream, so it previously recorded
`duration: None`, missing performance insights. Time-to-first-item is a
useful metric for list operations, indicating how quickly results start.
This adds duration tracking by measuring time until the first item is
yielded (or the stream ends).
## What changes are included in this PR?
1. Added `TimeToFirstItemStream`: A stream wrapper that measures elapsed
time from creation until the first item is yielded (or the stream ends
if empty).
2. Updated `instrumented_list`: Wraps the inner stream with
`TimeToFirstItemStream` to record duration.
3. Changed `requests` field: Switched from `Mutex<Vec<RequestDetails>>`
to `Arc<Mutex<Vec<RequestDetails>>>` to allow sharing across async
boundaries (needed for the stream wrapper).
4. Updated tests: Modified `instrumented_store_list` to consume at least
one stream item and verify that `duration` is now `Some(Duration)`
instead of `None`.
## Are these changes tested?
Yes. The existing test `instrumented_store_list` was updated to:
- Consume at least one item from the stream using `stream.next().await`
- Assert that `request.duration.is_some()` (previously `is_none()`)
All tests pass, including the updated list test and other instrumented
operation tests.
## Are there any user-facing changes?
Users with profiling enabled will see duration values for `list`
operations instead of nothing.1 parent 0a0416d commit 2c9077a
1 file changed
+83
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 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 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
47 | 99 | | |
48 | 100 | | |
49 | 101 | | |
| |||
92 | 144 | | |
93 | 145 | | |
94 | 146 | | |
95 | | - | |
| 147 | + | |
96 | 148 | | |
97 | 149 | | |
98 | 150 | | |
| |||
101 | 153 | | |
102 | 154 | | |
103 | 155 | | |
104 | | - | |
| 156 | + | |
105 | 157 | | |
106 | 158 | | |
107 | 159 | | |
| |||
219 | 271 | | |
220 | 272 | | |
221 | 273 | | |
222 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
223 | 290 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
233 | 297 | | |
234 | | - | |
| 298 | + | |
235 | 299 | | |
236 | 300 | | |
237 | 301 | | |
| |||
759 | 823 | | |
760 | 824 | | |
761 | 825 | | |
| 826 | + | |
762 | 827 | | |
763 | 828 | | |
764 | 829 | | |
| |||
899 | 964 | | |
900 | 965 | | |
901 | 966 | | |
902 | | - | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
903 | 970 | | |
904 | 971 | | |
905 | 972 | | |
906 | 973 | | |
907 | 974 | | |
908 | | - | |
| 975 | + | |
909 | 976 | | |
910 | 977 | | |
911 | 978 | | |
| |||
0 commit comments