Trait opentelemetry::runtime::Runtime
source · pub trait Runtime: Clone + Send + Sync + 'static {
type Interval: Stream + Send;
type Delay: Future + Send;
// Required methods
fn interval(&self, duration: Duration) -> Self::Interval;
fn spawn(&self, future: BoxFuture<'static, ()>);
fn delay(&self, duration: Duration) -> Self::Delay;
}
Expand description
Required Associated Types§
Required Methods§
sourcefn spawn(&self, future: BoxFuture<'static, ()>)
fn spawn(&self, future: BoxFuture<'static, ()>)
Spawn a new task or thread, which executes the given future.
Note
This is mainly used to run batch span processing in the background. Note, that the function does not return a handle. OpenTelemetry will use a different way to wait for the future to finish when TracerProvider gets shutdown. At the moment this happens by blocking the current thread. This means runtime implementations need to make sure they can still execute the given future even if the main thread is blocked.
Object Safety§
This trait is not object safe.