alamb commented on code in PR #18103:
URL: https://github.com/apache/datafusion/pull/18103#discussion_r2437136357
##########
datafusion-cli/src/object_storage/instrumented.rs:
##########
@@ -138,6 +143,26 @@ impl InstrumentedObjectStore {
Ok(ret)
}
+
+ fn instrumented_list(
+ &self,
+ prefix: Option<&Path>,
+ ) -> BoxStream<'static, Result<ObjectMeta>> {
+ let timestamp = Utc::now();
+ let ret = self.inner.list(prefix);
+
+ self.requests.lock().push(RequestDetails {
+ op: Operation::List,
+ path: prefix.cloned().unwrap_or_else(|| Path::from("")),
+ timestamp,
+ duration: None, // list returns a stream, so the duration isn't
meaningful
Review Comment:
Time to first response is meaningful 🤔 Something we can improve in the
future if needed
##########
datafusion-cli/src/object_storage/instrumented.rs:
##########
@@ -172,9 +197,7 @@ impl ObjectStore for InstrumentedObjectStore {
}
async fn get_opts(&self, location: &Path, options: GetOptions) ->
Result<GetResult> {
- if self.instrument_mode.load(Ordering::Relaxed)
- != InstrumentedObjectStoreMode::Disabled as u8
- {
+ if self.enabled() {
Review Comment:
❤️
##########
datafusion-cli/src/object_storage/instrumented.rs:
##########
@@ -186,6 +209,10 @@ impl ObjectStore for InstrumentedObjectStore {
}
fn list(&self, prefix: Option<&Path>) -> BoxStream<'static,
Result<ObjectMeta>> {
+ if self.enabled() {
+ return self.instrumented_list(prefix);
+ }
+
Review Comment:
I think you may need to instrument the other versions of list below
(`list_with_delimiter`, etc) as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]