diff --git a/src/api/client/account.rs b/src/api/client/account.rs index 42049b56..71324c1b 100644 --- a/src/api/client/account.rs +++ b/src/api/client/account.rs @@ -40,9 +40,9 @@ const RANDOM_USER_ID_LENGTH: usize = 10; /// /// Note: This will not reserve the username, so the username might become /// invalid when trying to register -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "register_available")] pub(crate) async fn get_register_available_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { // Validate user id let user_id = UserId::parse_with_server_name(body.username.to_lowercase(), services().globals.server_name()) @@ -89,9 +89,9 @@ pub(crate) async fn get_register_available_route( /// - If `inhibit_login` is false: Creates a device and returns device id and /// access_token #[allow(clippy::doc_markdown)] -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "register")] pub(crate) async fn register_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { if !services().globals.allow_registration() && body.appservice_info.is_none() { info!( @@ -302,7 +302,7 @@ pub(crate) async fn register_route( services() .admin .send_message(RoomMessageEventContent::notice_plain(format!( - "New user \"{user_id}\" registered on this server from IP {client_ip}." + "New user \"{user_id}\" registered on this server from IP {client}." ))) .await; } @@ -321,7 +321,7 @@ pub(crate) async fn register_route( .admin .send_message(RoomMessageEventContent::notice_plain(format!( "Guest user \"{user_id}\" with device display name `{device_display_name}` registered on this \ - server from IP {client_ip}." + server from IP {client}." ))) .await; } else { @@ -329,7 +329,7 @@ pub(crate) async fn register_route( .admin .send_message(RoomMessageEventContent::notice_plain(format!( "Guest user \"{user_id}\" with no device display name registered on this server from IP \ - {client_ip}.", + {client}.", ))) .await; } @@ -337,8 +337,7 @@ pub(crate) async fn register_route( services() .admin .send_message(RoomMessageEventContent::notice_plain(format!( - "Guest user \"{user_id}\" with no device display name registered on this server from IP \ - {client_ip}.", + "Guest user \"{user_id}\" with no device display name registered on this server from IP {client}.", ))) .await; } @@ -420,9 +419,9 @@ pub(crate) async fn register_route( /// last seen ts) /// - Forgets to-device events /// - Triggers device list updates -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "change_password")] pub(crate) async fn change_password_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_device = body.sender_device.as_ref().expect("user is authenticated"); @@ -509,9 +508,9 @@ pub(crate) async fn whoami_route(body: Ruma) -> Result, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_device = body.sender_device.as_ref().expect("user is authenticated"); diff --git a/src/api/client/directory.rs b/src/api/client/directory.rs index 20f0ccca..7671b90a 100644 --- a/src/api/client/directory.rs +++ b/src/api/client/directory.rs @@ -28,9 +28,9 @@ use crate::{service::server_is_ours, services, Error, Result, Ruma}; /// Lists the public rooms on this server. /// /// - Rooms are ordered by the number of joined members -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "publicrooms")] pub(crate) async fn get_public_rooms_filtered_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { if let Some(server) = &body.server { if services() @@ -66,9 +66,9 @@ pub(crate) async fn get_public_rooms_filtered_route( /// Lists the public rooms on this server. /// /// - Rooms are ordered by the number of joined members -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "publicrooms")] pub(crate) async fn get_public_rooms_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { if let Some(server) = &body.server { if services() @@ -109,9 +109,9 @@ pub(crate) async fn get_public_rooms_route( /// Sets the visibility of a given room in the room directory. /// /// - TODO: Access control checks -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "room_directory")] pub(crate) async fn set_room_visibility_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { let sender_user = body.sender_user.as_ref().expect("user is authenticated"); diff --git a/src/api/client/membership.rs b/src/api/client/membership.rs index 111d03c4..88cbdd44 100644 --- a/src/api/client/membership.rs +++ b/src/api/client/membership.rs @@ -165,7 +165,7 @@ async fn banned_room_check( /// rules locally /// - If the server does not know about the room: asks other servers over /// federation -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client_ip), name = "join")] pub(crate) async fn join_room_by_id_route( InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, ) -> Result { @@ -218,16 +218,16 @@ pub(crate) async fn join_room_by_id_route( /// - If the server does not know about the room: use the server name query /// param if specified. if not specified, asks other servers over federation /// via room alias server name and room ID server name -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "join")] pub(crate) async fn join_room_by_id_or_alias_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { let sender_user = body.sender_user.as_deref().expect("user is authenticated"); let body = body.body; let (servers, room_id) = match OwnedRoomId::try_from(body.room_id_or_alias) { Ok(room_id) => { - banned_room_check(sender_user, Some(&room_id), room_id.server_name(), client_ip).await?; + banned_room_check(sender_user, Some(&room_id), room_id.server_name(), client).await?; let mut servers = body.server_name.clone(); servers.extend( @@ -261,7 +261,7 @@ pub(crate) async fn join_room_by_id_or_alias_route( Err(room_alias) => { let response = get_alias_helper(room_alias.clone(), Some(body.server_name.clone())).await?; - banned_room_check(sender_user, Some(&response.room_id), Some(room_alias.server_name()), client_ip).await?; + banned_room_check(sender_user, Some(&response.room_id), Some(room_alias.server_name()), client).await?; let mut servers = body.server_name; servers.extend(response.servers); @@ -321,9 +321,9 @@ pub(crate) async fn leave_room_route(body: Ruma) -> Res /// # `POST /_matrix/client/r0/rooms/{roomId}/invite` /// /// Tries to send an invite event into the room. -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "invite")] pub(crate) async fn invite_user_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { let sender_user = body.sender_user.as_ref().expect("user is authenticated"); @@ -338,7 +338,7 @@ pub(crate) async fn invite_user_route( )); } - banned_room_check(sender_user, Some(&body.room_id), body.room_id.server_name(), client_ip).await?; + banned_room_check(sender_user, Some(&body.room_id), body.room_id.server_name(), client).await?; if let invite_user::v3::InvitationRecipient::UserId { user_id, diff --git a/src/api/client/sync.rs b/src/api/client/sync.rs index 9e9a9ffd..738c94d7 100644 --- a/src/api/client/sync.rs +++ b/src/api/client/sync.rs @@ -312,7 +312,7 @@ pub(crate) async fn sync_events_route( Ok(response) } -#[tracing::instrument(skip_all, fields(user_id = %sender_user, room_id = %room_id))] +#[tracing::instrument(skip_all, fields(user_id = %sender_user, room_id = %room_id), name = "left_room")] async fn handle_left_room( since: u64, room_id: &RoomId, sender_user: &UserId, left_rooms: &mut BTreeMap, next_batch_string: &str, full_state: bool, lazy_load_enabled: bool, diff --git a/src/api/server/invite.rs b/src/api/server/invite.rs index 1b256b4a..333ebee6 100644 --- a/src/api/server/invite.rs +++ b/src/api/server/invite.rs @@ -17,9 +17,9 @@ use crate::{ /// # `PUT /_matrix/federation/v2/invite/{roomId}/{eventId}` /// /// Invites a remote user to a room. -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "invite")] pub(crate) async fn create_invite_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { let origin = body.origin.as_ref().expect("server is authenticated"); diff --git a/src/api/server/publicrooms.rs b/src/api/server/publicrooms.rs index 6b5010e5..13edd8d6 100644 --- a/src/api/server/publicrooms.rs +++ b/src/api/server/publicrooms.rs @@ -12,9 +12,9 @@ use crate::{services, Error, Result, Ruma}; /// # `POST /_matrix/federation/v1/publicRooms` /// /// Lists the public rooms on this server. -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "publicrooms")] pub(crate) async fn get_public_rooms_filtered_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { if !services() .globals @@ -44,9 +44,9 @@ pub(crate) async fn get_public_rooms_filtered_route( /// # `GET /_matrix/federation/v1/publicRooms` /// /// Lists the public rooms on this server. -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), "publicrooms")] pub(crate) async fn get_public_rooms_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { if !services() .globals diff --git a/src/api/server/send.rs b/src/api/server/send.rs index e147f652..1168dd82 100644 --- a/src/api/server/send.rs +++ b/src/api/server/send.rs @@ -26,9 +26,9 @@ use crate::{ /// # `PUT /_matrix/federation/v1/send/{txnId}` /// /// Push EDUs and PDUs to this server. -#[tracing::instrument(skip_all, fields(%client_ip))] +#[tracing::instrument(skip_all, fields(%client), name = "send")] pub(crate) async fn send_transaction_message_route( - InsecureClientIp(client_ip): InsecureClientIp, body: Ruma, + InsecureClientIp(client): InsecureClientIp, body: Ruma, ) -> Result { let origin = body.origin.as_ref().expect("server is authenticated");