mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
Record authentication info in incoming requests
This commit is contained in:
parent
f7a0e3012b
commit
0b9e43cbdd
1 changed files with 12 additions and 3 deletions
15
src/main.rs
15
src/main.rs
|
|
@ -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
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue