Grpc tracing spreading
@@ -6,8 +6,10 @@ use crate::settings::start::network::Listen;
use chain_network::grpc;
use tonic::transport::Server;
+use tracing::{span, Level};
use std::convert::TryInto;
+use tracing_futures::Instrument;
pub async fn run_listen_socket(
listen: &Listen,
@@ -15,9 +17,9 @@ pub async fn run_listen_socket(
channels: Channels,
) -> Result<(), ListenError> {
let sockaddr = listen.address();
-
- let logger = state.logger().new(o!("local_addr" => sockaddr.to_string()));
- info!(logger, "listening and accepting gRPC connections");
+ let span = span!(parent: &state.span, Level::TRACE, "listen_socket", local_addr = %sockaddr.to_string());
+ async {
+ tracing::info!("listening and accepting gRPC connections");
let mut builder = grpc::server::Builder::new();
if let Some(node_id) = state.config.legacy_node_id {
@@ -34,3 +36,6 @@ pub async fn run_listen_socket(
.await
.map_err(|cause| ListenError { cause, sockaddr })
}
+ .instrument(span)
+ .await
+}
