diff --git a/src/core/pdu/mod.rs b/src/core/pdu/mod.rs index c7d93608..0c54812e 100644 --- a/src/core/pdu/mod.rs +++ b/src/core/pdu/mod.rs @@ -64,7 +64,7 @@ pub struct PduEvent { } impl PduEvent { - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn redact(&mut self, room_version_id: RoomVersionId, reason: &Self) -> crate::Result<()> { self.unsigned = None; @@ -158,7 +158,7 @@ impl PduEvent { (self.redacts.clone(), self.content.clone()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_sync_room_event(&self) -> Raw { let (redacts, content) = self.copy_redacts(); let mut json = json!({ @@ -183,7 +183,7 @@ impl PduEvent { } /// This only works for events that are also AnyRoomEvents. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_any_event(&self) -> Raw { let (redacts, content) = self.copy_redacts(); let mut json = json!({ @@ -208,7 +208,7 @@ impl PduEvent { serde_json::from_value(json).expect("Raw::from_value always works") } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_room_event(&self) -> Raw { let (redacts, content) = self.copy_redacts(); let mut json = json!({ @@ -233,7 +233,7 @@ impl PduEvent { serde_json::from_value(json).expect("Raw::from_value always works") } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_message_like_event(&self) -> Raw { let (redacts, content) = self.copy_redacts(); let mut json = json!({ @@ -258,7 +258,7 @@ impl PduEvent { serde_json::from_value(json).expect("Raw::from_value always works") } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_state_event(&self) -> Raw { let mut json = json!({ "content": self.content, @@ -277,7 +277,7 @@ impl PduEvent { serde_json::from_value(json).expect("Raw::from_value always works") } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_sync_state_event(&self) -> Raw { let mut json = json!({ "content": self.content, @@ -295,7 +295,7 @@ impl PduEvent { serde_json::from_value(json).expect("Raw::from_value always works") } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_stripped_state_event(&self) -> Raw { let json = json!({ "content": self.content, @@ -307,7 +307,7 @@ impl PduEvent { serde_json::from_value(json).expect("Raw::from_value always works") } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_stripped_spacechild_state_event(&self) -> Raw { let json = json!({ "content": self.content, @@ -320,7 +320,7 @@ impl PduEvent { serde_json::from_value(json).expect("Raw::from_value always works") } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn to_member_event(&self) -> Raw> { let mut json = json!({ "content": self.content, diff --git a/src/core/utils/content_disposition.rs b/src/core/utils/content_disposition.rs index 1c2b066d..be17a731 100644 --- a/src/core/utils/content_disposition.rs +++ b/src/core/utils/content_disposition.rs @@ -66,7 +66,7 @@ pub fn content_disposition_type(content_type: &Option) -> &'static str { /// sanitises the file name for the Content-Disposition using /// `sanitize_filename` crate -#[tracing::instrument] +#[tracing::instrument(level = "debug")] pub fn sanitise_filename(filename: String) -> String { let options = sanitize_filename::Options { truncate: false, diff --git a/src/core/utils/hash/sha256.rs b/src/core/utils/hash/sha256.rs index 6a1f1879..b2e5a94c 100644 --- a/src/core/utils/hash/sha256.rs +++ b/src/core/utils/hash/sha256.rs @@ -1,6 +1,6 @@ use ring::{digest, digest::SHA256}; -#[tracing::instrument(skip_all)] +#[tracing::instrument(skip_all, level = "debug")] pub(super) fn hash(keys: &[&[u8]]) -> Vec { // We only hash the pdu's event ids, not the whole pdu let bytes = keys.join(&0xFF); diff --git a/src/router/request.rs b/src/router/request.rs index 2bdd06f8..49a31c29 100644 --- a/src/router/request.rs +++ b/src/router/request.rs @@ -9,7 +9,7 @@ use ruma::api::client::{ }; use tracing::{debug, error, trace}; -#[tracing::instrument(skip_all)] +#[tracing::instrument(skip_all, level = "debug")] pub(crate) async fn spawn( State(server): State>, req: http::Request, next: axum::middleware::Next, ) -> Result { diff --git a/src/service/account_data/mod.rs b/src/service/account_data/mod.rs index 66474370..69d2f799 100644 --- a/src/service/account_data/mod.rs +++ b/src/service/account_data/mod.rs @@ -44,7 +44,7 @@ impl Service { } /// Returns all changes to the account data that happened after `since`. - #[tracing::instrument(skip_all, name = "since")] + #[tracing::instrument(skip_all, name = "since", level = "debug")] pub fn changes_since( &self, room_id: Option<&RoomId>, user_id: &UserId, since: u64, ) -> Result>> { diff --git a/src/service/globals/data.rs b/src/service/globals/data.rs index 083aec3c..254a3d9c 100644 --- a/src/service/globals/data.rs +++ b/src/service/globals/data.rs @@ -110,7 +110,7 @@ impl Data { Ok(()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub async fn watch(&self, user_id: &UserId, device_id: &DeviceId) -> Result<()> { let userid_bytes = user_id.as_bytes().to_vec(); let mut userid_prefix = userid_bytes.clone(); diff --git a/src/service/globals/mod.rs b/src/service/globals/mod.rs index f28299b2..11bfc88c 100644 --- a/src/service/globals/mod.rs +++ b/src/service/globals/mod.rs @@ -189,10 +189,10 @@ impl Service { #[inline] pub fn current_count(&self) -> Result { Ok(self.db.current_count()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn last_check_for_updates_id(&self) -> Result { self.db.last_check_for_updates_id() } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn update_check_for_updates_id(&self, id: u64) -> Result<()> { self.db.update_check_for_updates_id(id) } pub async fn watch(&self, user_id: &UserId, device_id: &DeviceId) -> Result<()> { diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs index 27b49c28..ea48ea7c 100644 --- a/src/service/pusher/mod.rs +++ b/src/service/pusher/mod.rs @@ -186,7 +186,7 @@ impl Service { Ok(()) } - #[tracing::instrument(skip(self, user, ruleset, pdu))] + #[tracing::instrument(skip(self, user, ruleset, pdu), level = "debug")] pub fn get_actions<'a>( &self, user: &UserId, ruleset: &'a Ruleset, power_levels: &RoomPowerLevelsEventContent, pdu: &Raw, room_id: &RoomId, diff --git a/src/service/rooms/alias/mod.rs b/src/service/rooms/alias/mod.rs index d375561e..706bf2f8 100644 --- a/src/service/rooms/alias/mod.rs +++ b/src/service/rooms/alias/mod.rs @@ -89,19 +89,19 @@ impl Service { ) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn resolve_local_alias(&self, alias: &RoomAliasId) -> Result> { self.db.resolve_local_alias(alias) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn local_aliases_for_room<'a>( &'a self, room_id: &RoomId, ) -> Box> + 'a> { self.db.local_aliases_for_room(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn all_local_aliases<'a>(&'a self) -> Box> + 'a> { self.db.all_local_aliases() } diff --git a/src/service/rooms/auth_chain/mod.rs b/src/service/rooms/auth_chain/mod.rs index 7b2a4f01..2919ea7e 100644 --- a/src/service/rooms/auth_chain/mod.rs +++ b/src/service/rooms/auth_chain/mod.rs @@ -174,13 +174,13 @@ impl Service { self.db.get_cached_eventid_authchain(key) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn cache_auth_chain(&self, key: Vec, auth_chain: &HashSet) -> Result<()> { self.db .cache_auth_chain(key, auth_chain.iter().copied().collect::>()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn cache_auth_chain_vec(&self, key: Vec, auth_chain: &Vec) -> Result<()> { self.db .cache_auth_chain(key, auth_chain.iter().copied().collect::>()) diff --git a/src/service/rooms/directory/mod.rs b/src/service/rooms/directory/mod.rs index 3e60831c..23ec6b6b 100644 --- a/src/service/rooms/directory/mod.rs +++ b/src/service/rooms/directory/mod.rs @@ -22,15 +22,15 @@ impl crate::Service for Service { } impl Service { - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn set_public(&self, room_id: &RoomId) -> Result<()> { self.db.set_public(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn set_not_public(&self, room_id: &RoomId) -> Result<()> { self.db.set_not_public(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn is_public_room(&self, room_id: &RoomId) -> Result { self.db.is_public_room(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn public_rooms(&self) -> impl Iterator> + '_ { self.db.public_rooms() } } diff --git a/src/service/rooms/event_handler/signing_keys.rs b/src/service/rooms/event_handler/signing_keys.rs index fdb2be0e..2fa5b0df 100644 --- a/src/service/rooms/event_handler/signing_keys.rs +++ b/src/service/rooms/event_handler/signing_keys.rs @@ -3,6 +3,7 @@ use std::{ time::{Duration, SystemTime}, }; +use conduit::{debug, error, info, trace, warn}; use futures_util::{stream::FuturesUnordered, StreamExt}; use ruma::{ api::federation::{ @@ -19,7 +20,6 @@ use ruma::{ }; use serde_json::value::RawValue as RawJsonValue; use tokio::sync::{RwLock, RwLockWriteGuard}; -use tracing::{debug, error, info, trace, warn}; use crate::{services, Error, Result}; diff --git a/src/service/rooms/lazy_loading/mod.rs b/src/service/rooms/lazy_loading/mod.rs index 185cfd8c..96f623f2 100644 --- a/src/service/rooms/lazy_loading/mod.rs +++ b/src/service/rooms/lazy_loading/mod.rs @@ -39,7 +39,7 @@ impl crate::Service for Service { } impl Service { - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn lazy_load_was_sent_before( &self, user_id: &UserId, device_id: &DeviceId, room_id: &RoomId, ll_user: &UserId, ) -> Result { @@ -47,7 +47,7 @@ impl Service { .lazy_load_was_sent_before(user_id, device_id, room_id, ll_user) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub async fn lazy_load_mark_sent( &self, user_id: &UserId, device_id: &DeviceId, room_id: &RoomId, lazy_load: HashSet, count: PduCount, @@ -58,7 +58,7 @@ impl Service { .insert((user_id.to_owned(), device_id.to_owned(), room_id.to_owned(), count), lazy_load); } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub async fn lazy_load_confirm_delivery( &self, user_id: &UserId, device_id: &DeviceId, room_id: &RoomId, since: PduCount, ) -> Result<()> { @@ -77,7 +77,7 @@ impl Service { Ok(()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn lazy_load_reset(&self, user_id: &UserId, device_id: &DeviceId, room_id: &RoomId) -> Result<()> { self.db.lazy_load_reset(user_id, device_id, room_id) } diff --git a/src/service/rooms/outlier/mod.rs b/src/service/rooms/outlier/mod.rs index a7326f42..22bd2092 100644 --- a/src/service/rooms/outlier/mod.rs +++ b/src/service/rooms/outlier/mod.rs @@ -35,7 +35,7 @@ impl Service { pub fn get_pdu_outlier(&self, event_id: &EventId) -> Result> { self.db.get_outlier_pdu(event_id) } /// Append the PDU as an outlier. - #[tracing::instrument(skip(self, pdu))] + #[tracing::instrument(skip(self, pdu), level = "debug")] pub fn add_pdu_outlier(&self, event_id: &EventId, pdu: &CanonicalJsonObject) -> Result<()> { self.db.add_pdu_outlier(event_id, pdu) } diff --git a/src/service/rooms/pdu_metadata/mod.rs b/src/service/rooms/pdu_metadata/mod.rs index cdb2fc29..05067aa8 100644 --- a/src/service/rooms/pdu_metadata/mod.rs +++ b/src/service/rooms/pdu_metadata/mod.rs @@ -38,7 +38,7 @@ impl crate::Service for Service { } impl Service { - #[tracing::instrument(skip(self, from, to))] + #[tracing::instrument(skip(self, from, to), level = "debug")] pub fn add_relation(&self, from: PduCount, to: PduCount) -> Result<()> { match (from, to) { (PduCount::Normal(f), PduCount::Normal(t)) => self.db.add_relation(f, t), @@ -218,19 +218,19 @@ impl Service { }) } - #[tracing::instrument(skip(self, room_id, event_ids))] + #[tracing::instrument(skip_all, level = "debug")] pub fn mark_as_referenced(&self, room_id: &RoomId, event_ids: &[Arc]) -> Result<()> { self.db.mark_as_referenced(room_id, event_ids) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn is_event_referenced(&self, room_id: &RoomId, event_id: &EventId) -> Result { self.db.is_event_referenced(room_id, event_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn mark_event_soft_failed(&self, event_id: &EventId) -> Result<()> { self.db.mark_event_soft_failed(event_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn is_event_soft_failed(&self, event_id: &EventId) -> Result { self.db.is_event_soft_failed(event_id) } } diff --git a/src/service/rooms/read_receipt/mod.rs b/src/service/rooms/read_receipt/mod.rs index e46027b7..9375276e 100644 --- a/src/service/rooms/read_receipt/mod.rs +++ b/src/service/rooms/read_receipt/mod.rs @@ -33,7 +33,7 @@ impl Service { /// Returns an iterator over the most recent read_receipts in a room that /// happened after the event with id `since`. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn readreceipts_since<'a>( &'a self, room_id: &RoomId, since: u64, ) -> impl Iterator)>> + 'a { @@ -41,13 +41,13 @@ impl Service { } /// Sets a private read marker at `count`. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn private_read_set(&self, room_id: &RoomId, user_id: &UserId, count: u64) -> Result<()> { self.db.private_read_set(room_id, user_id, count) } /// Returns the private read marker. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn private_read_get(&self, room_id: &RoomId, user_id: &UserId) -> Result> { self.db.private_read_get(room_id, user_id) } diff --git a/src/service/rooms/search/mod.rs b/src/service/rooms/search/mod.rs index 7573d218..082dd432 100644 --- a/src/service/rooms/search/mod.rs +++ b/src/service/rooms/search/mod.rs @@ -21,17 +21,17 @@ impl crate::Service for Service { } impl Service { - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn index_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> { self.db.index_pdu(shortroomid, pdu_id, message_body) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn deindex_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> { self.db.deindex_pdu(shortroomid, pdu_id, message_body) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn search_pdus<'a>( &'a self, room_id: &RoomId, search_string: &str, ) -> Result> + 'a, Vec)>> { diff --git a/src/service/rooms/state/mod.rs b/src/service/rooms/state/mod.rs index 7964a5fb..52ee89d1 100644 --- a/src/service/rooms/state/mod.rs +++ b/src/service/rooms/state/mod.rs @@ -116,7 +116,7 @@ impl Service { /// /// This adds all current state events (not including the incoming event) /// to `stateid_pduid` and adds the incoming event to `eventid_statehash`. - #[tracing::instrument(skip(self, state_ids_compressed))] + #[tracing::instrument(skip(self, state_ids_compressed), level = "debug")] pub fn set_event_state( &self, event_id: &EventId, room_id: &RoomId, state_ids_compressed: Arc>, ) -> Result { @@ -184,7 +184,7 @@ impl Service { /// /// This adds all current state events (not including the incoming event) /// to `stateid_pduid` and adds the incoming event to `eventid_statehash`. - #[tracing::instrument(skip(self, new_pdu))] + #[tracing::instrument(skip(self, new_pdu), level = "debug")] pub fn append_to_state(&self, new_pdu: &PduEvent) -> Result { let shorteventid = services() .rooms @@ -257,7 +257,7 @@ impl Service { } } - #[tracing::instrument(skip(self, invite_event))] + #[tracing::instrument(skip(self, invite_event), level = "debug")] pub fn calculate_invite_state(&self, invite_event: &PduEvent) -> Result>> { let mut state = Vec::new(); // Add recommended events @@ -313,7 +313,7 @@ impl Service { } /// Set the state hash to a new version, but does not update state_cache. - #[tracing::instrument(skip(self, mutex_lock))] + #[tracing::instrument(skip(self, mutex_lock), level = "debug")] pub fn set_room_state( &self, room_id: &RoomId, @@ -324,7 +324,7 @@ impl Service { } /// Returns the room's version. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn get_room_version(&self, room_id: &RoomId) -> Result { let create_event = services() .rooms @@ -365,7 +365,7 @@ impl Service { } /// This fetches auth events from the current state. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn get_auth_events( &self, room_id: &RoomId, kind: &TimelineEventType, sender: &UserId, state_key: Option<&str>, content: &serde_json::value::RawValue, diff --git a/src/service/rooms/state_accessor/mod.rs b/src/service/rooms/state_accessor/mod.rs index e8554500..a3567857 100644 --- a/src/service/rooms/state_accessor/mod.rs +++ b/src/service/rooms/state_accessor/mod.rs @@ -81,7 +81,7 @@ impl crate::Service for Service { impl Service { /// Builds a StateMap by iterating over all keys that start /// with state_hash, this gives the full state for the given state_hash. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub async fn state_full_ids(&self, shortstatehash: u64) -> Result>> { self.db.state_full_ids(shortstatehash).await } @@ -92,7 +92,7 @@ impl Service { /// Returns a single PDU from `room_id` with key (`event_type`, /// `state_key`). - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn state_get_id( &self, shortstatehash: u64, event_type: &StateEventType, state_key: &str, ) -> Result>> { @@ -286,14 +286,14 @@ impl Service { pub fn pdu_shortstatehash(&self, event_id: &EventId) -> Result> { self.db.pdu_shortstatehash(event_id) } /// Returns the full room state. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub async fn room_state_full(&self, room_id: &RoomId) -> Result>> { self.db.room_state_full(room_id).await } /// Returns a single PDU from `room_id` with key (`event_type`, /// `state_key`). - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_state_get_id( &self, room_id: &RoomId, event_type: &StateEventType, state_key: &str, ) -> Result>> { @@ -302,7 +302,7 @@ impl Service { /// Returns a single PDU from `room_id` with key (`event_type`, /// `state_key`). - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_state_get( &self, room_id: &RoomId, event_type: &StateEventType, state_key: &str, ) -> Result>> { diff --git a/src/service/rooms/state_cache/data.rs b/src/service/rooms/state_cache/data.rs index 0120d5a6..2b9fbe94 100644 --- a/src/service/rooms/state_cache/data.rs +++ b/src/service/rooms/state_cache/data.rs @@ -213,7 +213,7 @@ impl Data { Ok(()) } - #[tracing::instrument(skip(self, room_id, appservice))] + #[tracing::instrument(skip(self, room_id, appservice), level = "debug")] pub(super) fn appservice_in_room(&self, room_id: &RoomId, appservice: &RegistrationInfo) -> Result { let maybe = self .appservice_in_room_cache @@ -249,7 +249,7 @@ impl Data { } /// Makes a user forget a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn forget(&self, room_id: &RoomId, user_id: &UserId) -> Result<()> { let mut userroom_id = user_id.as_bytes().to_vec(); userroom_id.push(0xFF); @@ -266,7 +266,7 @@ impl Data { } /// Returns an iterator of all servers participating in this room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn room_servers<'a>( &'a self, room_id: &RoomId, ) -> Box> + 'a> { @@ -286,7 +286,7 @@ impl Data { })) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn server_in_room(&self, server: &ServerName, room_id: &RoomId) -> Result { let mut key = server.as_bytes().to_vec(); key.push(0xFF); @@ -297,7 +297,7 @@ impl Data { /// Returns an iterator of all rooms a server participates in (as far as we /// know). - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn server_rooms<'a>( &'a self, server: &ServerName, ) -> Box> + 'a> { @@ -318,7 +318,7 @@ impl Data { } /// Returns an iterator of all joined members of a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn room_members<'a>( &'a self, room_id: &RoomId, ) -> Box> + Send + 'a> { @@ -350,7 +350,7 @@ impl Data { /// Returns an iterator of all our local joined users in a room who are /// active (not deactivated, not guest) - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn active_local_users_in_room<'a>( &'a self, room_id: &RoomId, ) -> Box + 'a> { @@ -361,7 +361,7 @@ impl Data { } /// Returns the number of users which are currently in a room - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn room_joined_count(&self, room_id: &RoomId) -> Result> { self.roomid_joinedcount .get(room_id.as_bytes())? @@ -370,7 +370,7 @@ impl Data { } /// Returns the number of users which are currently invited to a room - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn room_invited_count(&self, room_id: &RoomId) -> Result> { self.roomid_invitedcount .get(room_id.as_bytes())? @@ -379,7 +379,7 @@ impl Data { } /// Returns an iterator over all User IDs who ever joined a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn room_useroncejoined<'a>( &'a self, room_id: &RoomId, ) -> Box> + 'a> { @@ -404,7 +404,7 @@ impl Data { } /// Returns an iterator over all invited members of a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn room_members_invited<'a>( &'a self, room_id: &RoomId, ) -> Box> + 'a> { @@ -428,7 +428,7 @@ impl Data { ) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn get_invite_count(&self, room_id: &RoomId, user_id: &UserId) -> Result> { let mut key = room_id.as_bytes().to_vec(); key.push(0xFF); @@ -443,7 +443,7 @@ impl Data { }) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn get_left_count(&self, room_id: &RoomId, user_id: &UserId) -> Result> { let mut key = room_id.as_bytes().to_vec(); key.push(0xFF); @@ -456,7 +456,7 @@ impl Data { } /// Returns an iterator over all rooms this user joined. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn rooms_joined(&self, user_id: &UserId) -> Box> + '_> { Box::new( self.userroomid_joined @@ -476,7 +476,7 @@ impl Data { } /// Returns an iterator over all rooms a user was invited to. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn rooms_invited<'a>(&'a self, user_id: &UserId) -> StrippedStateEventIter<'a> { let mut prefix = user_id.as_bytes().to_vec(); prefix.push(0xFF); @@ -503,7 +503,7 @@ impl Data { ) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn invite_state( &self, user_id: &UserId, room_id: &RoomId, ) -> Result>>> { @@ -522,7 +522,7 @@ impl Data { .transpose() } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn left_state( &self, user_id: &UserId, room_id: &RoomId, ) -> Result>>> { @@ -542,7 +542,7 @@ impl Data { } /// Returns an iterator over all rooms a user left. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn rooms_left<'a>(&'a self, user_id: &UserId) -> AnySyncStateEventIter<'a> { let mut prefix = user_id.as_bytes().to_vec(); prefix.push(0xFF); @@ -569,7 +569,7 @@ impl Data { ) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn once_joined(&self, user_id: &UserId, room_id: &RoomId) -> Result { let mut userroom_id = user_id.as_bytes().to_vec(); userroom_id.push(0xFF); @@ -578,7 +578,7 @@ impl Data { Ok(self.roomuseroncejoinedids.get(&userroom_id)?.is_some()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn is_joined(&self, user_id: &UserId, room_id: &RoomId) -> Result { let mut userroom_id = user_id.as_bytes().to_vec(); userroom_id.push(0xFF); @@ -587,7 +587,7 @@ impl Data { Ok(self.userroomid_joined.get(&userroom_id)?.is_some()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn is_invited(&self, user_id: &UserId, room_id: &RoomId) -> Result { let mut userroom_id = user_id.as_bytes().to_vec(); userroom_id.push(0xFF); @@ -596,7 +596,7 @@ impl Data { Ok(self.userroomid_invitestate.get(&userroom_id)?.is_some()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn is_left(&self, user_id: &UserId, room_id: &RoomId) -> Result { let mut userroom_id = user_id.as_bytes().to_vec(); userroom_id.push(0xFF); @@ -605,7 +605,7 @@ impl Data { Ok(self.userroomid_leftstate.get(&userroom_id)?.is_some()) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn servers_invite_via<'a>( &'a self, room_id: &RoomId, ) -> Box> + 'a> { @@ -631,7 +631,7 @@ impl Data { ) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub(super) fn add_servers_invite_via(&self, room_id: &RoomId, servers: &[OwnedServerName]) -> Result<()> { let mut prev_servers = self .servers_invite_via(room_id) diff --git a/src/service/rooms/state_cache/mod.rs b/src/service/rooms/state_cache/mod.rs index a0910c7c..30fd7bf4 100644 --- a/src/service/rooms/state_cache/mod.rs +++ b/src/service/rooms/state_cache/mod.rs @@ -219,10 +219,10 @@ impl Service { Ok(()) } - #[tracing::instrument(skip(self, room_id))] + #[tracing::instrument(skip(self, room_id), level = "debug")] pub fn update_joined_count(&self, room_id: &RoomId) -> Result<()> { self.db.update_joined_count(room_id) } - #[tracing::instrument(skip(self, room_id, appservice))] + #[tracing::instrument(skip(self, room_id, appservice), level = "debug")] pub fn appservice_in_room(&self, room_id: &RoomId, appservice: &RegistrationInfo) -> Result { self.db.appservice_in_room(room_id, appservice) } @@ -230,7 +230,7 @@ impl Service { /// Direct DB function to directly mark a user as left. It is not /// recommended to use this directly. You most likely should use /// `update_membership` instead - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn mark_as_left(&self, user_id: &UserId, room_id: &RoomId) -> Result<()> { self.db.mark_as_left(user_id, room_id) } @@ -238,35 +238,35 @@ impl Service { /// Direct DB function to directly mark a user as joined. It is not /// recommended to use this directly. You most likely should use /// `update_membership` instead - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn mark_as_joined(&self, user_id: &UserId, room_id: &RoomId) -> Result<()> { self.db.mark_as_joined(user_id, room_id) } /// Makes a user forget a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn forget(&self, room_id: &RoomId, user_id: &UserId) -> Result<()> { self.db.forget(room_id, user_id) } /// Returns an iterator of all servers participating in this room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_servers(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.room_servers(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn server_in_room(&self, server: &ServerName, room_id: &RoomId) -> Result { self.db.server_in_room(server, room_id) } /// Returns an iterator of all rooms a server participates in (as far as we /// know). - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn server_rooms(&self, server: &ServerName) -> impl Iterator> + '_ { self.db.server_rooms(server) } /// Returns true if server can see user by sharing at least one room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn server_sees_user(&self, server: &ServerName, user_id: &UserId) -> Result { Ok(self .server_rooms(server) @@ -275,7 +275,7 @@ impl Service { } /// Returns true if user_a and user_b share at least one room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn user_sees_user(&self, user_a: &UserId, user_b: &UserId) -> Result { // Minimize number of point-queries by iterating user with least nr rooms let (a, b) = if self.rooms_joined(user_a).count() < self.rooms_joined(user_b).count() { @@ -291,23 +291,23 @@ impl Service { } /// Returns an iterator over all joined members of a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_members(&self, room_id: &RoomId) -> impl Iterator> + Send + '_ { self.db.room_members(room_id) } /// Returns the number of users which are currently in a room - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_joined_count(&self, room_id: &RoomId) -> Result> { self.db.room_joined_count(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] /// Returns an iterator of all our local users in the room, even if they're /// deactivated/guests pub fn local_users_in_room<'a>(&'a self, room_id: &RoomId) -> impl Iterator + 'a { self.db.local_users_in_room(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] /// Returns an iterator of all our local joined users in a room who are /// active (not deactivated, not guest) pub fn active_local_users_in_room<'a>(&'a self, room_id: &RoomId) -> impl Iterator + 'a { @@ -315,80 +315,80 @@ impl Service { } /// Returns the number of users which are currently invited to a room - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_invited_count(&self, room_id: &RoomId) -> Result> { self.db.room_invited_count(room_id) } /// Returns an iterator over all User IDs who ever joined a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_useroncejoined(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.room_useroncejoined(room_id) } /// Returns an iterator over all invited members of a room. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn room_members_invited(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.room_members_invited(room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn get_invite_count(&self, room_id: &RoomId, user_id: &UserId) -> Result> { self.db.get_invite_count(room_id, user_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn get_left_count(&self, room_id: &RoomId, user_id: &UserId) -> Result> { self.db.get_left_count(room_id, user_id) } /// Returns an iterator over all rooms this user joined. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn rooms_joined(&self, user_id: &UserId) -> impl Iterator> + '_ { self.db.rooms_joined(user_id) } /// Returns an iterator over all rooms a user was invited to. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn rooms_invited( &self, user_id: &UserId, ) -> impl Iterator>)>> + '_ { self.db.rooms_invited(user_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn invite_state(&self, user_id: &UserId, room_id: &RoomId) -> Result>>> { self.db.invite_state(user_id, room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn left_state(&self, user_id: &UserId, room_id: &RoomId) -> Result>>> { self.db.left_state(user_id, room_id) } /// Returns an iterator over all rooms a user left. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn rooms_left( &self, user_id: &UserId, ) -> impl Iterator>)>> + '_ { self.db.rooms_left(user_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn once_joined(&self, user_id: &UserId, room_id: &RoomId) -> Result { self.db.once_joined(user_id, room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn is_joined(&self, user_id: &UserId, room_id: &RoomId) -> Result { self.db.is_joined(user_id, room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn is_invited(&self, user_id: &UserId, room_id: &RoomId) -> Result { self.db.is_invited(user_id, room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn is_left(&self, user_id: &UserId, room_id: &RoomId) -> Result { self.db.is_left(user_id, room_id) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn servers_invite_via(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.servers_invite_via(room_id) } diff --git a/src/service/rooms/state_compressor/mod.rs b/src/service/rooms/state_compressor/mod.rs index 197efbea..4b4ea7d4 100644 --- a/src/service/rooms/state_compressor/mod.rs +++ b/src/service/rooms/state_compressor/mod.rs @@ -77,7 +77,7 @@ impl crate::Service for Service { impl Service { /// Returns a stack with info on shortstatehash, full state, added diff and /// removed diff for the selected shortstatehash and each parent layer. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn load_shortstatehash_info(&self, shortstatehash: u64) -> ShortStateInfoResult { if let Some(r) = self .stateinfo_cache @@ -162,7 +162,7 @@ impl Service { /// for this layer /// * `parent_states` - A stack with info on shortstatehash, full state, /// added diff and removed diff for each parent layer - #[tracing::instrument(skip(self, statediffnew, statediffremoved, diff_to_sibling, parent_states))] + #[tracing::instrument(skip(self, statediffnew, statediffremoved, diff_to_sibling, parent_states), level = "debug")] pub fn save_state_from_diff( &self, shortstatehash: u64, statediffnew: Arc>, statediffremoved: Arc>, diff_to_sibling: usize, diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index 70f4423c..db7af004 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -99,7 +99,7 @@ impl crate::Service for Service { } impl Service { - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn first_pdu_in_room(&self, room_id: &RoomId) -> Result>> { self.all_pdus(user_id!("@doesntmatter:conduit.rs"), room_id)? .next() @@ -107,7 +107,7 @@ impl Service { .transpose() } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn latest_pdu_in_room(&self, room_id: &RoomId) -> Result>> { self.all_pdus(user_id!("@placeholder:conduwuit.placeholder"), room_id)? .last() @@ -115,7 +115,7 @@ impl Service { .transpose() } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn last_timeline_count(&self, sender_user: &UserId, room_id: &RoomId) -> Result { self.db.last_timeline_count(sender_user, room_id) } @@ -213,7 +213,7 @@ impl Service { } /// Removes a pdu and creates a new one with the same id. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn replace_pdu(&self, pdu_id: &[u8], pdu_json: &CanonicalJsonObject, pdu: &PduEvent) -> Result<()> { self.db.replace_pdu(pdu_id, pdu_json, pdu) } @@ -1030,7 +1030,7 @@ impl Service { /// Returns an iterator over all events and their tokens in a room that /// happened before the event with id `until` in reverse-chronological /// order. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn pdus_until<'a>( &'a self, user_id: &UserId, room_id: &RoomId, until: PduCount, ) -> Result> + 'a> { @@ -1039,7 +1039,7 @@ impl Service { /// Returns an iterator over all events and their token in a room that /// happened after the event with id `from` in chronological order. - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn pdus_after<'a>( &'a self, user_id: &UserId, room_id: &RoomId, from: PduCount, ) -> Result> + 'a> { diff --git a/src/service/sending/data.rs b/src/service/sending/data.rs index ed579817..65725618 100644 --- a/src/service/sending/data.rs +++ b/src/service/sending/data.rs @@ -136,7 +136,7 @@ impl Data { } } -#[tracing::instrument(skip(key))] +#[tracing::instrument(skip(key), level = "debug")] fn parse_servercurrentevent(key: &[u8], value: Vec) -> Result<(Destination, SendingEvent)> { // Appservices start with a plus Ok::<_, Error>(if key.starts_with(b"+") { diff --git a/src/service/sending/mod.rs b/src/service/sending/mod.rs index 0dcebcec..a18240bd 100644 --- a/src/service/sending/mod.rs +++ b/src/service/sending/mod.rs @@ -93,7 +93,7 @@ impl crate::Service for Service { } impl Service { - #[tracing::instrument(skip(self, pdu_id, user, pushkey))] + #[tracing::instrument(skip(self, pdu_id, user, pushkey), level = "debug")] pub fn send_pdu_push(&self, pdu_id: &[u8], user: &UserId, pushkey: String) -> Result<()> { let dest = Destination::Push(user.to_owned(), pushkey); let event = SendingEvent::Pdu(pdu_id.to_owned()); @@ -106,7 +106,7 @@ impl Service { }) } - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn send_pdu_appservice(&self, appservice_id: String, pdu_id: Vec) -> Result<()> { let dest = Destination::Appservice(appservice_id); let event = SendingEvent::Pdu(pdu_id); @@ -119,7 +119,7 @@ impl Service { }) } - #[tracing::instrument(skip(self, room_id, pdu_id))] + #[tracing::instrument(skip(self, room_id, pdu_id), level = "debug")] pub fn send_pdu_room(&self, room_id: &RoomId, pdu_id: &[u8]) -> Result<()> { let servers = services() .rooms @@ -131,7 +131,7 @@ impl Service { self.send_pdu_servers(servers, pdu_id) } - #[tracing::instrument(skip(self, servers, pdu_id))] + #[tracing::instrument(skip(self, servers, pdu_id), level = "debug")] pub fn send_pdu_servers>(&self, servers: I, pdu_id: &[u8]) -> Result<()> { let requests = servers .into_iter() @@ -155,7 +155,7 @@ impl Service { Ok(()) } - #[tracing::instrument(skip(self, server, serialized))] + #[tracing::instrument(skip(self, server, serialized), level = "debug")] pub fn send_edu_server(&self, server: &ServerName, serialized: Vec) -> Result<()> { let dest = Destination::Normal(server.to_owned()); let event = SendingEvent::Edu(serialized); @@ -168,7 +168,7 @@ impl Service { }) } - #[tracing::instrument(skip(self, room_id, serialized))] + #[tracing::instrument(skip(self, room_id, serialized), level = "debug")] pub fn send_edu_room(&self, room_id: &RoomId, serialized: Vec) -> Result<()> { let servers = services() .rooms @@ -180,7 +180,7 @@ impl Service { self.send_edu_servers(servers, serialized) } - #[tracing::instrument(skip(self, servers, serialized))] + #[tracing::instrument(skip(self, servers, serialized), level = "debug")] pub fn send_edu_servers>(&self, servers: I, serialized: Vec) -> Result<()> { let requests = servers .into_iter() @@ -205,7 +205,7 @@ impl Service { Ok(()) } - #[tracing::instrument(skip(self, room_id))] + #[tracing::instrument(skip(self, room_id), level = "debug")] pub fn flush_room(&self, room_id: &RoomId) -> Result<()> { let servers = services() .rooms @@ -217,7 +217,7 @@ impl Service { self.flush_servers(servers) } - #[tracing::instrument(skip(self, servers))] + #[tracing::instrument(skip(self, servers), level = "debug")] pub fn flush_servers>(&self, servers: I) -> Result<()> { let requests = servers.into_iter().map(Destination::Normal); for dest in requests { @@ -255,7 +255,7 @@ impl Service { /// Cleanup event data /// Used for instance after we remove an appservice registration - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self), level = "debug")] pub fn cleanup_events(&self, appservice_id: String) -> Result<()> { self.db .delete_all_requests_for(&Destination::Appservice(appservice_id))?; @@ -271,7 +271,7 @@ impl Service { } impl Destination { - #[tracing::instrument(skip(self))] + #[must_use] pub fn get_prefix(&self) -> Vec { let mut prefix = match self { Self::Appservice(server) => {