switch all tracing imports to observability::prelude

This commit is contained in:
Olivia Lee 2024-12-14 00:49:56 -08:00
parent bc5f31b3a2
commit 5fca67054e
No known key found for this signature in database
GPG key ID: 54D568A15B9CD1F9
63 changed files with 824 additions and 735 deletions

View file

@ -12,10 +12,9 @@ use ruma::{
serde::Raw,
OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, ServerName, UserId,
};
use tracing::warn;
use crate::{
observability::{FoundIn, Lookup, METRICS},
observability::{prelude::*, FoundIn, Lookup, METRICS},
service::appservice::RegistrationInfo,
services, Error, Result,
};
@ -46,7 +45,7 @@ impl Service {
}
/// Update current membership data.
#[tracing::instrument(skip(self, last_state))]
#[t::instrument(skip(self, last_state))]
pub(crate) fn update_membership(
&self,
room_id: &RoomId,
@ -76,7 +75,7 @@ impl Service {
.state
.get_create_content::<ExtractPredecessor>(room_id)
.inspect_err(|error| {
warn!(%error, "Failed to get room predecessor");
t::warn!(%error, "Failed to get room predecessor");
})
.ok()
.flatten()
@ -111,7 +110,7 @@ impl Service {
event.get(),
)
.map_err(|error| {
warn!(
t::warn!(
%error,
%event_kind,
"Invalid account data event",
@ -151,7 +150,7 @@ impl Service {
/// joining an upgraded room.
///
/// References to the predecessor room are not removed.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
fn copy_upgraded_account_data(
&self,
user_id: &UserId,
@ -216,7 +215,10 @@ impl Service {
RoomAccountDataEventType::Tag,
&event,
) {
warn!(%error, "error writing m.tag account data to upgraded room");
t::warn!(
%error,
"error writing m.tag account data to upgraded room"
);
}
Ok(())
@ -291,13 +293,17 @@ impl Service {
event_kind.clone(),
&event,
) {
warn!(%event_kind, %error, "error writing account data event after upgrading room");
t::warn!(
%event_kind,
%error,
"error writing account data event after upgrading room"
);
}
}
Ok(())
}
#[tracing::instrument(skip(self, room_id))]
#[t::instrument(skip(self, room_id))]
pub(crate) fn update_joined_count(
&self,
room_id: &RoomId,
@ -313,7 +319,7 @@ impl Service {
Ok(our_real_users)
}
#[tracing::instrument(skip(self, room_id))]
#[t::instrument(skip(self, room_id))]
pub(crate) fn get_our_real_users(
&self,
room_id: &RoomId,
@ -334,7 +340,7 @@ impl Service {
Ok(our_real_users)
}
#[tracing::instrument(skip(self, room_id, appservice))]
#[t::instrument(skip(self, room_id, appservice))]
pub(crate) fn appservice_in_room(
&self,
room_id: &RoomId,
@ -368,7 +374,7 @@ impl Service {
}
/// Makes a user forget a room.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn forget(
&self,
room_id: &RoomId,
@ -378,7 +384,7 @@ impl Service {
}
/// Returns an iterator of all servers participating in this room.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn room_servers<'a>(
&'a self,
room_id: &RoomId,
@ -386,7 +392,7 @@ impl Service {
self.db.room_servers(room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn server_in_room(
&self,
server: &ServerName,
@ -397,7 +403,7 @@ impl Service {
/// Returns an iterator of all rooms a server participates in (as far as we
/// know).
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn server_rooms<'a>(
&'a self,
server: &ServerName,
@ -406,7 +412,7 @@ impl Service {
}
/// Returns an iterator over all joined members of a room.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn room_members<'a>(
&'a self,
room_id: &RoomId,
@ -414,7 +420,7 @@ impl Service {
self.db.room_members(room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn room_joined_count(
&self,
room_id: &RoomId,
@ -422,7 +428,7 @@ impl Service {
self.db.room_joined_count(room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn room_invited_count(
&self,
room_id: &RoomId,
@ -431,7 +437,7 @@ impl Service {
}
/// Returns an iterator over all invited members of a room.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn room_members_invited<'a>(
&'a self,
room_id: &RoomId,
@ -439,7 +445,7 @@ impl Service {
self.db.room_members_invited(room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn get_invite_count(
&self,
room_id: &RoomId,
@ -448,7 +454,7 @@ impl Service {
self.db.get_invite_count(room_id, user_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn get_left_count(
&self,
room_id: &RoomId,
@ -458,7 +464,7 @@ impl Service {
}
/// Returns an iterator over all rooms this user joined.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn rooms_joined<'a>(
&'a self,
user_id: &UserId,
@ -467,7 +473,7 @@ impl Service {
}
/// Returns an iterator over all rooms a user was invited to.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn rooms_invited<'a>(
&'a self,
user_id: &UserId,
@ -477,7 +483,7 @@ impl Service {
self.db.rooms_invited(user_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn invite_state(
&self,
user_id: &UserId,
@ -486,7 +492,7 @@ impl Service {
self.db.invite_state(user_id, room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn left_state(
&self,
user_id: &UserId,
@ -496,7 +502,7 @@ impl Service {
}
/// Returns an iterator over all rooms a user left.
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn rooms_left<'a>(
&'a self,
user_id: &UserId,
@ -504,7 +510,7 @@ impl Service {
self.db.rooms_left(user_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn once_joined(
&self,
user_id: &UserId,
@ -513,7 +519,7 @@ impl Service {
self.db.once_joined(user_id, room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn is_joined(
&self,
user_id: &UserId,
@ -522,7 +528,7 @@ impl Service {
self.db.is_joined(user_id, room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn is_invited(
&self,
user_id: &UserId,
@ -531,7 +537,7 @@ impl Service {
self.db.is_invited(user_id, room_id)
}
#[tracing::instrument(skip(self))]
#[t::instrument(skip(self))]
pub(crate) fn is_left(
&self,
user_id: &UserId,