Implemented span inline method for TokioServiceInfo
@@ -10,7 +10,7 @@ use futures::stream::FuturesUnordered;
use thiserror::Error;
use tokio::runtime::{Handle, Runtime};
use tokio::task::JoinHandle;
-use tracing::{span, Level};
+use tracing::{span, Level, Span};
use tracing_futures::Instrument;
use std::error;
@@ -240,6 +240,12 @@ impl TokioServiceInfo {
&self.handle
}
+ /// Access the parent service span
+ #[inline]
+ pub fn span(&self) -> &Span {
+ &self.span
+ }
+
/// spawn a std::future within the service's tokio handle
pub fn spawn<F>(&self, name: &'static str, future: F)
where
