From f35cbfd89e909a7c7fb365f399a0bd8015474a36 Mon Sep 17 00:00:00 2001 From: Lambda Date: Thu, 23 May 2024 21:53:23 +0000 Subject: [PATCH] More tracing spans --- src/api/client_server/sync.rs | 1 + src/api/server_server.rs | 5 +++++ src/database/key_value/rooms/edus/read_receipt.rs | 1 + src/database/key_value/users.rs | 8 ++++++++ 4 files changed, 15 insertions(+) diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index 45d617b2..ae779f92 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -461,6 +461,7 @@ pub(crate) async fn sync_events_route( Ok(Ra(response)) } +#[tracing::instrument(skip_all, fields(room_id = %room_id))] #[allow(clippy::too_many_arguments, clippy::too_many_lines)] async fn load_joined_room( sender_user: &UserId, diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 38e37304..09cc0799 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -361,6 +361,7 @@ fn add_port_to_hostname(destination_str: &str) -> FedDest { /// Numbers in comments below refer to bullet points in linked section of /// specification #[allow(clippy::too_many_lines)] +#[tracing::instrument(ret(level = "debug"))] async fn find_actual_destination( destination: &'_ ServerName, ) -> (FedDest, FedDest) { @@ -504,6 +505,7 @@ async fn find_actual_destination( (actual_destination, hostname) } +#[tracing::instrument(ret(level = "debug"))] async fn query_given_srv_record(record: &str) -> Option { services() .globals @@ -525,6 +527,7 @@ async fn query_given_srv_record(record: &str) -> Option { .unwrap_or(None) } +#[tracing::instrument(ret(level = "debug"))] async fn query_srv_record(hostname: &'_ str) -> Option { let hostname = hostname.trim_end_matches('.'); @@ -537,6 +540,7 @@ async fn query_srv_record(hostname: &'_ str) -> Option { } } +#[tracing::instrument(ret(level = "debug"))] async fn request_well_known(destination: &str) -> Option { let response = services() .globals @@ -678,6 +682,7 @@ pub(crate) async fn get_public_rooms_route( })) } +#[tracing::instrument(skip(pdu))] pub(crate) fn parse_incoming_pdu( pdu: &RawJsonValue, ) -> Result<(OwnedEventId, CanonicalJsonObject, OwnedRoomId)> { diff --git a/src/database/key_value/rooms/edus/read_receipt.rs b/src/database/key_value/rooms/edus/read_receipt.rs index 28b66c27..a897ca6d 100644 --- a/src/database/key_value/rooms/edus/read_receipt.rs +++ b/src/database/key_value/rooms/edus/read_receipt.rs @@ -10,6 +10,7 @@ use crate::{ }; impl service::rooms::edus::read_receipt::Data for KeyValueDatabase { + #[tracing::instrument(skip(self, event))] fn readreceipt_update( &self, user_id: &UserId, diff --git a/src/database/key_value/users.rs b/src/database/key_value/users.rs index 6c4e4337..b0c209ce 100644 --- a/src/database/key_value/users.rs +++ b/src/database/key_value/users.rs @@ -489,6 +489,7 @@ impl service::users::Data for KeyValueDatabase { Ok(counts) } + #[tracing::instrument(skip(self, device_keys))] fn add_device_keys( &self, user_id: &UserId, @@ -510,6 +511,12 @@ impl service::users::Data for KeyValueDatabase { Ok(()) } + #[tracing::instrument(skip( + self, + master_key, + self_signing_key, + user_signing_key + ))] fn add_cross_signing_keys( &self, user_id: &UserId, @@ -724,6 +731,7 @@ impl service::users::Data for KeyValueDatabase { ) } + #[tracing::instrument(skip(self))] fn mark_device_key_update(&self, user_id: &UserId) -> Result<()> { let count = services().globals.next_count()?.to_be_bytes(); for room_id in services()