Record authentication info in incoming requests

This commit is contained in:
Lambda 2024-06-02 14:34:17 +00:00 committed by Charles Hall
parent f7a0e3012b
commit 0b9e43cbdd
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -38,7 +38,7 @@ use tower_http::{
trace::TraceLayer, trace::TraceLayer,
ServiceBuilderExt as _, ServiceBuilderExt as _,
}; };
use tracing::{debug, info, warn}; use tracing::{debug, info, info_span, warn, Instrument};
pub(crate) mod api; pub(crate) mod api;
pub(crate) mod clap; pub(crate) mod clap;
@ -570,8 +570,17 @@ macro_rules! impl_ruma_handler {
path, path,
on( on(
method_filter, method_filter,
|$( $ty: $ty, )* req| async move { |$( $ty: $ty, )* req: Ar<Req>| async move {
handler($($ty,)* req).await let span = info_span!(
"run_ruma_handler",
auth.user = ?req.sender_user,
auth.device = ?req.sender_device,
auth.servername = ?req.sender_servername,
auth.appservice_id = ?req.appservice_info
.as_ref()
.map(|i| &i.registration.id)
);
handler($($ty,)* req).instrument(span).await
} }
) )
) )