From e53968d9eb95ac87667b81b75fa8d6515bb86d80 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 22 Oct 2025 07:05:03 +0000 Subject: [PATCH] Improve tracing spans for notif counts and sliding-sync exts. Signed-off-by: Jason Volk --- src/api/client/sync/v5/account_data.rs | 2 +- src/api/client/sync/v5/e2ee.rs | 2 +- src/api/client/sync/v5/receipts.rs | 2 +- src/api/client/sync/v5/selector.rs | 1 + src/api/client/sync/v5/to_device.rs | 2 +- src/api/client/sync/v5/typing.rs | 2 +- src/service/rooms/user/mod.rs | 4 ++++ 7 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/api/client/sync/v5/account_data.rs b/src/api/client/sync/v5/account_data.rs index ddc5a284..5f9a4936 100644 --- a/src/api/client/sync/v5/account_data.rs +++ b/src/api/client/sync/v5/account_data.rs @@ -8,7 +8,7 @@ use tuwunel_service::sync::Room; use super::{Connection, SyncInfo, Window, extension_rooms_selector}; -#[tracing::instrument(level = "trace", skip_all)] +#[tracing::instrument(name = "account_data", level = "trace", skip_all)] pub(super) async fn collect( sync_info: SyncInfo<'_>, conn: &Connection, diff --git a/src/api/client/sync/v5/e2ee.rs b/src/api/client/sync/v5/e2ee.rs index 32d373a3..9cd88896 100644 --- a/src/api/client/sync/v5/e2ee.rs +++ b/src/api/client/sync/v5/e2ee.rs @@ -26,7 +26,7 @@ use tuwunel_service::sync::Connection; use super::{SyncInfo, share_encrypted_room}; -#[tracing::instrument(level = "trace", skip_all)] +#[tracing::instrument(name = "e2ee", level = "trace", skip_all)] pub(super) async fn collect( sync_info: SyncInfo<'_>, conn: &Connection, diff --git a/src/api/client/sync/v5/receipts.rs b/src/api/client/sync/v5/receipts.rs index 9f37031f..7e64952a 100644 --- a/src/api/client/sync/v5/receipts.rs +++ b/src/api/client/sync/v5/receipts.rs @@ -13,7 +13,7 @@ use tuwunel_service::{rooms::read_receipt::pack_receipts, sync::Room}; use super::{Connection, SyncInfo, Window, extension_rooms_selector}; -#[tracing::instrument(level = "trace", skip_all)] +#[tracing::instrument(name = "receipts", level = "trace", skip_all)] pub(super) async fn collect( sync_info: SyncInfo<'_>, conn: &Connection, diff --git a/src/api/client/sync/v5/selector.rs b/src/api/client/sync/v5/selector.rs index 3cf3e236..f2f1bc33 100644 --- a/src/api/client/sync/v5/selector.rs +++ b/src/api/client/sync/v5/selector.rs @@ -66,6 +66,7 @@ pub(super) async fn selector( (window, lists) } +#[tracing::instrument(name = "window", level = "debug", skip_all)] async fn select_window<'a, Rooms>( sync_info: SyncInfo<'_>, conn: &Connection, diff --git a/src/api/client/sync/v5/to_device.rs b/src/api/client/sync/v5/to_device.rs index 918a926c..7de338ff 100644 --- a/src/api/client/sync/v5/to_device.rs +++ b/src/api/client/sync/v5/to_device.rs @@ -4,7 +4,7 @@ use tuwunel_core::{self, Result}; use super::{Connection, SyncInfo}; -#[tracing::instrument(level = "trace", skip_all)] +#[tracing::instrument(name = "to_device", level = "trace", skip_all)] pub(super) async fn collect( SyncInfo { services, sender_user, sender_device, .. }: SyncInfo<'_>, conn: &Connection, diff --git a/src/api/client/sync/v5/typing.rs b/src/api/client/sync/v5/typing.rs index fb7293b7..aa52df4b 100644 --- a/src/api/client/sync/v5/typing.rs +++ b/src/api/client/sync/v5/typing.rs @@ -13,7 +13,7 @@ use tuwunel_core::{ use super::{Connection, SyncInfo, Window, extension_rooms_selector}; -#[tracing::instrument(level = "trace", skip_all)] +#[tracing::instrument(name = "typing", level = "trace", skip_all)] pub(super) async fn collect( sync_info: SyncInfo<'_>, conn: &Connection, diff --git a/src/service/rooms/user/mod.rs b/src/service/rooms/user/mod.rs index 87ca2780..ec8370f5 100644 --- a/src/service/rooms/user/mod.rs +++ b/src/service/rooms/user/mod.rs @@ -35,6 +35,7 @@ impl crate::Service for Service { } #[implement(Service)] +#[tracing::instrument(level = "debug", skip(self))] pub fn reset_notification_counts(&self, user_id: &UserId, room_id: &RoomId) { let count = self.services.globals.next_count(); @@ -53,6 +54,7 @@ pub fn reset_notification_counts(&self, user_id: &UserId, room_id: &RoomId) { } #[implement(Service)] +#[tracing::instrument(level = "debug", skip(self), ret)] pub async fn notification_count(&self, user_id: &UserId, room_id: &RoomId) -> u64 { let key = (user_id, room_id); self.db @@ -64,6 +66,7 @@ pub async fn notification_count(&self, user_id: &UserId, room_id: &RoomId) -> u6 } #[implement(Service)] +#[tracing::instrument(level = "debug", skip(self), ret)] pub async fn highlight_count(&self, user_id: &UserId, room_id: &RoomId) -> u64 { let key = (user_id, room_id); self.db @@ -75,6 +78,7 @@ pub async fn highlight_count(&self, user_id: &UserId, room_id: &RoomId) -> u64 { } #[implement(Service)] +#[tracing::instrument(level = "debug", skip(self), ret)] pub async fn last_notification_read(&self, user_id: &UserId, room_id: &RoomId) -> u64 { let key = (room_id, user_id); self.db