xanderbailey commented on code in PR #2467:
URL: https://github.com/apache/iceberg-rust/pull/2467#discussion_r3323001576


##########
crates/iceberg/src/runtime/tracer.rs:
##########
@@ -0,0 +1,86 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::any::Any;
+use std::future::Future;
+
+use futures::FutureExt;
+use futures::future::BoxFuture;
+
+/// A trait for injecting instrumentation into spawned tasks.
+///
+/// Implementations can wrap futures or blocking closures with tracing spans,
+/// metrics, or other observability hooks. The tracer receives type-erased
+/// values and must preserve the output without modification.
+pub trait RuntimeTracer: Send + Sync + 'static {
+    /// Wraps a type-erased future with instrumentation.
+    ///
+    /// The implementation must not alter the future's output value.
+    fn trace_future(
+        &self,
+        fut: BoxFuture<'static, Box<dyn Any + Send>>,
+    ) -> BoxFuture<'static, Box<dyn Any + Send>>;
+
+    /// Wraps a type-erased blocking closure with instrumentation.
+    ///
+    /// The implementation must not alter the closure's return value.
+    fn trace_block(
+        &self,
+        f: Box<dyn FnOnce() -> Box<dyn Any + Send> + Send>,

Review Comment:
   Tokio `spawn_blocking` requires `Send` because you pass these to thread pool 
so you do cross a thread boundary. 
https://docs.rs/tokio/latest/tokio/task/fn.spawn_blocking.html



-- 
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]

Reply via email to