Merge branch 'tracing-cleanup' into 'next'

Remove unnecessary tracing::instrument attributes

See merge request famedly/conduit!302
This commit is contained in:
Timo Kösters 2022-02-12 15:50:24 +00:00
commit 2b644ef7b7
38 changed files with 9 additions and 180 deletions

View file

@ -4,6 +4,7 @@ use ruma::api::{IncomingResponse, OutgoingRequest, SendAccessToken};
use std::{fmt::Debug, mem, time::Duration};
use tracing::warn;
#[tracing::instrument(skip(globals, request))]
pub(crate) async fn send_request<T: OutgoingRequest>(
globals: &crate::database::globals::Globals,
registration: serde_yaml::Value,

View file

@ -40,7 +40,6 @@ const GUEST_NAME_LENGTH: usize = 10;
/// - No user or appservice on this server already claimed this username
///
/// Note: This will not reserve the username, so the username might become invalid when trying to register
#[tracing::instrument(skip(db, body))]
pub async fn get_register_available_route(
db: DatabaseGuard,
body: Ruma<get_username_availability::Request<'_>>,
@ -84,7 +83,6 @@ pub async fn get_register_available_route(
/// - If type is not guest and no username is given: Always fails after UIAA check
/// - Creates a new account and populates it with default account data
/// - If `inhibit_login` is false: Creates a device and returns device id and access_token
#[tracing::instrument(skip(db, body))]
pub async fn register_route(
db: DatabaseGuard,
body: Ruma<register::Request<'_>>,
@ -267,7 +265,6 @@ pub async fn register_route(
/// - Deletes device metadata (device id, device display name, last seen ip, last seen ts)
/// - Forgets to-device events
/// - Triggers device list updates
#[tracing::instrument(skip(db, body))]
pub async fn change_password_route(
db: DatabaseGuard,
body: Ruma<change_password::Request<'_>>,
@ -332,7 +329,6 @@ pub async fn change_password_route(
/// Get user_id of the sender user.
///
/// Note: Also works for Application Services
#[tracing::instrument(skip(body))]
pub async fn whoami_route(body: Ruma<whoami::Request>) -> Result<whoami::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
Ok(whoami::Response {
@ -350,7 +346,6 @@ pub async fn whoami_route(body: Ruma<whoami::Request>) -> Result<whoami::Respons
/// - Forgets all to-device events
/// - Triggers device list updates
/// - Removes ability to log in again
#[tracing::instrument(skip(db, body))]
pub async fn deactivate_route(
db: DatabaseGuard,
body: Ruma<deactivate::Request<'_>>,

View file

@ -15,7 +15,6 @@ use ruma::{
/// # `PUT /_matrix/client/r0/directory/room/{roomAlias}`
///
/// Creates a new room alias on this server.
#[tracing::instrument(skip(db, body))]
pub async fn create_alias_route(
db: DatabaseGuard,
body: Ruma<create_alias::Request<'_>>,
@ -45,7 +44,6 @@ pub async fn create_alias_route(
///
/// - TODO: additional access control checks
/// - TODO: Update canonical alias event
#[tracing::instrument(skip(db, body))]
pub async fn delete_alias_route(
db: DatabaseGuard,
body: Ruma<delete_alias::Request<'_>>,
@ -71,7 +69,6 @@ pub async fn delete_alias_route(
/// Resolve an alias locally or over federation.
///
/// - TODO: Suggest more servers to join via
#[tracing::instrument(skip(db, body))]
pub async fn get_alias_route(
db: DatabaseGuard,
body: Ruma<get_alias::Request<'_>>,

View file

@ -12,7 +12,6 @@ use ruma::api::client::{
/// # `POST /_matrix/client/r0/room_keys/version`
///
/// Creates a new backup.
#[tracing::instrument(skip(db, body))]
pub async fn create_backup_route(
db: DatabaseGuard,
body: Ruma<create_backup::Request>,
@ -30,7 +29,6 @@ pub async fn create_backup_route(
/// # `PUT /_matrix/client/r0/room_keys/version/{version}`
///
/// Update information about an existing backup. Only `auth_data` can be modified.
#[tracing::instrument(skip(db, body))]
pub async fn update_backup_route(
db: DatabaseGuard,
body: Ruma<update_backup::Request<'_>>,
@ -47,7 +45,6 @@ pub async fn update_backup_route(
/// # `GET /_matrix/client/r0/room_keys/version`
///
/// Get information about the latest backup version.
#[tracing::instrument(skip(db, body))]
pub async fn get_latest_backup_route(
db: DatabaseGuard,
body: Ruma<get_latest_backup::Request>,
@ -73,7 +70,6 @@ pub async fn get_latest_backup_route(
/// # `GET /_matrix/client/r0/room_keys/version`
///
/// Get information about an existing backup.
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_route(
db: DatabaseGuard,
body: Ruma<get_backup::Request<'_>>,
@ -100,7 +96,6 @@ pub async fn get_backup_route(
/// Delete an existing key backup.
///
/// - Deletes both information about the backup, as well as all key data related to the backup
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_route(
db: DatabaseGuard,
body: Ruma<delete_backup::Request<'_>>,
@ -121,7 +116,6 @@ pub async fn delete_backup_route(
/// - Only manipulating the most recently created version of the backup is allowed
/// - Adds the keys to the backup
/// - Returns the new number of keys in this backup and the etag
#[tracing::instrument(skip(db, body))]
pub async fn add_backup_keys_route(
db: DatabaseGuard,
body: Ruma<add_backup_keys::Request<'_>>,
@ -168,7 +162,6 @@ pub async fn add_backup_keys_route(
/// - Only manipulating the most recently created version of the backup is allowed
/// - Adds the keys to the backup
/// - Returns the new number of keys in this backup and the etag
#[tracing::instrument(skip(db, body))]
pub async fn add_backup_key_sessions_route(
db: DatabaseGuard,
body: Ruma<add_backup_key_sessions::Request<'_>>,
@ -213,7 +206,6 @@ pub async fn add_backup_key_sessions_route(
/// - Only manipulating the most recently created version of the backup is allowed
/// - Adds the keys to the backup
/// - Returns the new number of keys in this backup and the etag
#[tracing::instrument(skip(db, body))]
pub async fn add_backup_key_session_route(
db: DatabaseGuard,
body: Ruma<add_backup_key_session::Request<'_>>,
@ -252,7 +244,6 @@ pub async fn add_backup_key_session_route(
/// # `GET /_matrix/client/r0/room_keys/keys`
///
/// Retrieves all keys from the backup.
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_keys_route(
db: DatabaseGuard,
body: Ruma<get_backup_keys::Request<'_>>,
@ -267,7 +258,6 @@ pub async fn get_backup_keys_route(
/// # `GET /_matrix/client/r0/room_keys/keys/{roomId}`
///
/// Retrieves all keys from the backup for a given room.
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_key_sessions_route(
db: DatabaseGuard,
body: Ruma<get_backup_key_sessions::Request<'_>>,
@ -284,7 +274,6 @@ pub async fn get_backup_key_sessions_route(
/// # `GET /_matrix/client/r0/room_keys/keys/{roomId}/{sessionId}`
///
/// Retrieves a key from the backup.
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_key_session_route(
db: DatabaseGuard,
body: Ruma<get_backup_key_session::Request<'_>>,
@ -305,7 +294,6 @@ pub async fn get_backup_key_session_route(
/// # `DELETE /_matrix/client/r0/room_keys/keys`
///
/// Delete the keys from the backup.
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_keys_route(
db: DatabaseGuard,
body: Ruma<delete_backup_keys::Request<'_>>,
@ -325,7 +313,6 @@ pub async fn delete_backup_keys_route(
/// # `DELETE /_matrix/client/r0/room_keys/keys/{roomId}`
///
/// Delete the keys from the backup for a given room.
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_key_sessions_route(
db: DatabaseGuard,
body: Ruma<delete_backup_key_sessions::Request<'_>>,
@ -346,7 +333,6 @@ pub async fn delete_backup_key_sessions_route(
/// # `DELETE /_matrix/client/r0/room_keys/keys/{roomId}/{sessionId}`
///
/// Delete a key from the backup.
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_key_session_route(
db: DatabaseGuard,
body: Ruma<delete_backup_key_session::Request<'_>>,

View file

@ -10,7 +10,6 @@ use std::collections::BTreeMap;
/// # `GET /_matrix/client/r0/capabilities`
///
/// Get information on the supported feature set and other relevent capabilities of this server.
#[tracing::instrument(skip(_body))]
pub async fn get_capabilities_route(
_body: Ruma<get_capabilities::Request>,
) -> Result<get_capabilities::Response> {

View file

@ -16,7 +16,6 @@ use serde_json::{json, value::RawValue as RawJsonValue};
/// # `PUT /_matrix/client/r0/user/{userId}/account_data/{type}`
///
/// Sets some account data for the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn set_global_account_data_route(
db: DatabaseGuard,
body: Ruma<set_global_account_data::Request<'_>>,
@ -47,7 +46,6 @@ pub async fn set_global_account_data_route(
/// # `PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/account_data/{type}`
///
/// Sets some room account data for the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn set_room_account_data_route(
db: DatabaseGuard,
body: Ruma<set_room_account_data::Request<'_>>,
@ -78,7 +76,6 @@ pub async fn set_room_account_data_route(
/// # `GET /_matrix/client/r0/user/{userId}/account_data/{type}`
///
/// Gets some account data for the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn get_global_account_data_route(
db: DatabaseGuard,
body: Ruma<get_global_account_data::Request<'_>>,
@ -100,7 +97,6 @@ pub async fn get_global_account_data_route(
/// # `GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/account_data/{type}`
///
/// Gets some room account data for the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn get_room_account_data_route(
db: DatabaseGuard,
body: Ruma<get_room_account_data::Request<'_>>,

View file

@ -15,7 +15,6 @@ use tracing::error;
///
/// - Only works if the user is joined (TODO: always allow, but only show events if the user was
/// joined, depending on history_visibility)
#[tracing::instrument(skip(db, body))]
pub async fn get_context_route(
db: DatabaseGuard,
body: Ruma<get_context::Request<'_>>,

View file

@ -12,7 +12,6 @@ use super::SESSION_ID_LENGTH;
/// # `GET /_matrix/client/r0/devices`
///
/// Get metadata on all devices of the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn get_devices_route(
db: DatabaseGuard,
body: Ruma<get_devices::Request>,
@ -31,7 +30,6 @@ pub async fn get_devices_route(
/// # `GET /_matrix/client/r0/devices/{deviceId}`
///
/// Get metadata on a single device of the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn get_device_route(
db: DatabaseGuard,
body: Ruma<get_device::Request<'_>>,
@ -49,7 +47,6 @@ pub async fn get_device_route(
/// # `PUT /_matrix/client/r0/devices/{deviceId}`
///
/// Updates the metadata on a given device of the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn update_device_route(
db: DatabaseGuard,
body: Ruma<update_device::Request<'_>>,
@ -80,7 +77,6 @@ pub async fn update_device_route(
/// - Deletes device metadata (device id, device display name, last seen ip, last seen ts)
/// - Forgets to-device events
/// - Triggers device list updates
#[tracing::instrument(skip(db, body))]
pub async fn delete_device_route(
db: DatabaseGuard,
body: Ruma<delete_device::Request<'_>>,
@ -139,7 +135,6 @@ pub async fn delete_device_route(
/// - Deletes device metadata (device id, device display name, last seen ip, last seen ts)
/// - Forgets to-device events
/// - Triggers device list updates
#[tracing::instrument(skip(db, body))]
pub async fn delete_devices_route(
db: DatabaseGuard,
body: Ruma<delete_devices::Request<'_>>,

View file

@ -34,7 +34,6 @@ use tracing::{info, warn};
/// Lists the public rooms on this server.
///
/// - Rooms are ordered by the number of joined members
#[tracing::instrument(skip(db, body))]
pub async fn get_public_rooms_filtered_route(
db: DatabaseGuard,
body: Ruma<get_public_rooms_filtered::Request<'_>>,
@ -55,7 +54,6 @@ pub 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(db, body))]
pub async fn get_public_rooms_route(
db: DatabaseGuard,
body: Ruma<get_public_rooms::Request<'_>>,
@ -83,7 +81,6 @@ pub async fn get_public_rooms_route(
/// Sets the visibility of a given room in the room directory.
///
/// - TODO: Access control checks
#[tracing::instrument(skip(db, body))]
pub async fn set_room_visibility_route(
db: DatabaseGuard,
body: Ruma<set_room_visibility::Request<'_>>,
@ -112,7 +109,6 @@ pub async fn set_room_visibility_route(
/// # `GET /_matrix/client/r0/directory/list/room/{roomId}`
///
/// Gets the visibility of a given room in the room directory.
#[tracing::instrument(skip(db, body))]
pub async fn get_room_visibility_route(
db: DatabaseGuard,
body: Ruma<get_room_visibility::Request<'_>>,

View file

@ -9,7 +9,6 @@ use ruma::api::client::{
/// Loads a filter that was previously created.
///
/// - A user can only access their own filters
#[tracing::instrument(skip(db, body))]
pub async fn get_filter_route(
db: DatabaseGuard,
body: Ruma<get_filter::Request<'_>>,
@ -26,7 +25,6 @@ pub async fn get_filter_route(
/// # `PUT /_matrix/client/r0/user/{userId}/filter`
///
/// Creates a new filter to be used by other endpoints.
#[tracing::instrument(skip(db, body))]
pub async fn create_filter_route(
db: DatabaseGuard,
body: Ruma<create_filter::Request<'_>>,

View file

@ -27,7 +27,6 @@ use std::collections::{BTreeMap, HashMap, HashSet};
///
/// - Adds one time keys
/// - If there are no device keys yet: Adds device keys (TODO: merge with existing keys?)
#[tracing::instrument(skip(db, body))]
pub async fn upload_keys_route(
db: DatabaseGuard,
body: Ruma<upload_keys::Request>,
@ -72,7 +71,6 @@ pub async fn upload_keys_route(
/// - Always fetches users from other servers over federation
/// - Gets master keys, self-signing keys, user signing keys and device keys.
/// - The master and self-signing keys contain signatures that the user is allowed to see
#[tracing::instrument(skip(db, body))]
pub async fn get_keys_route(
db: DatabaseGuard,
body: Ruma<get_keys::Request<'_>>,
@ -93,7 +91,6 @@ pub async fn get_keys_route(
/// # `POST /_matrix/client/r0/keys/claim`
///
/// Claims one-time keys
#[tracing::instrument(skip(db, body))]
pub async fn claim_keys_route(
db: DatabaseGuard,
body: Ruma<claim_keys::Request>,
@ -110,7 +107,6 @@ pub async fn claim_keys_route(
/// Uploads end-to-end key information for the sender user.
///
/// - Requires UIAA to verify password
#[tracing::instrument(skip(db, body))]
pub async fn upload_signing_keys_route(
db: DatabaseGuard,
body: Ruma<upload_signing_keys::Request<'_>>,
@ -170,7 +166,6 @@ pub async fn upload_signing_keys_route(
/// # `POST /_matrix/client/r0/keys/signatures/upload`
///
/// Uploads end-to-end key signatures from the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn upload_signatures_route(
db: DatabaseGuard,
body: Ruma<upload_signatures::Request>,
@ -232,7 +227,6 @@ pub async fn upload_signatures_route(
/// Gets a list of users who have updated their device identity keys since the previous sync token.
///
/// - TODO: left users
#[tracing::instrument(skip(db, body))]
pub async fn get_key_changes_route(
db: DatabaseGuard,
body: Ruma<get_key_changes::Request<'_>>,

View file

@ -15,7 +15,6 @@ const MXC_LENGTH: usize = 32;
/// # `GET /_matrix/media/r0/config`
///
/// Returns max upload size.
#[tracing::instrument(skip(db, _body))]
pub async fn get_media_config_route(
db: DatabaseGuard,
_body: Ruma<get_media_config::Request>,
@ -31,7 +30,6 @@ pub async fn get_media_config_route(
///
/// - Some metadata will be saved in the database
/// - Media will be saved in the media/ directory
#[tracing::instrument(skip(db, body))]
pub async fn create_content_route(
db: DatabaseGuard,
body: Ruma<create_content::Request<'_>>,
@ -101,7 +99,6 @@ pub async fn get_remote_content(
/// Load media from our server or over federation.
///
/// - Only allows federation if `allow_remote` is true
#[tracing::instrument(skip(db, body))]
pub async fn get_content_route(
db: DatabaseGuard,
body: Ruma<get_content::Request<'_>>,
@ -133,7 +130,6 @@ pub async fn get_content_route(
/// Load media from our server or over federation, permitting desired filename.
///
/// - Only allows federation if `allow_remote` is true
#[tracing::instrument(skip(db, body))]
pub async fn get_content_as_filename_route(
db: DatabaseGuard,
body: Ruma<get_content_as_filename::Request<'_>>,
@ -170,7 +166,6 @@ pub async fn get_content_as_filename_route(
/// Load media thumbnail from our server or over federation.
///
/// - Only allows federation if `allow_remote` is true
#[tracing::instrument(skip(db, body))]
pub async fn get_content_thumbnail_route(
db: DatabaseGuard,
body: Ruma<get_content_thumbnail::Request<'_>>,

View file

@ -42,7 +42,6 @@ use tracing::{debug, error, warn};
///
/// - If the server knowns about this room: creates the join event and does auth rules locally
/// - If the server does not know about the room: asks other servers over federation
#[tracing::instrument(skip(db, body))]
pub async fn join_room_by_id_route(
db: DatabaseGuard,
body: Ruma<join_room_by_id::Request<'_>>,
@ -83,7 +82,6 @@ pub async fn join_room_by_id_route(
///
/// - If the server knowns about this room: creates the join event and does auth rules locally
/// - If the server does not know about the room: asks other servers over federation
#[tracing::instrument(skip(db, body))]
pub async fn join_room_by_id_or_alias_route(
db: DatabaseGuard,
body: Ruma<join_room_by_id_or_alias::Request<'_>>,
@ -136,7 +134,6 @@ pub async fn join_room_by_id_or_alias_route(
/// Tries to leave the sender user from a room.
///
/// - This should always work if the user is currently joined.
#[tracing::instrument(skip(db, body))]
pub async fn leave_room_route(
db: DatabaseGuard,
body: Ruma<leave_room::Request<'_>>,
@ -153,7 +150,6 @@ pub async fn leave_room_route(
/// # `POST /_matrix/client/r0/rooms/{roomId}/invite`
///
/// Tries to send an invite event into the room.
#[tracing::instrument(skip(db, body))]
pub async fn invite_user_route(
db: DatabaseGuard,
body: Ruma<invite_user::Request<'_>>,
@ -172,7 +168,6 @@ pub async fn invite_user_route(
/// # `POST /_matrix/client/r0/rooms/{roomId}/kick`
///
/// Tries to send a kick event into the room.
#[tracing::instrument(skip(db, body))]
pub async fn kick_user_route(
db: DatabaseGuard,
body: Ruma<kick_user::Request<'_>>,
@ -232,7 +227,6 @@ pub async fn kick_user_route(
/// # `POST /_matrix/client/r0/rooms/{roomId}/ban`
///
/// Tries to send a ban event into the room.
#[tracing::instrument(skip(db, body))]
pub async fn ban_user_route(
db: DatabaseGuard,
body: Ruma<ban_user::Request<'_>>,
@ -303,7 +297,6 @@ pub async fn ban_user_route(
/// # `POST /_matrix/client/r0/rooms/{roomId}/unban`
///
/// Tries to send an unban event into the room.
#[tracing::instrument(skip(db, body))]
pub async fn unban_user_route(
db: DatabaseGuard,
body: Ruma<unban_user::Request<'_>>,
@ -367,7 +360,6 @@ pub async fn unban_user_route(
///
/// Note: Other devices of the user have no way of knowing the room was forgotten, so this has to
/// be called from every device
#[tracing::instrument(skip(db, body))]
pub async fn forget_room_route(
db: DatabaseGuard,
body: Ruma<forget_room::Request<'_>>,
@ -384,7 +376,6 @@ pub async fn forget_room_route(
/// # `POST /_matrix/client/r0/joined_rooms`
///
/// Lists all rooms the user has joined.
#[tracing::instrument(skip(db, body))]
pub async fn joined_rooms_route(
db: DatabaseGuard,
body: Ruma<joined_rooms::Request>,
@ -405,7 +396,6 @@ pub async fn joined_rooms_route(
/// Lists all joined users in a room (TODO: at a specific point in time, with a specific membership).
///
/// - Only works if the user is currently joined
#[tracing::instrument(skip(db, body))]
pub async fn get_member_events_route(
db: DatabaseGuard,
body: Ruma<get_member_events::Request<'_>>,
@ -437,7 +427,6 @@ pub async fn get_member_events_route(
///
/// - The sender user must be in the room
/// - TODO: An appservice just needs a puppet joined
#[tracing::instrument(skip(db, body))]
pub async fn joined_members_route(
db: DatabaseGuard,
body: Ruma<joined_members::Request<'_>>,

View file

@ -18,7 +18,6 @@ use std::{
/// - Is a NOOP if the txn id was already used before and returns the same event id again
/// - The only requirement for the content is that it has to be valid json
/// - Tries to send the event into the room, auth rules will determine if it is allowed
#[tracing::instrument(skip(db, body))]
pub async fn send_message_event_route(
db: DatabaseGuard,
body: Ruma<send_message_event::Request<'_>>,
@ -103,7 +102,6 @@ pub async fn send_message_event_route(
///
/// - Only works if the user is joined (TODO: always allow, but only show events where the user was
/// joined, depending on history_visibility)
#[tracing::instrument(skip(db, body))]
pub async fn get_message_events_route(
db: DatabaseGuard,
body: Ruma<get_message_events::Request<'_>>,

View file

@ -5,7 +5,6 @@ use std::time::Duration;
/// # `PUT /_matrix/client/r0/presence/{userId}/status`
///
/// Sets the presence state of the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn set_presence_route(
db: DatabaseGuard,
body: Ruma<set_presence::Request<'_>>,
@ -47,7 +46,6 @@ pub async fn set_presence_route(
/// Gets the presence state of the given user.
///
/// - Only works if you share a room with the user
#[tracing::instrument(skip(db, body))]
pub async fn get_presence_route(
db: DatabaseGuard,
body: Ruma<get_presence::Request<'_>>,

View file

@ -19,7 +19,6 @@ use std::sync::Arc;
/// Updates the displayname.
///
/// - Also makes sure other users receive the update using presence EDUs
#[tracing::instrument(skip(db, body))]
pub async fn set_displayname_route(
db: DatabaseGuard,
body: Ruma<set_display_name::Request<'_>>,
@ -117,7 +116,6 @@ pub async fn set_displayname_route(
/// Returns the displayname of the user.
///
/// - If user is on another server: Fetches displayname over federation
#[tracing::instrument(skip(db, body))]
pub async fn get_displayname_route(
db: DatabaseGuard,
body: Ruma<get_display_name::Request<'_>>,
@ -150,7 +148,6 @@ pub async fn get_displayname_route(
/// Updates the avatar_url and blurhash.
///
/// - Also makes sure other users receive the update using presence EDUs
#[tracing::instrument(skip(db, body))]
pub async fn set_avatar_url_route(
db: DatabaseGuard,
body: Ruma<set_avatar_url::Request<'_>>,
@ -250,7 +247,6 @@ pub async fn set_avatar_url_route(
/// Returns the avatar_url and blurhash of the user.
///
/// - If user is on another server: Fetches avatar_url and blurhash over federation
#[tracing::instrument(skip(db, body))]
pub async fn get_avatar_url_route(
db: DatabaseGuard,
body: Ruma<get_avatar_url::Request<'_>>,
@ -285,7 +281,6 @@ pub async fn get_avatar_url_route(
/// Returns the displayname, avatar_url and blurhash of the user.
///
/// - If user is on another server: Fetches profile over federation
#[tracing::instrument(skip(db, body))]
pub async fn get_profile_route(
db: DatabaseGuard,
body: Ruma<get_profile::Request<'_>>,

View file

@ -15,7 +15,6 @@ use ruma::{
/// # `GET /_matrix/client/r0/pushrules`
///
/// Retrieves the push rules event for this user.
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrules_all_route(
db: DatabaseGuard,
body: Ruma<get_pushrules_all::Request>,
@ -38,7 +37,6 @@ pub async fn get_pushrules_all_route(
/// # `GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}`
///
/// Retrieves a single specified push rule for this user.
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrule_route(
db: DatabaseGuard,
body: Ruma<get_pushrule::Request<'_>>,
@ -91,7 +89,6 @@ pub async fn get_pushrule_route(
/// # `PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}`
///
/// Creates a single specified push rule for this user.
#[tracing::instrument(skip(db, body))]
pub async fn set_pushrule_route(
db: DatabaseGuard,
body: Ruma<set_pushrule::Request<'_>>,
@ -188,7 +185,6 @@ pub async fn set_pushrule_route(
/// # `GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/actions`
///
/// Gets the actions of a single specified push rule for this user.
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrule_actions_route(
db: DatabaseGuard,
body: Ruma<get_pushrule_actions::Request<'_>>,
@ -245,7 +241,6 @@ pub async fn get_pushrule_actions_route(
/// # `PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/actions`
///
/// Sets the actions of a single specified push rule for this user.
#[tracing::instrument(skip(db, body))]
pub async fn set_pushrule_actions_route(
db: DatabaseGuard,
body: Ruma<set_pushrule_actions::Request<'_>>,
@ -313,7 +308,6 @@ pub async fn set_pushrule_actions_route(
/// # `GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/enabled`
///
/// Gets the enabled status of a single specified push rule for this user.
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrule_enabled_route(
db: DatabaseGuard,
body: Ruma<get_pushrule_enabled::Request<'_>>,
@ -373,7 +367,6 @@ pub async fn get_pushrule_enabled_route(
/// # `PUT /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}/enabled`
///
/// Sets the enabled status of a single specified push rule for this user.
#[tracing::instrument(skip(db, body))]
pub async fn set_pushrule_enabled_route(
db: DatabaseGuard,
body: Ruma<set_pushrule_enabled::Request<'_>>,
@ -446,7 +439,6 @@ pub async fn set_pushrule_enabled_route(
/// # `DELETE /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}`
///
/// Deletes a single specified push rule for this user.
#[tracing::instrument(skip(db, body))]
pub async fn delete_pushrule_route(
db: DatabaseGuard,
body: Ruma<delete_pushrule::Request<'_>>,
@ -509,7 +501,6 @@ pub async fn delete_pushrule_route(
/// # `GET /_matrix/client/r0/pushers`
///
/// Gets all currently active pushers for the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn get_pushers_route(
db: DatabaseGuard,
body: Ruma<get_pushers::Request>,
@ -526,7 +517,6 @@ pub async fn get_pushers_route(
/// Adds a pusher for the sender user.
///
/// - TODO: Handle `append`
#[tracing::instrument(skip(db, body))]
pub async fn set_pushers_route(
db: DatabaseGuard,
body: Ruma<set_pusher::Request>,

View file

@ -16,7 +16,6 @@ use std::collections::BTreeMap;
///
/// - Updates fully-read account data event to `fully_read`
/// - If `read_receipt` is set: Update private marker and public read receipt EDU
#[tracing::instrument(skip(db, body))]
pub async fn set_read_marker_route(
db: DatabaseGuard,
body: Ruma<set_read_marker::Request<'_>>,
@ -82,7 +81,6 @@ pub async fn set_read_marker_route(
/// # `POST /_matrix/client/r0/rooms/{roomId}/receipt/{receiptType}/{eventId}`
///
/// Sets private read marker and public read receipt EDU.
#[tracing::instrument(skip(db, body))]
pub async fn create_receipt_route(
db: DatabaseGuard,
body: Ruma<create_receipt::Request<'_>>,

View file

@ -13,7 +13,6 @@ use serde_json::value::to_raw_value;
/// Tries to send a redaction event into the room.
///
/// - TODO: Handle txn id
#[tracing::instrument(skip(db, body))]
pub async fn redact_event_route(
db: DatabaseGuard,
body: Ruma<redact_event::Request<'_>>,

View file

@ -9,7 +9,6 @@ use ruma::{
///
/// Reports an inappropriate event to homeserver admins
///
#[tracing::instrument(skip(db, body))]
pub async fn report_event_route(
db: DatabaseGuard,
body: Ruma<report_content::Request<'_>>,

View file

@ -45,7 +45,6 @@ use tracing::{info, warn};
/// - Send events listed in initial state
/// - Send events implied by `name` and `topic`
/// - Send invite events
#[tracing::instrument(skip(db, body))]
pub async fn create_room_route(
db: DatabaseGuard,
body: Ruma<create_room::Request<'_>>,
@ -417,7 +416,6 @@ pub async fn create_room_route(
/// Gets a single event.
///
/// - You have to currently be joined to the room (TODO: Respect history visibility)
#[tracing::instrument(skip(db, body))]
pub async fn get_room_event_route(
db: DatabaseGuard,
body: Ruma<get_room_event::Request<'_>>,
@ -445,7 +443,6 @@ pub async fn get_room_event_route(
/// Lists all aliases of the room.
///
/// - Only users joined to the room are allowed to call this TODO: Allow any user to call it if history_visibility is world readable
#[tracing::instrument(skip(db, body))]
pub async fn get_room_aliases_route(
db: DatabaseGuard,
body: Ruma<aliases::Request<'_>>,
@ -478,7 +475,6 @@ pub async fn get_room_aliases_route(
/// - Transfers some state events
/// - Moves local aliases
/// - Modifies old room power levels to prevent users from speaking
#[tracing::instrument(skip(db, body))]
pub async fn upgrade_room_route(
db: DatabaseGuard,
body: Ruma<upgrade_room::Request<'_>>,

View file

@ -9,7 +9,6 @@ use std::collections::BTreeMap;
/// Searches rooms for messages.
///
/// - Only works if the user is currently joined to the room (TODO: Respect history visibility)
#[tracing::instrument(skip(db, body))]
pub async fn search_events_route(
db: DatabaseGuard,
body: Ruma<search_events::Request<'_>>,

View file

@ -23,7 +23,6 @@ struct Claims {
///
/// Get the supported login types of this server. One of these should be used as the `type` field
/// when logging in.
#[tracing::instrument(skip(_body))]
pub async fn get_login_types_route(
_body: Ruma<get_login_types::Request>,
) -> Result<get_login_types::Response> {
@ -43,7 +42,6 @@ pub async fn get_login_types_route(
///
/// Note: You can use [`GET /_matrix/client/r0/login`](fn.get_supported_versions_route.html) to see
/// supported login types.
#[tracing::instrument(skip(db, body))]
pub async fn login_route(
db: DatabaseGuard,
body: Ruma<login::Request<'_>>,
@ -163,7 +161,6 @@ pub async fn login_route(
/// - Deletes device metadata (device id, device display name, last seen ip, last seen ts)
/// - Forgets to-device events
/// - Triggers device list updates
#[tracing::instrument(skip(db, body))]
pub async fn logout_route(
db: DatabaseGuard,
body: Ruma<logout::Request>,
@ -189,7 +186,6 @@ pub async fn logout_route(
///
/// Note: This is equivalent to calling [`GET /_matrix/client/r0/logout`](fn.logout_route.html)
/// from each device of this user.
#[tracing::instrument(skip(db, body))]
pub async fn logout_all_route(
db: DatabaseGuard,
body: Ruma<logout_all::Request>,

View file

@ -26,7 +26,6 @@ use ruma::{
/// - The only requirement for the content is that it has to be valid json
/// - Tries to send the event into the room, auth rules will determine if it is allowed
/// - If event is new canonical_alias: Rejects if alias is incorrect
#[tracing::instrument(skip(db, body))]
pub async fn send_state_event_for_key_route(
db: DatabaseGuard,
body: Ruma<send_state_event::Request<'_>>,
@ -56,7 +55,6 @@ pub async fn send_state_event_for_key_route(
/// - The only requirement for the content is that it has to be valid json
/// - Tries to send the event into the room, auth rules will determine if it is allowed
/// - If event is new canonical_alias: Rejects if alias is incorrect
#[tracing::instrument(skip(db, body))]
pub async fn send_state_event_for_empty_key_route(
db: DatabaseGuard,
body: Ruma<send_state_event::Request<'_>>,
@ -92,7 +90,6 @@ pub async fn send_state_event_for_empty_key_route(
/// Get all state events for a room.
///
/// - If not joined: Only works if current room history visibility is world readable
#[tracing::instrument(skip(db, body))]
pub async fn get_state_events_route(
db: DatabaseGuard,
body: Ruma<get_state_events::Request<'_>>,
@ -139,7 +136,6 @@ pub async fn get_state_events_route(
/// Get single state event of a room.
///
/// - If not joined: Only works if current room history visibility is world readable
#[tracing::instrument(skip(db, body))]
pub async fn get_state_events_for_key_route(
db: DatabaseGuard,
body: Ruma<get_state_events_for_key::Request<'_>>,
@ -190,7 +186,6 @@ pub async fn get_state_events_for_key_route(
/// Get single state event of a room.
///
/// - If not joined: Only works if current room history visibility is world readable
#[tracing::instrument(skip(db, body))]
pub async fn get_state_events_for_empty_key_route(
db: DatabaseGuard,
body: Ruma<get_state_events_for_key::Request<'_>>,

View file

@ -54,7 +54,6 @@ use tracing::error;
///
/// - Sync is handled in an async task, multiple requests from the same device with the same
/// `since` will be cached
#[tracing::instrument(skip(db, body))]
pub async fn sync_events_route(
db: DatabaseGuard,
body: Ruma<sync_events::Request<'_>>,

View file

@ -13,7 +13,6 @@ use std::collections::BTreeMap;
/// Adds a tag to the room.
///
/// - Inserts the tag into the tag event of the room account data.
#[tracing::instrument(skip(db, body))]
pub async fn update_tag_route(
db: DatabaseGuard,
body: Ruma<create_tag::Request<'_>>,
@ -51,7 +50,6 @@ pub async fn update_tag_route(
/// Deletes a tag from the room.
///
/// - Removes the tag from the tag event of the room account data.
#[tracing::instrument(skip(db, body))]
pub async fn delete_tag_route(
db: DatabaseGuard,
body: Ruma<delete_tag::Request<'_>>,
@ -86,7 +84,6 @@ pub async fn delete_tag_route(
/// Returns tags on the room.
///
/// - Gets the tag event of the room account data.
#[tracing::instrument(skip(db, body))]
pub async fn get_tags_route(
db: DatabaseGuard,
body: Ruma<get_tags::Request<'_>>,

View file

@ -6,7 +6,6 @@ use std::collections::BTreeMap;
/// # `GET /_matrix/client/r0/thirdparty/protocols`
///
/// TODO: Fetches all metadata about protocols supported by the homeserver.
#[tracing::instrument(skip(_body))]
pub async fn get_protocols_route(
_body: Ruma<get_protocols::Request>,
) -> Result<get_protocols::Response> {

View file

@ -13,7 +13,6 @@ use ruma::{
/// # `PUT /_matrix/client/r0/sendToDevice/{eventType}/{txnId}`
///
/// Send a to-device event to a set of client devices.
#[tracing::instrument(skip(db, body))]
pub async fn send_event_to_device_route(
db: DatabaseGuard,
body: Ruma<send_event_to_device::Request<'_>>,

View file

@ -5,7 +5,6 @@ use ruma::api::client::r0::typing::create_typing_event;
/// # `PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}`
///
/// Sets the typing state of the sender user.
#[tracing::instrument(skip(db, body))]
pub async fn create_typing_event_route(
db: DatabaseGuard,
body: Ruma<create_typing_event::Request<'_>>,

View file

@ -13,7 +13,6 @@ use ruma::api::client::unversioned::get_supported_versions;
///
/// Note: Unstable features are used while developing new features. Clients should avoid using
/// unstable features in their stable releases
#[tracing::instrument(skip(_body))]
pub async fn get_supported_versions_route(
_body: Ruma<get_supported_versions::Request>,
) -> Result<get_supported_versions::Response> {

View file

@ -6,7 +6,6 @@ use ruma::api::client::r0::user_directory::search_users;
/// Searches all known users for a match.
///
/// - TODO: Hide users that are not in any public rooms?
#[tracing::instrument(skip(db, body))]
pub async fn search_users_route(
db: DatabaseGuard,
body: Ruma<search_users::Request<'_>>,

View file

@ -9,7 +9,6 @@ type HmacSha1 = Hmac<Sha1>;
/// # `GET /_matrix/client/r0/voip/turnServer`
///
/// TODO: Returns information about the recommended turn server.
#[tracing::instrument(skip(body, db))]
pub async fn turn_server_route(
db: DatabaseGuard,
body: Ruma<get_turn_server_info::Request>,

View file

@ -69,7 +69,6 @@ impl DatabaseEngine for Engine {
}
impl EngineTree {
#[tracing::instrument(skip(self, tree, from, backwards))]
fn iter_from_thread(
&self,
tree: Arc<heed::UntypedDatabase>,
@ -94,7 +93,6 @@ impl EngineTree {
}
}
#[tracing::instrument(skip(tree, txn, from, backwards))]
fn iter_from_thread_work(
tree: Arc<heed::UntypedDatabase>,
txn: &heed::RoTxn<'_>,
@ -126,7 +124,6 @@ fn iter_from_thread_work(
}
impl Tree for EngineTree {
#[tracing::instrument(skip(self, key))]
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
let txn = self.engine.env.read_txn().map_err(convert_error)?;
Ok(self
@ -136,7 +133,6 @@ impl Tree for EngineTree {
.map(|s| s.to_vec()))
}
#[tracing::instrument(skip(self, key, value))]
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> {
let mut txn = self.engine.env.write_txn().map_err(convert_error)?;
self.tree
@ -147,7 +143,6 @@ impl Tree for EngineTree {
Ok(())
}
#[tracing::instrument(skip(self, key))]
fn remove(&self, key: &[u8]) -> Result<()> {
let mut txn = self.engine.env.write_txn().map_err(convert_error)?;
self.tree.delete(&mut txn, &key).map_err(convert_error)?;
@ -155,12 +150,10 @@ impl Tree for EngineTree {
Ok(())
}
#[tracing::instrument(skip(self))]
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + Send + 'a> {
self.iter_from(&[], false)
}
#[tracing::instrument(skip(self, from, backwards))]
fn iter_from(
&self,
from: &[u8],
@ -169,7 +162,6 @@ impl Tree for EngineTree {
self.iter_from_thread(Arc::clone(&self.tree), from.to_vec(), backwards)
}
#[tracing::instrument(skip(self, key))]
fn increment(&self, key: &[u8]) -> Result<Vec<u8>> {
let mut txn = self.engine.env.write_txn().map_err(convert_error)?;
@ -186,7 +178,6 @@ impl Tree for EngineTree {
Ok(new)
}
#[tracing::instrument(skip(self, prefix))]
fn scan_prefix<'a>(
&'a self,
prefix: Vec<u8>,
@ -197,7 +188,6 @@ impl Tree for EngineTree {
)
}
#[tracing::instrument(skip(self, prefix))]
fn watch_prefix<'a>(&'a self, prefix: &[u8]) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>> {
self.watchers.watch(prefix)
}

View file

@ -62,7 +62,6 @@ impl PersyTree {
}
impl Tree for PersyTree {
#[tracing::instrument(skip(self, key))]
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
let result = self
.persy
@ -72,14 +71,12 @@ impl Tree for PersyTree {
Ok(result)
}
#[tracing::instrument(skip(self, key, value))]
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> {
self.insert_batch(&mut Some((key.to_owned(), value.to_owned())).into_iter())?;
self.watchers.wake(key);
Ok(())
}
#[tracing::instrument(skip(self, iter))]
fn insert_batch<'a>(&self, iter: &mut dyn Iterator<Item = (Vec<u8>, Vec<u8>)>) -> Result<()> {
let mut tx = self.begin()?;
for (key, value) in iter {
@ -93,7 +90,6 @@ impl Tree for PersyTree {
Ok(())
}
#[tracing::instrument(skip(self, iter))]
fn increment_batch<'a>(&self, iter: &mut dyn Iterator<Item = Vec<u8>>) -> Result<()> {
let mut tx = self.begin()?;
for key in iter {
@ -108,7 +104,6 @@ impl Tree for PersyTree {
Ok(())
}
#[tracing::instrument(skip(self, key))]
fn remove(&self, key: &[u8]) -> Result<()> {
let mut tx = self.begin()?;
tx.remove::<ByteVec, ByteVec>(&self.name, ByteVec::from(key), None)?;
@ -116,7 +111,6 @@ impl Tree for PersyTree {
Ok(())
}
#[tracing::instrument(skip(self))]
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a> {
let iter = self.persy.range::<ByteVec, ByteVec, _>(&self.name, ..);
match iter {
@ -132,7 +126,6 @@ impl Tree for PersyTree {
}
}
#[tracing::instrument(skip(self, from, backwards))]
fn iter_from<'a>(
&'a self,
from: &[u8],
@ -165,13 +158,11 @@ impl Tree for PersyTree {
}
}
#[tracing::instrument(skip(self, key))]
fn increment(&self, key: &[u8]) -> Result<Vec<u8>> {
self.increment_batch(&mut Some(key.to_owned()).into_iter())?;
Ok(self.get(key)?.unwrap())
}
#[tracing::instrument(skip(self, prefix))]
fn scan_prefix<'a>(
&'a self,
prefix: Vec<u8>,
@ -200,7 +191,6 @@ impl Tree for PersyTree {
}
}
#[tracing::instrument(skip(self, prefix))]
fn watch_prefix<'a>(&'a self, prefix: &[u8]) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>> {
self.watchers.watch(prefix)
}

View file

@ -39,7 +39,6 @@ impl Tree for SledEngineTree {
Ok(())
}
#[tracing::instrument(skip(self, iter))]
fn insert_batch<'a>(&self, iter: &mut dyn Iterator<Item = (Vec<u8>, Vec<u8>)>) -> Result<()> {
for (key, value) in iter {
self.0.insert(key, value)?;

View file

@ -134,7 +134,6 @@ pub struct SqliteTable {
type TupleOfBytes = (Vec<u8>, Vec<u8>);
impl SqliteTable {
#[tracing::instrument(skip(self, guard, key))]
fn get_with_guard(&self, guard: &Connection, key: &[u8]) -> Result<Option<Vec<u8>>> {
//dbg!(&self.name);
Ok(guard
@ -143,7 +142,6 @@ impl SqliteTable {
.optional()?)
}
#[tracing::instrument(skip(self, guard, key, value))]
fn insert_with_guard(&self, guard: &Connection, key: &[u8], value: &[u8]) -> Result<()> {
//dbg!(&self.name);
guard.execute(
@ -192,12 +190,10 @@ impl SqliteTable {
}
impl Tree for SqliteTable {
#[tracing::instrument(skip(self, key))]
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
self.get_with_guard(self.engine.read_lock(), key)
}
#[tracing::instrument(skip(self, key, value))]
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> {
let guard = self.engine.write_lock();
self.insert_with_guard(&guard, key, value)?;
@ -206,7 +202,6 @@ impl Tree for SqliteTable {
Ok(())
}
#[tracing::instrument(skip(self, iter))]
fn insert_batch<'a>(&self, iter: &mut dyn Iterator<Item = (Vec<u8>, Vec<u8>)>) -> Result<()> {
let guard = self.engine.write_lock();
@ -221,7 +216,6 @@ impl Tree for SqliteTable {
Ok(())
}
#[tracing::instrument(skip(self, iter))]
fn increment_batch<'a>(&self, iter: &mut dyn Iterator<Item = Vec<u8>>) -> Result<()> {
let guard = self.engine.write_lock();
@ -239,7 +233,6 @@ impl Tree for SqliteTable {
Ok(())
}
#[tracing::instrument(skip(self, key))]
fn remove(&self, key: &[u8]) -> Result<()> {
let guard = self.engine.write_lock();
@ -251,14 +244,12 @@ impl Tree for SqliteTable {
Ok(())
}
#[tracing::instrument(skip(self))]
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = TupleOfBytes> + 'a> {
let guard = self.engine.read_lock_iterator();
self.iter_with_guard(guard)
}
#[tracing::instrument(skip(self, from, backwards))]
fn iter_from<'a>(
&'a self,
from: &[u8],
@ -323,7 +314,6 @@ impl Tree for SqliteTable {
}
}
#[tracing::instrument(skip(self, key))]
fn increment(&self, key: &[u8]) -> Result<Vec<u8>> {
let guard = self.engine.write_lock();
@ -337,7 +327,6 @@ impl Tree for SqliteTable {
Ok(new)
}
#[tracing::instrument(skip(self, prefix))]
fn scan_prefix<'a>(&'a self, prefix: Vec<u8>) -> Box<dyn Iterator<Item = TupleOfBytes> + 'a> {
Box::new(
self.iter_from(&prefix, false)
@ -345,12 +334,10 @@ impl Tree for SqliteTable {
)
}
#[tracing::instrument(skip(self, prefix))]
fn watch_prefix<'a>(&'a self, prefix: &[u8]) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>> {
self.watchers.watch(prefix)
}
#[tracing::instrument(skip(self))]
fn clear(&self) -> Result<()> {
debug!("clear: running");
self.engine

View file

@ -301,7 +301,6 @@ where
}
}
#[tracing::instrument]
fn get_ip_with_port(destination_str: &str) -> Option<FedDest> {
if let Ok(destination) = destination_str.parse::<SocketAddr>() {
Some(FedDest::Literal(destination))
@ -312,7 +311,6 @@ fn get_ip_with_port(destination_str: &str) -> Option<FedDest> {
}
}
#[tracing::instrument]
fn add_port_to_hostname(destination_str: &str) -> FedDest {
let (host, port) = match destination_str.find(':') {
None => (destination_str, ":8448"),
@ -490,7 +488,6 @@ async fn request_well_known(
/// # `GET /_matrix/federation/v1/version`
///
/// Get version information on this server.
#[tracing::instrument(skip(db, _body))]
pub async fn get_server_version_route(
db: DatabaseGuard,
_body: Ruma<get_server_version::v1::Request>,
@ -514,7 +511,6 @@ pub async fn get_server_version_route(
/// - Matrix does not support invalidating public keys, so the key returned by this will be valid
/// forever.
// Response type for this endpoint is Json because we need to calculate a signature for the response
#[tracing::instrument(skip(db))]
pub async fn get_server_keys_route(db: DatabaseGuard) -> Result<impl IntoResponse> {
if !db.globals.allow_federation() {
return Err(Error::bad_config("Federation is disabled."));
@ -564,7 +560,6 @@ pub async fn get_server_keys_route(db: DatabaseGuard) -> Result<impl IntoRespons
///
/// - Matrix does not support invalidating public keys, so the key returned by this will be valid
/// forever.
#[tracing::instrument(skip(db))]
pub async fn get_server_keys_deprecated_route(db: DatabaseGuard) -> impl IntoResponse {
get_server_keys_route(db).await
}
@ -572,7 +567,6 @@ pub async fn get_server_keys_deprecated_route(db: DatabaseGuard) -> impl IntoRes
/// # `POST /_matrix/federation/v1/publicRooms`
///
/// Lists the public rooms on this server.
#[tracing::instrument(skip(db, body))]
pub async fn get_public_rooms_filtered_route(
db: DatabaseGuard,
body: Ruma<get_public_rooms_filtered::v1::Request<'_>>,
@ -613,7 +607,6 @@ pub async fn get_public_rooms_filtered_route(
/// # `GET /_matrix/federation/v1/publicRooms`
///
/// Lists the public rooms on this server.
#[tracing::instrument(skip(db, body))]
pub async fn get_public_rooms_route(
db: DatabaseGuard,
body: Ruma<get_public_rooms::v1::Request<'_>>,
@ -654,7 +647,6 @@ pub async fn get_public_rooms_route(
/// # `PUT /_matrix/federation/v1/send/{txnId}`
///
/// Push EDUs and PDUs to this server.
#[tracing::instrument(skip(db, body))]
pub async fn send_transaction_message_route(
db: DatabaseGuard,
body: Ruma<send_transaction_message::v1::Request<'_>>,
@ -814,7 +806,7 @@ pub async fn send_transaction_message_route(
// Check if this is a new transaction id
if db
.transaction_ids
.existing_txnid(&sender, None, (&*message_id).into())?
.existing_txnid(&sender, None, &message_id)?
.is_some()
{
continue;
@ -862,7 +854,7 @@ pub async fn send_transaction_message_route(
// Save transaction id with empty data
db.transaction_ids
.add_txnid(&sender, None, (&*message_id).into(), &[])?;
.add_txnid(&sender, None, &message_id, &[])?;
}
Edu::_Custom(_) => {}
}
@ -1075,7 +1067,7 @@ pub(crate) async fn handle_incoming_pdu<'a>(
.await
}
#[tracing::instrument(skip(origin, create_event, event_id, room_id, value, db, pub_key_map))]
#[tracing::instrument(skip_all)]
fn handle_outlier_pdu<'a>(
origin: &'a ServerName,
create_event: &'a PduEvent,
@ -1237,7 +1229,7 @@ fn handle_outlier_pdu<'a>(
})
}
#[tracing::instrument(skip(incoming_pdu, val, create_event, origin, db, room_id, pub_key_map))]
#[tracing::instrument(skip_all)]
async fn upgrade_outlier_to_timeline_pdu(
incoming_pdu: Arc<PduEvent>,
val: BTreeMap<String, CanonicalJsonValue>,
@ -1780,7 +1772,7 @@ async fn upgrade_outlier_to_timeline_pdu(
/// b. Look at outlier pdu tree
/// c. Ask origin server over federation
/// d. TODO: Ask other servers over federation?
#[tracing::instrument(skip(db, origin, events, create_event, room_id, pub_key_map))]
#[tracing::instrument(skip_all)]
pub(crate) fn fetch_and_handle_outliers<'a>(
db: &'a Database,
origin: &'a ServerName,
@ -1921,7 +1913,7 @@ pub(crate) fn fetch_and_handle_outliers<'a>(
/// Search the DB for the signing keys of the given server, if we don't have them
/// fetch them from the server and save to our DB.
#[tracing::instrument(skip(db, origin, signature_ids))]
#[tracing::instrument(skip_all)]
pub(crate) async fn fetch_signing_keys(
db: &Database,
origin: &ServerName,
@ -2080,7 +2072,7 @@ pub(crate) async fn fetch_signing_keys(
/// Append the incoming event setting the state snapshot to the state from the
/// server that sent the event.
#[tracing::instrument(skip(db, pdu, pdu_json, new_room_leaves, state_ids_compressed, _mutex_lock))]
#[tracing::instrument(skip_all)]
fn append_incoming_pdu<'a>(
db: &Database,
pdu: &PduEvent,
@ -2284,7 +2276,6 @@ fn get_auth_chain_inner(
/// Retrieves a single event from the server.
///
/// - Only works if a user of this server is currently invited or joined the room
#[tracing::instrument(skip(db, body))]
pub async fn get_event_route(
db: DatabaseGuard,
body: Ruma<get_event::v1::Request<'_>>,
@ -2328,7 +2319,6 @@ pub async fn get_event_route(
/// # `POST /_matrix/federation/v1/get_missing_events/{roomId}`
///
/// Retrieves events that the sender is missing.
#[tracing::instrument(skip(db, body))]
pub async fn get_missing_events_route(
db: DatabaseGuard,
body: Ruma<get_missing_events::v1::Request<'_>>,
@ -2402,7 +2392,6 @@ pub async fn get_missing_events_route(
/// Retrieves the auth chain for a given event.
///
/// - This does not include the event itself
#[tracing::instrument(skip(db, body))]
pub async fn get_event_authorization_route(
db: DatabaseGuard,
body: Ruma<get_event_authorization::v1::Request<'_>>,
@ -2451,7 +2440,6 @@ pub async fn get_event_authorization_route(
/// # `GET /_matrix/federation/v1/state/{roomId}`
///
/// Retrieves the current state of the room.
#[tracing::instrument(skip(db, body))]
pub async fn get_room_state_route(
db: DatabaseGuard,
body: Ruma<get_room_state::v1::Request<'_>>,
@ -2511,7 +2499,6 @@ pub async fn get_room_state_route(
/// # `GET /_matrix/federation/v1/state_ids/{roomId}`
///
/// Retrieves the current state of the room.
#[tracing::instrument(skip(db, body))]
pub async fn get_room_state_ids_route(
db: DatabaseGuard,
body: Ruma<get_room_state_ids::v1::Request<'_>>,
@ -2560,7 +2547,6 @@ pub async fn get_room_state_ids_route(
/// # `GET /_matrix/federation/v1/make_join/{roomId}/{userId}`
///
/// Creates a join template.
#[tracing::instrument(skip(db, body))]
pub async fn create_join_event_template_route(
db: DatabaseGuard,
body: Ruma<create_join_event_template::v1::Request<'_>>,
@ -2841,7 +2827,6 @@ async fn create_join_event(
/// # `PUT /_matrix/federation/v1/send_join/{roomId}/{eventId}`
///
/// Submits a signed join event.
#[tracing::instrument(skip(db, body))]
pub async fn create_join_event_v1_route(
db: DatabaseGuard,
body: Ruma<create_join_event::v1::Request<'_>>,
@ -2859,7 +2844,6 @@ pub async fn create_join_event_v1_route(
/// # `PUT /_matrix/federation/v2/send_join/{roomId}/{eventId}`
///
/// Submits a signed join event.
#[tracing::instrument(skip(db, body))]
pub async fn create_join_event_v2_route(
db: DatabaseGuard,
body: Ruma<create_join_event::v2::Request<'_>>,
@ -2877,7 +2861,6 @@ pub async fn create_join_event_v2_route(
/// # `PUT /_matrix/federation/v2/invite/{roomId}/{eventId}`
///
/// Invites a remote user to a room.
#[tracing::instrument(skip(db, body))]
pub async fn create_invite_route(
db: DatabaseGuard,
body: Ruma<create_invite::v2::Request<'_>>,
@ -2988,7 +2971,6 @@ pub async fn create_invite_route(
/// # `GET /_matrix/federation/v1/user/devices/{userId}`
///
/// Gets information on all devices of the user.
#[tracing::instrument(skip(db, body))]
pub async fn get_devices_route(
db: DatabaseGuard,
body: Ruma<get_devices::v1::Request<'_>>,
@ -3026,7 +3008,6 @@ pub async fn get_devices_route(
/// # `GET /_matrix/federation/v1/query/directory`
///
/// Resolve a room alias to a room id.
#[tracing::instrument(skip(db, body))]
pub async fn get_room_information_route(
db: DatabaseGuard,
body: Ruma<get_room_information::v1::Request<'_>>,
@ -3052,7 +3033,6 @@ pub async fn get_room_information_route(
/// # `GET /_matrix/federation/v1/query/profile`
///
/// Gets information on a profile.
#[tracing::instrument(skip(db, body))]
pub async fn get_profile_information_route(
db: DatabaseGuard,
body: Ruma<get_profile_information::v1::Request<'_>>,
@ -3090,7 +3070,6 @@ pub async fn get_profile_information_route(
/// # `POST /_matrix/federation/v1/user/keys/query`
///
/// Gets devices and identity keys for the given users.
#[tracing::instrument(skip(db, body))]
pub async fn get_keys_route(
db: DatabaseGuard,
body: Ruma<get_keys::v1::Request>,
@ -3119,7 +3098,6 @@ pub async fn get_keys_route(
/// # `POST /_matrix/federation/v1/user/keys/claim`
///
/// Claims one-time keys.
#[tracing::instrument(skip(db, body))]
pub async fn claim_keys_route(
db: DatabaseGuard,
body: Ruma<claim_keys::v1::Request>,
@ -3137,7 +3115,7 @@ pub async fn claim_keys_route(
})
}
#[tracing::instrument(skip(event, pub_key_map, db))]
#[tracing::instrument(skip_all)]
pub(crate) async fn fetch_required_signing_keys(
event: &BTreeMap<String, CanonicalJsonValue>,
pub_key_map: &RwLock<BTreeMap<String, BTreeMap<String, Base64>>>,

View file

@ -8,7 +8,6 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
#[tracing::instrument]
pub fn millis_since_unix_epoch() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
@ -39,19 +38,16 @@ pub fn generate_keypair() -> Vec<u8> {
}
/// Parses the bytes into an u64.
#[tracing::instrument(skip(bytes))]
pub fn u64_from_bytes(bytes: &[u8]) -> Result<u64, std::array::TryFromSliceError> {
let array: [u8; 8] = bytes.try_into()?;
Ok(u64::from_be_bytes(array))
}
/// Parses the bytes into a string.
#[tracing::instrument(skip(bytes))]
pub fn string_from_bytes(bytes: &[u8]) -> Result<String, std::string::FromUtf8Error> {
String::from_utf8(bytes.to_vec())
}
#[tracing::instrument(skip(length))]
pub fn random_string(length: usize) -> String {
thread_rng()
.sample_iter(&rand::distributions::Alphanumeric)
@ -61,7 +57,6 @@ pub fn random_string(length: usize) -> String {
}
/// Calculate a new hash for the given password
#[tracing::instrument(skip(password))]
pub fn calculate_hash(password: &str) -> Result<String, argon2::Error> {
let hashing_config = Config {
variant: Variant::Argon2id,
@ -72,7 +67,6 @@ pub fn calculate_hash(password: &str) -> Result<String, argon2::Error> {
argon2::hash_encoded(password.as_bytes(), salt.as_bytes(), &hashing_config)
}
#[tracing::instrument(skip(iterators, check_order))]
pub fn common_elements(
mut iterators: impl Iterator<Item = impl Iterator<Item = Vec<u8>>>,
check_order: impl Fn(&[u8], &[u8]) -> Ordering,
@ -100,7 +94,6 @@ pub fn common_elements(
/// Fallible conversion from any value that implements `Serialize` to a `CanonicalJsonObject`.
///
/// `value` must serialize to an `serde_json::Value::Object`.
#[tracing::instrument(skip(value))]
pub fn to_canonical_object<T: serde::Serialize>(
value: T,
) -> Result<CanonicalJsonObject, CanonicalJsonError> {
@ -114,7 +107,6 @@ pub fn to_canonical_object<T: serde::Serialize>(
}
}
#[tracing::instrument(skip(deserializer))]
pub fn deserialize_from_str<
'de,
D: serde::de::Deserializer<'de>,