Trace handling of messages

This commit is contained in:
Nathan Sobo 2022-04-27 15:27:01 -06:00
parent 2db670308b
commit 6ef2d0fbec

View file

@ -47,6 +47,7 @@ use tokio::{
time::Sleep,
};
use tower::ServiceBuilder;
use tracing::info_span;
use util::ResultExt;
type MessageHandler = Box<
@ -156,7 +157,11 @@ impl Server {
TypeId::of::<M>(),
Box::new(move |server, envelope| {
let envelope = envelope.into_any().downcast::<TypedEnvelope<M>>().unwrap();
(handler)(server, *envelope).boxed()
let span = info_span!(
"handle message",
payload_type = envelope.payload_type_name()
);
span.in_scope(|| (handler)(server, *envelope).boxed())
}),
);
if prev_handler.is_some() {