mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 00:31:24 +01:00
switch all tracing imports to observability::prelude
This commit is contained in:
parent
bc5f31b3a2
commit
5fca67054e
63 changed files with 824 additions and 735 deletions
|
|
@ -5,15 +5,14 @@ use ruma::api::{
|
|||
appservice::Registration, IncomingResponse, MatrixVersion, OutgoingRequest,
|
||||
SendAccessToken,
|
||||
};
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{services, utils, Error, Result};
|
||||
use crate::{observability::prelude::*, services, utils, Error, Result};
|
||||
|
||||
/// Sends a request to an appservice
|
||||
///
|
||||
/// Only returns None if there is no url specified in the appservice
|
||||
/// registration file
|
||||
#[tracing::instrument(skip(request))]
|
||||
#[t::instrument(skip(request))]
|
||||
pub(crate) async fn send_request<T>(
|
||||
registration: Registration,
|
||||
request: T,
|
||||
|
|
@ -63,7 +62,7 @@ where
|
|||
.execute(reqwest_request)
|
||||
.await
|
||||
.inspect_err(|error| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
appservice = registration.id,
|
||||
%destination,
|
||||
|
|
@ -84,12 +83,12 @@ where
|
|||
|
||||
// TODO: handle timeout
|
||||
let body = response.bytes().await.unwrap_or_else(|error| {
|
||||
warn!(%error, "Server error");
|
||||
t::warn!(%error, "Server error");
|
||||
Vec::new().into()
|
||||
});
|
||||
|
||||
if status != 200 {
|
||||
warn!(
|
||||
t::warn!(
|
||||
appservice = %destination,
|
||||
%status,
|
||||
%url,
|
||||
|
|
@ -108,7 +107,7 @@ where
|
|||
);
|
||||
|
||||
response.map(Some).map_err(|error| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
appservice = %destination,
|
||||
%url,
|
||||
|
|
|
|||
|
|
@ -16,10 +16,12 @@ use ruma::{
|
|||
},
|
||||
push, UserId,
|
||||
};
|
||||
use tracing::{info, warn};
|
||||
|
||||
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
||||
use crate::{api::client_server, services, utils, Ar, Error, Ra, Result};
|
||||
use crate::{
|
||||
api::client_server, observability::prelude::*, services, utils, Ar, Error,
|
||||
Ra, Result,
|
||||
};
|
||||
|
||||
const RANDOM_USER_ID_LENGTH: usize = 10;
|
||||
|
||||
|
|
@ -276,7 +278,7 @@ pub(crate) async fn register_route(
|
|||
body.initial_device_display_name.clone(),
|
||||
)?;
|
||||
|
||||
info!(%user_id, "New user registered on this server");
|
||||
t::info!(%user_id, "New user registered on this server");
|
||||
if body.appservice_info.is_none() && !is_guest {
|
||||
services().admin.send_message(RoomMessageEventContent::notice_plain(
|
||||
format!("New user {user_id} registered on this server."),
|
||||
|
|
@ -292,7 +294,7 @@ pub(crate) async fn register_route(
|
|||
{
|
||||
services().admin.make_user_admin(&user_id, displayname).await?;
|
||||
|
||||
warn!(
|
||||
t::warn!(
|
||||
%user_id,
|
||||
"Granting admin privileges to the first user",
|
||||
);
|
||||
|
|
@ -375,7 +377,7 @@ pub(crate) async fn change_password_route(
|
|||
}
|
||||
}
|
||||
|
||||
info!(user_id = %sender_user, "User changed their password");
|
||||
t::info!(user_id = %sender_user, "User changed their password");
|
||||
services().admin.send_message(RoomMessageEventContent::notice_plain(
|
||||
format!("User {sender_user} changed their password."),
|
||||
));
|
||||
|
|
@ -455,7 +457,7 @@ pub(crate) async fn deactivate_route(
|
|||
// Remove devices and mark account as deactivated
|
||||
services().users.deactivate_account(sender_user)?;
|
||||
|
||||
info!(user_id = %sender_user, "User deactivated their account");
|
||||
t::info!(user_id = %sender_user, "User deactivated their account");
|
||||
services().admin.send_message(RoomMessageEventContent::notice_plain(
|
||||
format!("User {sender_user} deactivated their account."),
|
||||
));
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@ use ruma::{
|
|||
events::StateEventType,
|
||||
uint,
|
||||
};
|
||||
use tracing::error;
|
||||
|
||||
use crate::{services, Ar, Error, Ra, Result};
|
||||
use crate::{observability::prelude::*, services, Ar, Error, Ra, Result};
|
||||
|
||||
/// # `GET /_matrix/client/r0/rooms/{roomId}/context`
|
||||
///
|
||||
|
|
@ -165,14 +164,14 @@ pub(crate) async fn get_context_route(
|
|||
if event_type != StateEventType::RoomMember {
|
||||
let Some(pdu) = services().rooms.timeline.get_pdu(&event_id)?
|
||||
else {
|
||||
error!(%event_id, "Event in state not found");
|
||||
t::error!(%event_id, "Event in state not found");
|
||||
continue;
|
||||
};
|
||||
state.push(pdu.to_state_event());
|
||||
} else if !lazy_load_enabled || lazy_loaded.contains(&state_key) {
|
||||
let Some(pdu) = services().rooms.timeline.get_pdu(&event_id)?
|
||||
else {
|
||||
error!(%event_id, "Event in state not found");
|
||||
t::error!(%event_id, "Event in state not found");
|
||||
continue;
|
||||
};
|
||||
state.push(pdu.to_state_event());
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ use ruma::{
|
|||
},
|
||||
uint, ServerName, UInt,
|
||||
};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use crate::{
|
||||
service::rooms::state::ExtractType, services, Ar, Error, Ra, Result,
|
||||
observability::prelude::*, service::rooms::state::ExtractType, services,
|
||||
Ar, Error, Ra, Result,
|
||||
};
|
||||
|
||||
/// # `POST /_matrix/client/r0/publicRooms`
|
||||
|
|
@ -94,7 +94,7 @@ pub(crate) async fn set_room_visibility_route(
|
|||
match &body.visibility {
|
||||
room::Visibility::Public => {
|
||||
services().rooms.directory.set_public(&body.room_id)?;
|
||||
info!(
|
||||
t::info!(
|
||||
user_id = %sender_user,
|
||||
room_id = %body.room_id,
|
||||
"User made room public",
|
||||
|
|
@ -269,7 +269,7 @@ pub(crate) async fn get_public_rooms_filtered_helper(
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[tracing::instrument]
|
||||
#[t::instrument]
|
||||
fn room_id_to_chunk(room_id: ruma::OwnedRoomId) -> Result<PublicRoomsChunk> {
|
||||
let canonical_alias = services()
|
||||
.rooms
|
||||
|
|
@ -292,7 +292,7 @@ fn room_id_to_chunk(room_id: ruma::OwnedRoomId) -> Result<PublicRoomsChunk> {
|
|||
.state_cache
|
||||
.room_joined_count(&room_id)?
|
||||
.unwrap_or_else(|| {
|
||||
warn!("Room has no member count");
|
||||
t::warn!("Room has no member count");
|
||||
0
|
||||
})
|
||||
.try_into()
|
||||
|
|
@ -306,7 +306,7 @@ fn room_id_to_chunk(room_id: ruma::OwnedRoomId) -> Result<PublicRoomsChunk> {
|
|||
serde_json::from_str(s.content.get())
|
||||
.map(|c: RoomTopicEventContent| Some(c.topic))
|
||||
.map_err(|_| {
|
||||
error!("Invalid room topic event in database for room",);
|
||||
t::error!("Invalid room topic event in database for room",);
|
||||
Error::bad_database("Invalid room topic event in database.")
|
||||
})
|
||||
})?;
|
||||
|
|
@ -371,7 +371,10 @@ fn room_id_to_chunk(room_id: ruma::OwnedRoomId) -> Result<PublicRoomsChunk> {
|
|||
_ => None,
|
||||
})
|
||||
.map_err(|error| {
|
||||
error!(%error, "Invalid room join rule event in database");
|
||||
t::error!(
|
||||
%error,
|
||||
"Invalid room join rule event in database"
|
||||
);
|
||||
Error::BadDatabase(
|
||||
"Invalid room join rule event in database.",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@ use ruma::{
|
|||
ServerName, UserId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use tracing::debug;
|
||||
|
||||
use super::SESSION_ID_LENGTH;
|
||||
use crate::{services, utils, Ar, Error, Ra, Result};
|
||||
use crate::{
|
||||
observability::prelude::*, services, utils, Ar, Error, Ra, Result,
|
||||
};
|
||||
|
||||
/// # `POST /_matrix/client/r0/keys/upload`
|
||||
///
|
||||
|
|
@ -465,7 +466,7 @@ async fn check_key_requests_back_off(server: &ServerName) -> Result<()> {
|
|||
if let Some(remaining) =
|
||||
min_elapsed_duration.checked_sub(time.elapsed())
|
||||
{
|
||||
debug!(%server, %tries, ?remaining, "Backing off from server");
|
||||
t::debug!(%server, %tries, ?remaining, "Backing off from server");
|
||||
return Err(Error::BadServerResponse(
|
||||
"bad query, still backing off",
|
||||
));
|
||||
|
|
@ -504,7 +505,7 @@ async fn request_keys_from(
|
|||
match &result {
|
||||
Ok(_) => reset_key_request_back_off(server).await,
|
||||
Err(error) => {
|
||||
debug!(%server, %error, "remote device key query failed");
|
||||
t::debug!(%server, %error, "remote device key query failed");
|
||||
back_off_key_requests(server.to_owned()).await;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ use ruma::{
|
|||
},
|
||||
http_headers::{ContentDisposition, ContentDispositionType},
|
||||
};
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
use crate::{
|
||||
observability::prelude::*,
|
||||
service::media::FileMeta,
|
||||
services,
|
||||
utils::{self, MxcData},
|
||||
|
|
@ -111,7 +111,11 @@ fn set_header_or_panic(
|
|||
header_value: HeaderValue,
|
||||
) {
|
||||
if let Some(header_value) = response.headers().get(&header_name) {
|
||||
error!(?header_name, ?header_value, "unexpected pre-existing header");
|
||||
t::error!(
|
||||
?header_name,
|
||||
?header_value,
|
||||
"unexpected pre-existing header"
|
||||
);
|
||||
panic!(
|
||||
"expected {header_name:?} to be unset but it was set to \
|
||||
{header_value:?}"
|
||||
|
|
@ -203,12 +207,12 @@ struct RemoteResponse {
|
|||
|
||||
/// Fetches remote media content from a URL specified in a
|
||||
/// `/_matrix/federation/v1/media/*/{mediaId}` `Location` header
|
||||
#[tracing::instrument]
|
||||
#[t::instrument]
|
||||
async fn get_redirected_content(
|
||||
location: String,
|
||||
) -> Result<authenticated_media_fed::Content> {
|
||||
let location = location.parse().map_err(|error| {
|
||||
warn!(location, %error, "Invalid redirect location");
|
||||
t::warn!(location, %error, "Invalid redirect location");
|
||||
Error::BadServerResponse("Invalid redirect location")
|
||||
})?;
|
||||
let response = services()
|
||||
|
|
@ -222,7 +226,7 @@ async fn get_redirected_content(
|
|||
.get(CONTENT_TYPE)
|
||||
.map(|value| {
|
||||
value.to_str().map_err(|error| {
|
||||
error!(
|
||||
t::error!(
|
||||
?value,
|
||||
%error,
|
||||
"Invalid Content-Type header"
|
||||
|
|
@ -238,7 +242,7 @@ async fn get_redirected_content(
|
|||
.get(CONTENT_DISPOSITION)
|
||||
.map(|value| {
|
||||
ContentDisposition::try_from(value.as_bytes()).map_err(|error| {
|
||||
error!(
|
||||
t::error!(
|
||||
?value,
|
||||
%error,
|
||||
"Invalid Content-Disposition header"
|
||||
|
|
@ -255,7 +259,7 @@ async fn get_redirected_content(
|
|||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[t::instrument(skip_all)]
|
||||
async fn get_remote_content_via_federation_api(
|
||||
mxc: &MxcData<'_>,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
|
|
@ -275,11 +279,11 @@ async fn get_remote_content_via_federation_api(
|
|||
|
||||
let content = match content {
|
||||
authenticated_media_fed::FileOrLocation::File(content) => {
|
||||
debug!("Got media from remote server");
|
||||
t::debug!("Got media from remote server");
|
||||
content
|
||||
}
|
||||
authenticated_media_fed::FileOrLocation::Location(location) => {
|
||||
debug!(location, "Following redirect");
|
||||
t::debug!(location, "Following redirect");
|
||||
get_redirected_content(location).await?
|
||||
}
|
||||
};
|
||||
|
|
@ -291,7 +295,7 @@ async fn get_remote_content_via_federation_api(
|
|||
}
|
||||
|
||||
#[allow(deprecated)] // unauthenticated media
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[t::instrument(skip_all)]
|
||||
async fn get_remote_content_via_legacy_api(
|
||||
mxc: &MxcData<'_>,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
|
|
@ -319,7 +323,7 @@ async fn get_remote_content_via_legacy_api(
|
|||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[t::instrument]
|
||||
pub(crate) async fn get_remote_content(
|
||||
mxc: &MxcData<'_>,
|
||||
) -> Result<RemoteResponse, Error> {
|
||||
|
|
@ -327,7 +331,7 @@ pub(crate) async fn get_remote_content(
|
|||
|
||||
let response = match fed_result {
|
||||
Ok(response) => {
|
||||
debug!("Got remote content via authenticated media API");
|
||||
t::debug!("Got remote content via authenticated media API");
|
||||
response
|
||||
}
|
||||
Err(Error::Federation(_, error))
|
||||
|
|
@ -335,7 +339,7 @@ pub(crate) async fn get_remote_content(
|
|||
// https://github.com/t2bot/matrix-media-repo/issues/609
|
||||
|| error.error_kind() == Some(&ErrorKind::Unauthorized) =>
|
||||
{
|
||||
info!(
|
||||
t::info!(
|
||||
"Remote server does not support authenticated media, falling \
|
||||
back to deprecated API"
|
||||
);
|
||||
|
|
@ -713,7 +717,7 @@ pub(crate) async fn get_content_thumbnail_route(
|
|||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[t::instrument(skip_all)]
|
||||
async fn get_remote_thumbnail_via_federation_api(
|
||||
server_name: &ruma::ServerName,
|
||||
request: authenticated_media_fed::get_content_thumbnail::v1::Request,
|
||||
|
|
@ -728,11 +732,11 @@ async fn get_remote_thumbnail_via_federation_api(
|
|||
|
||||
let content = match content {
|
||||
authenticated_media_fed::FileOrLocation::File(content) => {
|
||||
debug!("Got thumbnail from remote server");
|
||||
t::debug!("Got thumbnail from remote server");
|
||||
content
|
||||
}
|
||||
authenticated_media_fed::FileOrLocation::Location(location) => {
|
||||
debug!(location, "Following redirect");
|
||||
t::debug!(location, "Following redirect");
|
||||
get_redirected_content(location).await?
|
||||
}
|
||||
};
|
||||
|
|
@ -744,7 +748,7 @@ async fn get_remote_thumbnail_via_federation_api(
|
|||
}
|
||||
|
||||
#[allow(deprecated)] // unauthenticated media
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[t::instrument(skip_all)]
|
||||
async fn get_remote_thumbnail_via_legacy_api(
|
||||
server_name: &ruma::ServerName,
|
||||
authenticated_media_fed::get_content_thumbnail::v1::Request {
|
||||
|
|
@ -784,7 +788,7 @@ async fn get_remote_thumbnail_via_legacy_api(
|
|||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
#[t::instrument]
|
||||
pub(crate) async fn get_remote_thumbnail(
|
||||
server_name: &ruma::ServerName,
|
||||
request: authenticated_media_fed::get_content_thumbnail::v1::Request,
|
||||
|
|
@ -795,7 +799,7 @@ pub(crate) async fn get_remote_thumbnail(
|
|||
|
||||
let response = match fed_result {
|
||||
Ok(response) => {
|
||||
debug!("Got remote content via authenticated media API");
|
||||
t::debug!("Got remote content via authenticated media API");
|
||||
response
|
||||
}
|
||||
Err(Error::Federation(_, error))
|
||||
|
|
@ -803,7 +807,7 @@ pub(crate) async fn get_remote_thumbnail(
|
|||
// https://github.com/t2bot/matrix-media-repo/issues/609
|
||||
|| error.error_kind() == Some(&ErrorKind::Unauthorized) =>
|
||||
{
|
||||
info!(
|
||||
t::info!(
|
||||
"Remote server does not support authenticated media, falling \
|
||||
back to deprecated API"
|
||||
);
|
||||
|
|
@ -891,7 +895,7 @@ async fn get_content_thumbnail_route_ruma(
|
|||
resp.content.content_type,
|
||||
));
|
||||
}
|
||||
Err(error) => warn!(
|
||||
Err(error) => t::warn!(
|
||||
%error,
|
||||
"Failed to fetch thumbnail via federation, trying to fetch \
|
||||
original media and create thumbnail ourselves"
|
||||
|
|
@ -912,7 +916,9 @@ async fn get_content_thumbnail_route_ruma(
|
|||
return Ok(make_response(file, content_type));
|
||||
}
|
||||
|
||||
error!("Source media doesn't exist even after fetching it from remote");
|
||||
t::error!(
|
||||
"Source media doesn't exist even after fetching it from remote"
|
||||
);
|
||||
}
|
||||
|
||||
Err(Error::BadRequest(ErrorKind::NotYetUploaded, "Media not found."))
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ use ruma::{
|
|||
};
|
||||
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
use super::get_alias_helper;
|
||||
use crate::{
|
||||
observability::prelude::*,
|
||||
service::{
|
||||
globals::SigningKeys,
|
||||
pdu::{gen_event_id_canonical_json, PduBuilder},
|
||||
|
|
@ -501,7 +501,7 @@ pub(crate) async fn joined_members_route(
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[tracing::instrument(skip(reason, _third_party_signed))]
|
||||
#[t::instrument(skip(reason, _third_party_signed))]
|
||||
async fn join_room_by_id_helper(
|
||||
sender_user: Option<&UserId>,
|
||||
room_id: &RoomId,
|
||||
|
|
@ -523,7 +523,7 @@ async fn join_room_by_id_helper(
|
|||
.state_cache
|
||||
.server_in_room(services().globals.server_name(), room_id)?
|
||||
{
|
||||
info!("We can join locally");
|
||||
t::info!("We can join locally");
|
||||
|
||||
let join_rules_event = services().rooms.state_accessor.room_state_get(
|
||||
room_id,
|
||||
|
|
@ -537,7 +537,7 @@ async fn join_room_by_id_helper(
|
|||
.map(|join_rules_event| {
|
||||
serde_json::from_str(join_rules_event.content.get())
|
||||
.map_err(|error| {
|
||||
warn!(%error, "Invalid join rules event");
|
||||
t::warn!(%error, "Invalid join rules event");
|
||||
Error::bad_database(
|
||||
"Invalid join rules event in db.",
|
||||
)
|
||||
|
|
@ -636,7 +636,7 @@ async fn join_room_by_id_helper(
|
|||
return Err(error);
|
||||
}
|
||||
|
||||
info!(
|
||||
t::info!(
|
||||
"We couldn't do the join locally, maybe federation can help to \
|
||||
satisfy the restricted join requirements"
|
||||
);
|
||||
|
|
@ -791,12 +791,12 @@ async fn join_room_by_id_helper(
|
|||
)
|
||||
.await?;
|
||||
} else {
|
||||
info!("Joining over federation.");
|
||||
t::info!("Joining over federation.");
|
||||
|
||||
let (make_join_response, remote_server) =
|
||||
make_join_request(sender_user, room_id, servers).await?;
|
||||
|
||||
info!("make_join finished");
|
||||
t::info!("make_join finished");
|
||||
|
||||
let room_version_id = match make_join_response.room_version {
|
||||
Some(room_version)
|
||||
|
|
@ -895,7 +895,7 @@ async fn join_room_by_id_helper(
|
|||
// It has enough fields to be called a proper event now
|
||||
let mut join_event = join_event_stub;
|
||||
|
||||
info!(server = %remote_server, "Asking other server for send_join");
|
||||
t::info!(server = %remote_server, "Asking other server for send_join");
|
||||
let send_join_response = services()
|
||||
.sending
|
||||
.send_federation_request(
|
||||
|
|
@ -911,10 +911,10 @@ async fn join_room_by_id_helper(
|
|||
)
|
||||
.await?;
|
||||
|
||||
info!("send_join finished");
|
||||
t::info!("send_join finished");
|
||||
|
||||
if let Some(signed_raw) = &send_join_response.room_state.event {
|
||||
info!(
|
||||
t::info!(
|
||||
"There is a signed event. This room is probably using \
|
||||
restricted joins. Adding signature to our event"
|
||||
);
|
||||
|
|
@ -956,7 +956,7 @@ async fn join_room_by_id_helper(
|
|||
.insert(remote_server.to_string(), signature.clone());
|
||||
}
|
||||
Err(error) => {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
server = %remote_server,
|
||||
event = ?signed_value,
|
||||
|
|
@ -969,7 +969,7 @@ async fn join_room_by_id_helper(
|
|||
|
||||
services().rooms.short.get_or_create_shortroomid(room_id)?;
|
||||
|
||||
info!("Parsing join event");
|
||||
t::info!("Parsing join event");
|
||||
let parsed_join_pdu =
|
||||
PduEvent::from_id_val(event_id, join_event.clone()).map_err(
|
||||
|_| Error::BadServerResponse("Invalid join event PDU."),
|
||||
|
|
@ -978,7 +978,7 @@ async fn join_room_by_id_helper(
|
|||
let mut state = HashMap::new();
|
||||
let pub_key_map = RwLock::new(BTreeMap::new());
|
||||
|
||||
info!("Fetching join signing keys");
|
||||
t::info!("Fetching join signing keys");
|
||||
services()
|
||||
.rooms
|
||||
.event_handler
|
||||
|
|
@ -989,7 +989,7 @@ async fn join_room_by_id_helper(
|
|||
)
|
||||
.await?;
|
||||
|
||||
info!("Going through send_join response room_state");
|
||||
t::info!("Going through send_join response room_state");
|
||||
for result in send_join_response.room_state.state.iter().map(|pdu| {
|
||||
validate_and_add_event_id(pdu, &room_version_id, &pub_key_map)
|
||||
}) {
|
||||
|
|
@ -999,7 +999,7 @@ async fn join_room_by_id_helper(
|
|||
|
||||
let pdu = PduEvent::from_id_val(&event_id, value.clone()).map_err(
|
||||
|error| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
object = ?value,
|
||||
"Invalid PDU in send_join response",
|
||||
|
|
@ -1021,7 +1021,7 @@ async fn join_room_by_id_helper(
|
|||
}
|
||||
}
|
||||
|
||||
info!("Going through send_join response auth_chain");
|
||||
t::info!("Going through send_join response auth_chain");
|
||||
for result in
|
||||
send_join_response.room_state.auth_chain.iter().map(|pdu| {
|
||||
validate_and_add_event_id(pdu, &room_version_id, &pub_key_map)
|
||||
|
|
@ -1034,7 +1034,7 @@ async fn join_room_by_id_helper(
|
|||
services().rooms.outlier.add_pdu_outlier(&event_id, &value)?;
|
||||
}
|
||||
|
||||
info!("Running send_join auth check");
|
||||
t::info!("Running send_join auth check");
|
||||
let authenticated = state_res::event_auth::auth_check(
|
||||
&state_res::RoomVersion::new(&room_version_id).map_err(|_| {
|
||||
Error::UnsupportedRoomVersion(room_version_id.clone())
|
||||
|
|
@ -1062,7 +1062,7 @@ async fn join_room_by_id_helper(
|
|||
},
|
||||
)
|
||||
.map_err(|error| {
|
||||
warn!(%error, "Auth check failed");
|
||||
t::warn!(%error, "Auth check failed");
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed")
|
||||
})?;
|
||||
|
||||
|
|
@ -1073,7 +1073,7 @@ async fn join_room_by_id_helper(
|
|||
));
|
||||
}
|
||||
|
||||
info!("Saving state from send_join");
|
||||
t::info!("Saving state from send_join");
|
||||
let (statehash_before_join, new, removed) =
|
||||
services().rooms.state_compressor.save_state(
|
||||
room_id,
|
||||
|
|
@ -1096,7 +1096,7 @@ async fn join_room_by_id_helper(
|
|||
.force_state(&room_token, statehash_before_join, new, removed)
|
||||
.await?;
|
||||
|
||||
info!("Updating joined counts for new room");
|
||||
t::info!("Updating joined counts for new room");
|
||||
services().rooms.state_cache.update_joined_count(room_id)?;
|
||||
|
||||
// We append to state before appending the pdu, so we don't have a
|
||||
|
|
@ -1105,7 +1105,7 @@ async fn join_room_by_id_helper(
|
|||
let statehash_after_join =
|
||||
services().rooms.state.append_to_state(&parsed_join_pdu)?;
|
||||
|
||||
info!("Appending new room join event");
|
||||
t::info!("Appending new room join event");
|
||||
services()
|
||||
.rooms
|
||||
.timeline
|
||||
|
|
@ -1117,7 +1117,7 @@ async fn join_room_by_id_helper(
|
|||
)
|
||||
.await?;
|
||||
|
||||
info!("Setting final room state for new room");
|
||||
t::info!("Setting final room state for new room");
|
||||
// We set the room state after inserting the pdu, so that we never have
|
||||
// a moment in time where events in the current room state do
|
||||
// not exist
|
||||
|
|
@ -1146,7 +1146,7 @@ async fn make_join_request(
|
|||
if remote_server == services().globals.server_name() {
|
||||
continue;
|
||||
}
|
||||
info!(server = %remote_server, "Asking other server for make_join");
|
||||
t::info!(server = %remote_server, "Asking other server for make_join");
|
||||
let make_join_response = services()
|
||||
.sending
|
||||
.send_federation_request(
|
||||
|
|
@ -1164,7 +1164,7 @@ async fn make_join_request(
|
|||
return Ok((r, remote_server.clone()));
|
||||
}
|
||||
Err(error) => {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
server = %remote_server,
|
||||
"Remote join request failed",
|
||||
|
|
@ -1184,7 +1184,7 @@ async fn validate_and_add_event_id(
|
|||
) -> Result<(OwnedEventId, CanonicalJsonObject)> {
|
||||
let mut value: CanonicalJsonObject = serde_json::from_str(pdu.get())
|
||||
.map_err(|error| {
|
||||
error!(%error, object = ?pdu, "Invalid PDU in server response");
|
||||
t::error!(%error, object = ?pdu, "Invalid PDU in server response");
|
||||
Error::BadServerResponse("Invalid PDU in server response")
|
||||
})?;
|
||||
let event_id = EventId::parse(format!(
|
||||
|
|
@ -1216,7 +1216,7 @@ async fn validate_and_add_event_id(
|
|||
}
|
||||
|
||||
if time.elapsed() < min_elapsed_duration {
|
||||
debug!(%event_id, "Backing off from event");
|
||||
t::debug!(%event_id, "Backing off from event");
|
||||
return Err(Error::BadServerResponse(
|
||||
"bad event, still backing off",
|
||||
));
|
||||
|
|
@ -1224,7 +1224,7 @@ async fn validate_and_add_event_id(
|
|||
}
|
||||
|
||||
let origin_server_ts = value.get("origin_server_ts").ok_or_else(|| {
|
||||
error!("Invalid PDU, no origin_server_ts field");
|
||||
t::error!("Invalid PDU, no origin_server_ts field");
|
||||
Error::BadRequest(
|
||||
ErrorKind::MissingParam,
|
||||
"Invalid PDU, no origin_server_ts field",
|
||||
|
|
@ -1258,7 +1258,7 @@ async fn validate_and_add_event_id(
|
|||
if let Err(error) =
|
||||
ruma::signatures::verify_event(&keys, &value, room_version)
|
||||
{
|
||||
warn!(
|
||||
t::warn!(
|
||||
%event_id,
|
||||
%error,
|
||||
?pdu,
|
||||
|
|
@ -1361,7 +1361,7 @@ pub(crate) async fn invite_helper(
|
|||
};
|
||||
|
||||
if *pdu.event_id != *event_id {
|
||||
warn!(
|
||||
t::warn!(
|
||||
server = %user_id.server_name(),
|
||||
our_object = ?pdu_json,
|
||||
their_object = ?value,
|
||||
|
|
@ -1481,14 +1481,14 @@ pub(crate) async fn leave_all_rooms(user_id: &UserId) -> Result<()> {
|
|||
};
|
||||
|
||||
if let Err(error) = leave_room(user_id, &room_id, None).await {
|
||||
warn!(%user_id, %room_id, %error, "Failed to leave room");
|
||||
t::warn!(%user_id, %room_id, %error, "Failed to leave room");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(reason))]
|
||||
#[t::instrument(skip(reason))]
|
||||
pub(crate) async fn leave_room(
|
||||
user_id: &UserId,
|
||||
room_id: &RoomId,
|
||||
|
|
@ -1515,7 +1515,7 @@ pub(crate) async fn leave_room(
|
|||
// Fix for broken rooms
|
||||
let member_event = match member_event {
|
||||
None => {
|
||||
error!("Trying to leave a room you are not a member of.");
|
||||
t::error!("Trying to leave a room you are not a member of.");
|
||||
|
||||
services().rooms.state_cache.update_membership(
|
||||
room_id,
|
||||
|
|
@ -1557,7 +1557,7 @@ pub(crate) async fn leave_room(
|
|||
.await?;
|
||||
} else {
|
||||
if let Err(error) = remote_leave_room(user_id, room_id).await {
|
||||
warn!(%error, "Failed to leave room remotely");
|
||||
t::warn!(%error, "Failed to leave room remotely");
|
||||
// Don't tell the client about this error
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,11 @@ use ruma::{
|
|||
},
|
||||
};
|
||||
use serde_json::value::to_raw_value;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{service::pdu::PduBuilder, services, Ar, Error, Ra, Result};
|
||||
use crate::{
|
||||
observability::prelude::*, service::pdu::PduBuilder, services, Ar, Error,
|
||||
Ra, Result,
|
||||
};
|
||||
|
||||
/// # `PUT /_matrix/client/r0/profile/{userId}/displayname`
|
||||
///
|
||||
|
|
@ -91,7 +93,7 @@ pub(crate) async fn set_displayname_route(
|
|||
.build_and_append_pdu(pdu_builder, sender_user, &room_token)
|
||||
.await
|
||||
{
|
||||
warn!(%error, "failed to add PDU");
|
||||
t::warn!(%error, "failed to add PDU");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +205,7 @@ pub(crate) async fn set_avatar_url_route(
|
|||
.build_and_append_pdu(pdu_builder, sender_user, &room_token)
|
||||
.await
|
||||
{
|
||||
warn!(%error, "failed to add PDU");
|
||||
t::warn!(%error, "failed to add PDU");
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ use ruma::{
|
|||
CanonicalJsonObject, OwnedRoomAliasId, RoomAliasId, RoomId,
|
||||
};
|
||||
use serde_json::{json, value::to_raw_value};
|
||||
use tracing::{info, warn};
|
||||
|
||||
use crate::{
|
||||
api::client_server::invite_helper, service::pdu::PduBuilder, services,
|
||||
utils::room_version::RoomVersion, Ar, Error, Ra, Result,
|
||||
api::client_server::invite_helper, observability::prelude::*,
|
||||
service::pdu::PduBuilder, services, utils::room_version::RoomVersion, Ar,
|
||||
Error, Ra, Result,
|
||||
};
|
||||
|
||||
/// # `POST /_matrix/client/r0/createRoom`
|
||||
|
|
@ -400,7 +400,7 @@ pub(crate) async fn create_room_route(
|
|||
for event in &body.initial_state {
|
||||
let mut pdu_builder =
|
||||
event.deserialize_as::<PduBuilder>().map_err(|error| {
|
||||
warn!(%error, "Invalid initial state event");
|
||||
t::warn!(%error, "Invalid initial state event");
|
||||
Error::BadRequest(
|
||||
ErrorKind::InvalidParam,
|
||||
"Invalid initial state event.",
|
||||
|
|
@ -474,7 +474,7 @@ pub(crate) async fn create_room_route(
|
|||
invite_helper(sender_user, user_id, &room_id, None, body.is_direct)
|
||||
.await
|
||||
{
|
||||
warn!(%error, "Invite helper failed");
|
||||
t::warn!(%error, "Invite helper failed");
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -487,7 +487,7 @@ pub(crate) async fn create_room_route(
|
|||
services().rooms.directory.set_public(&room_id)?;
|
||||
}
|
||||
|
||||
info!(user_id = %sender_user, room_id = %room_id, "User created a room");
|
||||
t::info!(user_id = %sender_user, room_id = %room_id, "User created a room");
|
||||
|
||||
Ok(Ra(create_room::v3::Response::new(room_id)))
|
||||
}
|
||||
|
|
@ -505,7 +505,7 @@ pub(crate) async fn get_room_event_route(
|
|||
|
||||
let event = services().rooms.timeline.get_pdu(&body.event_id)?.ok_or_else(
|
||||
|| {
|
||||
warn!(event_id = %body.event_id, "Event not found");
|
||||
t::warn!(event_id = %body.event_id, "Event not found");
|
||||
Error::BadRequest(ErrorKind::NotFound, "Event not found.")
|
||||
},
|
||||
)?;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,11 @@ use ruma::{
|
|||
UserId,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use tracing::{info, warn};
|
||||
|
||||
use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
||||
use crate::{services, utils, Ar, Error, Ra, Result};
|
||||
use crate::{
|
||||
observability::prelude::*, services, utils, Ar, Error, Ra, Result,
|
||||
};
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Claims {
|
||||
|
|
@ -79,7 +80,7 @@ pub(crate) async fn login_route(
|
|||
} else if let Some(user) = user {
|
||||
UserId::parse(user)
|
||||
} else {
|
||||
warn!(kind = ?body.login_info, "Bad login kind");
|
||||
t::warn!(kind = ?body.login_info, "Bad login kind");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::forbidden(),
|
||||
"Bad login type.",
|
||||
|
|
@ -184,7 +185,7 @@ pub(crate) async fn login_route(
|
|||
} else if let Some(user) = user {
|
||||
UserId::parse(user)
|
||||
} else {
|
||||
warn!(kind = ?body.login_info, "Bad login kind");
|
||||
t::warn!(kind = ?body.login_info, "Bad login kind");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::forbidden(),
|
||||
"Bad login type.",
|
||||
|
|
@ -214,7 +215,10 @@ pub(crate) async fn login_route(
|
|||
user_id
|
||||
}
|
||||
_ => {
|
||||
warn!(kind = ?body.login_info, "Unsupported or unknown login kind");
|
||||
t::warn!(
|
||||
kind = ?body.login_info,
|
||||
"Unsupported or unknown login kind"
|
||||
);
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Unknown,
|
||||
"Unsupported login type.",
|
||||
|
|
@ -250,7 +254,7 @@ pub(crate) async fn login_route(
|
|||
)?;
|
||||
}
|
||||
|
||||
info!(%user_id, %device_id, "User logged in");
|
||||
t::info!(%user_id, %device_id, "User logged in");
|
||||
|
||||
// Homeservers are still required to send the `home_server` field
|
||||
#[allow(deprecated)]
|
||||
|
|
@ -292,7 +296,11 @@ pub(crate) async fn logout_route(
|
|||
|
||||
services().users.remove_device(sender_user, sender_device)?;
|
||||
|
||||
info!(user_id = %sender_user, device_id = %sender_device, "User logged out");
|
||||
t::info!(
|
||||
user_id = %sender_user,
|
||||
device_id = %sender_device,
|
||||
"User logged out"
|
||||
);
|
||||
|
||||
Ok(Ra(logout::v3::Response::new()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ use ruma::{
|
|||
EventId, RoomAliasId, RoomId, UserId,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{service::pdu::PduBuilder, services, Ar, Error, Ra, Result};
|
||||
use crate::{
|
||||
observability::prelude::*, service::pdu::PduBuilder, services, Ar, Error,
|
||||
Ra, Result,
|
||||
};
|
||||
|
||||
/// # `PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}`
|
||||
///
|
||||
|
|
@ -146,9 +148,10 @@ pub(crate) async fn get_state_events_for_key_route(
|
|||
.state_accessor
|
||||
.room_state_get(&body.room_id, &body.event_type, &body.state_key)?
|
||||
.ok_or_else(|| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
"State event {:?} not found in room {:?}",
|
||||
&body.event_type, &body.room_id
|
||||
&body.event_type,
|
||||
&body.room_id
|
||||
);
|
||||
Error::BadRequest(ErrorKind::NotFound, "State event not found.")
|
||||
})?;
|
||||
|
|
@ -187,9 +190,10 @@ pub(crate) async fn get_state_events_for_empty_key_route(
|
|||
.state_accessor
|
||||
.room_state_get(&body.room_id, &body.event_type, "")?
|
||||
.ok_or_else(|| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
"State event {:?} not found in room {:?}",
|
||||
&body.event_type, &body.room_id
|
||||
&body.event_type,
|
||||
&body.room_id
|
||||
);
|
||||
Error::BadRequest(ErrorKind::NotFound, "State event not found.")
|
||||
})?;
|
||||
|
|
@ -278,7 +282,7 @@ async fn validate_canonical_alias_event(
|
|||
.and_then(|old_event| {
|
||||
serde_json::from_str::<Extract>(old_event.content.get())
|
||||
.inspect_err(|error| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
event_id=%old_event.event_id,
|
||||
"Invalid canonical alias event in database"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use ruma::{events::StateEventType, RoomId, UserId};
|
||||
use tracing::error;
|
||||
|
||||
use crate::{
|
||||
service::rooms::timeline::PduCount, services, Error, PduEvent, Result,
|
||||
observability::prelude::*, service::rooms::timeline::PduCount, services,
|
||||
Error, PduEvent, Result,
|
||||
};
|
||||
|
||||
pub(crate) mod msc3575;
|
||||
|
|
@ -26,7 +26,7 @@ fn load_timeline(
|
|||
.filter_map(|x| match x {
|
||||
Ok(x) => Some(x),
|
||||
Err(error) => {
|
||||
error!(%error, "Bad PDU in pdus_since");
|
||||
t::error!(%error, "Bad PDU in pdus_since");
|
||||
None
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ use ruma::{
|
|||
},
|
||||
uint, JsOption, UInt, UserId,
|
||||
};
|
||||
use tracing::{debug, error};
|
||||
|
||||
use super::{load_timeline, share_encrypted_room};
|
||||
use crate::{
|
||||
service::rooms::timeline::PduCount, services, Ar, Error, Ra, Result,
|
||||
observability::prelude::*, service::rooms::timeline::PduCount, services,
|
||||
Ar, Error, Ra, Result,
|
||||
};
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
|
|
@ -93,7 +93,7 @@ pub(crate) async fn sync_events_v4_route(
|
|||
let Some(current_shortstatehash) =
|
||||
services().rooms.state.get_room_shortstatehash(room_id)?
|
||||
else {
|
||||
error!(%room_id, "Room has no state");
|
||||
t::error!(%room_id, "Room has no state");
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
@ -171,7 +171,10 @@ pub(crate) async fn sync_events_v4_route(
|
|||
let Some(pdu) =
|
||||
services().rooms.timeline.get_pdu(&event_id)?
|
||||
else {
|
||||
error!(%event_id, "Event in state not found");
|
||||
t::error!(
|
||||
%event_id,
|
||||
"Event in state not found"
|
||||
);
|
||||
continue;
|
||||
};
|
||||
if pdu.kind == TimelineEventType::RoomMember {
|
||||
|
|
@ -450,7 +453,7 @@ pub(crate) async fn sync_events_v4_route(
|
|||
.map_or(Ok::<_, Error>(None), |(pdu_count, _)| {
|
||||
Ok(Some(match pdu_count {
|
||||
PduCount::Backfilled(_) => {
|
||||
error!("Timeline in backfill state?!");
|
||||
t::error!("Timeline in backfill state?!");
|
||||
"0".to_owned()
|
||||
}
|
||||
PduCount::Normal(c) => c.to_string(),
|
||||
|
|
@ -602,7 +605,7 @@ pub(crate) async fn sync_events_v4_route(
|
|||
}
|
||||
match tokio::time::timeout(duration, watcher).await {
|
||||
Ok(x) => x.expect("watcher should succeed"),
|
||||
Err(error) => debug!(%error, "Timed out"),
|
||||
Err(error) => t::debug!(%error, "Timed out"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ use ruma::{
|
|||
},
|
||||
uint, DeviceId, EventId, OwnedRoomId, OwnedUserId, RoomId, UInt, UserId,
|
||||
};
|
||||
use tracing::{debug, error, field};
|
||||
|
||||
use super::{load_timeline, share_encrypted_room};
|
||||
use crate::{
|
||||
observability::prelude::*,
|
||||
service::{pdu::EventHash, rooms::timeline::PduCount},
|
||||
services, utils, Ar, Error, PduEvent, Ra, Result,
|
||||
};
|
||||
|
|
@ -85,7 +85,7 @@ struct SyncContext<'a> {
|
|||
/// - If the user left after `since`: `prev_batch` token, empty state (TODO:
|
||||
/// subset of the state at the point of the leave)
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[tracing::instrument(
|
||||
#[t::instrument(
|
||||
skip_all,
|
||||
fields(
|
||||
sender_user,
|
||||
|
|
@ -99,12 +99,12 @@ struct SyncContext<'a> {
|
|||
pub(crate) async fn sync_events_route(
|
||||
body: Ar<sync_events::v3::Request>,
|
||||
) -> Result<Ra<sync_events::v3::Response>, Ra<UiaaResponse>> {
|
||||
let current_span = tracing::Span::current();
|
||||
let current_span = t::Span::current();
|
||||
|
||||
let sender_user = body.sender_user.expect("user is authenticated");
|
||||
current_span.record("sender_user", field::display(&sender_user));
|
||||
current_span.record("sender_user", t::field::display(&sender_user));
|
||||
let sender_device = body.sender_device.expect("user is authenticated");
|
||||
current_span.record("sender_device", field::display(&sender_device));
|
||||
current_span.record("sender_device", t::field::display(&sender_device));
|
||||
let body = body.body;
|
||||
|
||||
// Setup watchers, so if there's no response, we can wait for them
|
||||
|
|
@ -279,13 +279,13 @@ pub(crate) async fn sync_events_route(
|
|||
}
|
||||
match tokio::time::timeout(duration, watcher).await {
|
||||
Ok(x) => x.expect("watcher should succeed"),
|
||||
Err(error) => debug!(%error, "Timed out"),
|
||||
Err(error) => t::debug!(%error, "Timed out"),
|
||||
};
|
||||
}
|
||||
Ok(Ra(response))
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[t::instrument(skip_all)]
|
||||
async fn collect_joined_rooms(
|
||||
ctx: &SyncContext<'_>,
|
||||
device_list_updates: &mut HashSet<OwnedUserId>,
|
||||
|
|
@ -316,7 +316,7 @@ async fn collect_joined_rooms(
|
|||
Ok(joined_rooms)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all, fields(room_id = %room_id))]
|
||||
#[t::instrument(skip_all, fields(room_id = %room_id))]
|
||||
#[allow(clippy::too_many_arguments, clippy::too_many_lines)]
|
||||
async fn load_joined_room(
|
||||
ctx: &SyncContext<'_>,
|
||||
|
|
@ -366,7 +366,7 @@ async fn load_joined_room(
|
|||
let Some(current_shortstatehash) =
|
||||
services().rooms.state.get_room_shortstatehash(room_id)?
|
||||
else {
|
||||
error!("Room has no state");
|
||||
t::error!("Room has no state");
|
||||
return Err(Error::BadDatabase("Room has no state"));
|
||||
};
|
||||
|
||||
|
|
@ -526,7 +526,7 @@ async fn load_joined_room(
|
|||
let Some(pdu) =
|
||||
services().rooms.timeline.get_pdu(&event_id)?
|
||||
else {
|
||||
error!(%event_id, "Event in state not found");
|
||||
t::error!(%event_id, "Event in state not found");
|
||||
continue;
|
||||
};
|
||||
state_events.push(pdu);
|
||||
|
|
@ -544,7 +544,7 @@ async fn load_joined_room(
|
|||
let Some(pdu) =
|
||||
services().rooms.timeline.get_pdu(&event_id)?
|
||||
else {
|
||||
error!(%event_id, "Event in state not found");
|
||||
t::error!(%event_id, "Event in state not found");
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
@ -615,7 +615,7 @@ async fn load_joined_room(
|
|||
let Some(pdu) =
|
||||
services().rooms.timeline.get_pdu(&event_id)?
|
||||
else {
|
||||
error!(%event_id, "Event in state not found");
|
||||
t::error!(%event_id, "Event in state not found");
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
@ -748,7 +748,7 @@ async fn load_joined_room(
|
|||
lazy_loaded.insert(state_key_userid);
|
||||
}
|
||||
Err(error) => {
|
||||
error!(
|
||||
t::error!(
|
||||
event_id = %pdu.event_id,
|
||||
%error,
|
||||
"Invalid state key for member event",
|
||||
|
|
@ -834,7 +834,7 @@ async fn load_joined_room(
|
|||
|(pdu_count, _)| {
|
||||
Ok(Some(match pdu_count {
|
||||
PduCount::Backfilled(_) => {
|
||||
error!("Timeline in backfill state?!");
|
||||
t::error!("Timeline in backfill state?!");
|
||||
"0".to_owned()
|
||||
}
|
||||
PduCount::Normal(c) => c.to_string(),
|
||||
|
|
@ -921,7 +921,7 @@ async fn load_joined_room(
|
|||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[t::instrument(skip_all)]
|
||||
async fn collect_left_rooms(
|
||||
ctx: &SyncContext<'_>,
|
||||
) -> Result<BTreeMap<OwnedRoomId, LeftRoom>> {
|
||||
|
|
@ -1017,7 +1017,7 @@ async fn collect_left_rooms(
|
|||
ctx.sender_user.as_str(),
|
||||
)?
|
||||
else {
|
||||
error!("Left room but no left state event");
|
||||
t::error!("Left room but no left state event");
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
@ -1026,7 +1026,7 @@ async fn collect_left_rooms(
|
|||
.state_accessor
|
||||
.pdu_shortstatehash(&left_event_id)?
|
||||
else {
|
||||
error!("Leave event has no state");
|
||||
t::error!("Leave event has no state");
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
@ -1059,7 +1059,7 @@ async fn collect_left_rooms(
|
|||
let Some(pdu) =
|
||||
services().rooms.timeline.get_pdu(&event_id)?
|
||||
else {
|
||||
error!(%event_id, "Event in state not found");
|
||||
t::error!(%event_id, "Event in state not found");
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
@ -1094,7 +1094,7 @@ async fn collect_left_rooms(
|
|||
Ok(left_rooms)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[t::instrument(skip_all)]
|
||||
async fn collect_invited_rooms(
|
||||
ctx: &SyncContext<'_>,
|
||||
) -> Result<BTreeMap<OwnedRoomId, InvitedRoom>> {
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@ use ruma::{
|
|||
OwnedServerName, OwnedUserId, UserId,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use tracing::{error, warn};
|
||||
|
||||
use super::{Ar, Ra};
|
||||
use crate::{service::appservice::RegistrationInfo, services, Error, Result};
|
||||
use crate::{
|
||||
observability::prelude::*, service::appservice::RegistrationInfo, services,
|
||||
Error, Result,
|
||||
};
|
||||
|
||||
enum Token {
|
||||
Appservice(Box<RegistrationInfo>),
|
||||
|
|
@ -82,7 +84,7 @@ async fn ar_from_request_inner(
|
|||
let query_params: QueryParams = match serde_html_form::from_str(query) {
|
||||
Ok(params) => params,
|
||||
Err(error) => {
|
||||
error!(%error, %query, "Failed to deserialize query parameters");
|
||||
t::error!(%error, %query, "Failed to deserialize query parameters");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Unknown,
|
||||
"Failed to read query parameters",
|
||||
|
|
@ -182,7 +184,10 @@ async fn ar_from_request_inner(
|
|||
.extract::<TypedHeader<Authorization<XMatrix>>>()
|
||||
.await
|
||||
.map_err(|error| {
|
||||
warn!(%error, "Missing or invalid Authorization header");
|
||||
t::warn!(
|
||||
%error,
|
||||
"Missing or invalid Authorization header"
|
||||
);
|
||||
|
||||
let msg = match error.reason() {
|
||||
TypedHeaderRejectionReason::Missing => {
|
||||
|
|
@ -199,7 +204,7 @@ async fn ar_from_request_inner(
|
|||
|
||||
if let Some(destination) = x_matrix.destination {
|
||||
if destination != services().globals.server_name() {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%destination,
|
||||
"Incorrect destination in X-Matrix header"
|
||||
);
|
||||
|
|
@ -278,7 +283,7 @@ async fn ar_from_request_inner(
|
|||
let keys = match keys_result {
|
||||
Ok(b) => b,
|
||||
Err(error) => {
|
||||
warn!(%error, "Failed to fetch signing keys");
|
||||
t::warn!(%error, "Failed to fetch signing keys");
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::forbidden(),
|
||||
"Failed to fetch signing keys.",
|
||||
|
|
@ -304,7 +309,7 @@ async fn ar_from_request_inner(
|
|||
{
|
||||
Ok(()) => (None, None, Some(x_matrix.origin), None),
|
||||
Err(error) => {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
origin = %x_matrix.origin,
|
||||
object = ?request_map,
|
||||
|
|
@ -312,7 +317,7 @@ async fn ar_from_request_inner(
|
|||
);
|
||||
|
||||
if parts.uri.to_string().contains('@') {
|
||||
warn!(
|
||||
t::warn!(
|
||||
"Request uri contained '@' character. Make \
|
||||
sure your reverse proxy gives Grapevine the \
|
||||
raw uri (apache: use nocanon)"
|
||||
|
|
@ -405,7 +410,7 @@ where
|
|||
{
|
||||
type Rejection = Error;
|
||||
|
||||
#[tracing::instrument("ar_from_request", skip_all)]
|
||||
#[t::instrument("ar_from_request", skip_all)]
|
||||
async fn from_request(
|
||||
req: axum::extract::Request,
|
||||
_state: &S,
|
||||
|
|
@ -415,7 +420,7 @@ where
|
|||
let body =
|
||||
T::try_from_http_request(pieces.http_request, &pieces.path_params)
|
||||
.map_err(|error| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
body = ?pieces.json_body,
|
||||
"Request body JSON structure is incorrect"
|
||||
|
|
|
|||
|
|
@ -63,12 +63,11 @@ use ruma::{
|
|||
};
|
||||
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::{debug, error, field, trace, trace_span, warn};
|
||||
|
||||
use super::appservice_server;
|
||||
use crate::{
|
||||
api::client_server::{self, claim_keys_helper, get_keys_helper},
|
||||
observability::{FoundIn, Lookup, METRICS},
|
||||
observability::{prelude::*, FoundIn, Lookup, METRICS},
|
||||
service::{
|
||||
globals::SigningKeys,
|
||||
pdu::{gen_event_id_canonical_json, PduBuilder},
|
||||
|
|
@ -147,7 +146,7 @@ pub(crate) enum AllowLoopbackRequests {
|
|||
No,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(request, log_error, allow_loopback), fields(url))]
|
||||
#[t::instrument(skip(request, log_error, allow_loopback), fields(url))]
|
||||
pub(crate) async fn send_request<T>(
|
||||
destination: &ServerName,
|
||||
request: T,
|
||||
|
|
@ -169,7 +168,7 @@ where
|
|||
));
|
||||
}
|
||||
|
||||
debug!("Preparing to send request");
|
||||
t::debug!("Preparing to send request");
|
||||
|
||||
let mut write_destination_to_cache = false;
|
||||
|
||||
|
|
@ -201,7 +200,7 @@ where
|
|||
&[MatrixVersion::V1_11],
|
||||
)
|
||||
.map_err(|error| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
actual_destination = actual_destination_str,
|
||||
"Failed to find destination",
|
||||
|
|
@ -273,8 +272,8 @@ where
|
|||
|
||||
// can be enabled selectively using `filter =
|
||||
// grapevine[outgoing_request_curl]=trace` in config
|
||||
trace_span!("outgoing_request_curl").in_scope(|| {
|
||||
trace!(
|
||||
t::trace_span!("outgoing_request_curl").in_scope(|| {
|
||||
t::trace!(
|
||||
cmd = utils::curlify(&http_request),
|
||||
"curl command line for outgoing request"
|
||||
);
|
||||
|
|
@ -282,21 +281,21 @@ where
|
|||
let reqwest_request = reqwest::Request::try_from(http_request)?;
|
||||
|
||||
let url = reqwest_request.url().clone();
|
||||
tracing::Span::current().record("url", field::display(url));
|
||||
t::Span::current().record("url", t::field::display(url));
|
||||
|
||||
debug!("Sending request");
|
||||
t::debug!("Sending request");
|
||||
let response =
|
||||
services().globals.federation_client().execute(reqwest_request).await;
|
||||
|
||||
let mut response = response.inspect_err(|error| {
|
||||
if log_error == LogRequestError::Yes {
|
||||
warn!(%error, "Could not send request");
|
||||
t::warn!(%error, "Could not send request");
|
||||
}
|
||||
})?;
|
||||
|
||||
// reqwest::Response -> http::Response conversion
|
||||
let status = response.status();
|
||||
debug!(status = u16::from(status), "Received response");
|
||||
t::debug!(status = u16::from(status), "Received response");
|
||||
let mut http_response_builder =
|
||||
http::Response::builder().status(status).version(response.version());
|
||||
mem::swap(
|
||||
|
|
@ -306,16 +305,16 @@ where
|
|||
.expect("http::response::Builder is usable"),
|
||||
);
|
||||
|
||||
debug!("Getting response bytes");
|
||||
t::debug!("Getting response bytes");
|
||||
// TODO: handle timeout
|
||||
let body = response.bytes().await.unwrap_or_else(|error| {
|
||||
warn!(%error, "Server error");
|
||||
t::warn!(%error, "Server error");
|
||||
Vec::new().into()
|
||||
});
|
||||
debug!("Got response bytes");
|
||||
t::debug!("Got response bytes");
|
||||
|
||||
if status != 200 {
|
||||
warn!(
|
||||
t::warn!(
|
||||
status = u16::from(status),
|
||||
response =
|
||||
dbg_truncate_str(String::from_utf8_lossy(&body).as_ref(), 100)
|
||||
|
|
@ -335,7 +334,7 @@ where
|
|||
));
|
||||
}
|
||||
|
||||
debug!("Parsing response bytes");
|
||||
t::debug!("Parsing response bytes");
|
||||
let response = T::IncomingResponse::try_from_http_response(http_response);
|
||||
if response.is_ok() && write_destination_to_cache {
|
||||
METRICS.record_lookup(Lookup::FederationDestination, FoundIn::Remote);
|
||||
|
|
@ -346,7 +345,7 @@ where
|
|||
}
|
||||
|
||||
response.map_err(|e| {
|
||||
warn!(error = %e, "Invalid 200 response");
|
||||
t::warn!(error = %e, "Invalid 200 response");
|
||||
Error::BadServerResponse("Server returned bad 200 response.")
|
||||
})
|
||||
}
|
||||
|
|
@ -374,29 +373,29 @@ fn add_port_to_hostname(destination_str: &str) -> FedDest {
|
|||
/// Numbers in comments below refer to bullet points in linked section of
|
||||
/// specification
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[tracing::instrument(ret(level = "debug"))]
|
||||
#[t::instrument(ret(level = "debug"))]
|
||||
async fn find_actual_destination(
|
||||
destination: &'_ ServerName,
|
||||
) -> (FedDest, FedDest) {
|
||||
debug!("Finding actual destination");
|
||||
t::debug!("Finding actual destination");
|
||||
let destination_str = destination.as_str().to_owned();
|
||||
let mut hostname = destination_str.clone();
|
||||
let actual_destination = match get_ip_with_port(&destination_str) {
|
||||
Some(host_port) => {
|
||||
debug!("1: IP literal with provided or default port");
|
||||
t::debug!("1: IP literal with provided or default port");
|
||||
host_port
|
||||
}
|
||||
None => {
|
||||
if let Some(pos) = destination_str.find(':') {
|
||||
debug!("2: Hostname with included port");
|
||||
t::debug!("2: Hostname with included port");
|
||||
let (host, port) = destination_str.split_at(pos);
|
||||
FedDest::Named(host.to_owned(), port.to_owned())
|
||||
} else {
|
||||
debug!(%destination, "Requesting well known");
|
||||
t::debug!(%destination, "Requesting well known");
|
||||
if let Some(delegated_hostname) =
|
||||
request_well_known(destination.as_str()).await
|
||||
{
|
||||
debug!("3: A .well-known file is available");
|
||||
t::debug!("3: A .well-known file is available");
|
||||
hostname = add_port_to_hostname(&delegated_hostname)
|
||||
.to_uri_string();
|
||||
if let Some(host_and_port) =
|
||||
|
|
@ -404,15 +403,19 @@ async fn find_actual_destination(
|
|||
{
|
||||
host_and_port
|
||||
} else if let Some(pos) = delegated_hostname.find(':') {
|
||||
debug!("3.2: Hostname with port in .well-known file");
|
||||
t::debug!(
|
||||
"3.2: Hostname with port in .well-known file"
|
||||
);
|
||||
let (host, port) = delegated_hostname.split_at(pos);
|
||||
FedDest::Named(host.to_owned(), port.to_owned())
|
||||
} else {
|
||||
debug!("Delegated hostname has no port in this branch");
|
||||
t::debug!(
|
||||
"Delegated hostname has no port in this branch"
|
||||
);
|
||||
if let Some(hostname_override) =
|
||||
query_srv_record(&delegated_hostname).await
|
||||
{
|
||||
debug!("3.3: SRV lookup successful");
|
||||
t::debug!("3.3: SRV lookup successful");
|
||||
let force_port = hostname_override.port();
|
||||
|
||||
if let Ok(override_ip) = services()
|
||||
|
|
@ -434,7 +437,7 @@ async fn find_actual_destination(
|
|||
),
|
||||
);
|
||||
} else {
|
||||
warn!(
|
||||
t::warn!(
|
||||
"Using SRV record, but could not resolve \
|
||||
to IP"
|
||||
);
|
||||
|
|
@ -449,7 +452,7 @@ async fn find_actual_destination(
|
|||
add_port_to_hostname(&delegated_hostname)
|
||||
}
|
||||
} else {
|
||||
debug!(
|
||||
t::debug!(
|
||||
"3.4: No SRV records, just use the hostname \
|
||||
from .well-known"
|
||||
);
|
||||
|
|
@ -457,11 +460,11 @@ async fn find_actual_destination(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
debug!("4: No .well-known or an error occured");
|
||||
t::debug!("4: No .well-known or an error occured");
|
||||
if let Some(hostname_override) =
|
||||
query_srv_record(&destination_str).await
|
||||
{
|
||||
debug!("4: SRV record found");
|
||||
t::debug!("4: SRV record found");
|
||||
let force_port = hostname_override.port();
|
||||
|
||||
if let Ok(override_ip) = services()
|
||||
|
|
@ -483,7 +486,7 @@ async fn find_actual_destination(
|
|||
),
|
||||
);
|
||||
} else {
|
||||
warn!(
|
||||
t::warn!(
|
||||
"Using SRV record, but could not resolve to IP"
|
||||
);
|
||||
}
|
||||
|
|
@ -494,14 +497,14 @@ async fn find_actual_destination(
|
|||
add_port_to_hostname(&hostname)
|
||||
}
|
||||
} else {
|
||||
debug!("5: No SRV record found");
|
||||
t::debug!("5: No SRV record found");
|
||||
add_port_to_hostname(&destination_str)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
debug!(?actual_destination, "Resolved actual destination");
|
||||
t::debug!(?actual_destination, "Resolved actual destination");
|
||||
|
||||
// Can't use get_ip_with_port here because we don't want to add a port
|
||||
// to an IP address if it wasn't specified
|
||||
|
|
@ -518,7 +521,7 @@ async fn find_actual_destination(
|
|||
(actual_destination, hostname)
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret(level = "debug"))]
|
||||
#[t::instrument(ret(level = "debug"))]
|
||||
async fn query_given_srv_record(record: &str) -> Option<FedDest> {
|
||||
services()
|
||||
.globals
|
||||
|
|
@ -540,7 +543,7 @@ async fn query_given_srv_record(record: &str) -> Option<FedDest> {
|
|||
.unwrap_or(None)
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret(level = "debug"))]
|
||||
#[t::instrument(ret(level = "debug"))]
|
||||
async fn query_srv_record(hostname: &'_ str) -> Option<FedDest> {
|
||||
let hostname = hostname.trim_end_matches('.');
|
||||
|
||||
|
|
@ -553,7 +556,7 @@ async fn query_srv_record(hostname: &'_ str) -> Option<FedDest> {
|
|||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret(level = "debug"))]
|
||||
#[t::instrument(ret(level = "debug"))]
|
||||
async fn request_well_known(destination: &str) -> Option<String> {
|
||||
let response = services()
|
||||
.globals
|
||||
|
|
@ -561,13 +564,13 @@ async fn request_well_known(destination: &str) -> Option<String> {
|
|||
.get(format!("https://{destination}/.well-known/matrix/server"))
|
||||
.send()
|
||||
.await;
|
||||
debug!("Got well known response");
|
||||
t::debug!("Got well known response");
|
||||
if let Err(error) = &response {
|
||||
debug!(%error, "Failed to request .well-known");
|
||||
t::debug!(%error, "Failed to request .well-known");
|
||||
return None;
|
||||
}
|
||||
let text = response.ok()?.text().await;
|
||||
debug!("Got well known response text");
|
||||
t::debug!("Got well known response text");
|
||||
let body: serde_json::Value = serde_json::from_str(&text.ok()?).ok()?;
|
||||
Some(body.get("m.server")?.as_str()?.to_owned())
|
||||
}
|
||||
|
|
@ -695,13 +698,13 @@ pub(crate) async fn get_public_rooms_route(
|
|||
}))
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(pdu))]
|
||||
#[t::instrument(skip(pdu))]
|
||||
pub(crate) fn parse_incoming_pdu(
|
||||
pdu: &RawJsonValue,
|
||||
) -> Result<(OwnedEventId, CanonicalJsonObject, OwnedRoomId)> {
|
||||
let value: CanonicalJsonObject =
|
||||
serde_json::from_str(pdu.get()).map_err(|error| {
|
||||
warn!(%error, object = ?pdu, "Error parsing incoming event");
|
||||
t::warn!(%error, object = ?pdu, "Error parsing incoming event");
|
||||
Error::BadServerResponse("Invalid PDU in server response")
|
||||
})?;
|
||||
|
||||
|
|
@ -747,7 +750,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
for pdu in &body.pdus {
|
||||
let value: CanonicalJsonObject = serde_json::from_str(pdu.get())
|
||||
.map_err(|error| {
|
||||
warn!(%error, object = ?pdu, "Error parsing incoming event");
|
||||
t::warn!(%error, object = ?pdu, "Error parsing incoming event");
|
||||
Error::BadServerResponse("Invalid PDU in server response")
|
||||
})?;
|
||||
let room_id: OwnedRoomId = value
|
||||
|
|
@ -764,7 +767,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
.get_create_content::<ExtractVersion>(&room_id)
|
||||
.is_err()
|
||||
{
|
||||
debug!(%room_id, "This server is not in the room");
|
||||
t::debug!(%room_id, "This server is not in the room");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -772,7 +775,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
let (event_id, value, room_id) = match r {
|
||||
Ok(t) => t,
|
||||
Err(error) => {
|
||||
warn!(%error, object = ?pdu, "Error parsing incoming event");
|
||||
t::warn!(%error, object = ?pdu, "Error parsing incoming event");
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
|
@ -803,7 +806,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
);
|
||||
drop(federation_token);
|
||||
|
||||
debug!(
|
||||
t::debug!(
|
||||
%event_id,
|
||||
elapsed = ?start_time.elapsed(),
|
||||
"Finished handling event",
|
||||
|
|
@ -813,7 +816,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
for pdu in &resolved_map {
|
||||
if let (event_id, Err(error)) = pdu {
|
||||
if matches!(error, Error::BadRequest(ErrorKind::NotFound, _)) {
|
||||
warn!(%error, %event_id, "Incoming PDU failed");
|
||||
t::warn!(%error, %event_id, "Incoming PDU failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -828,7 +831,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
for (room_id, room_updates) in receipt.receipts {
|
||||
for (user_id, user_updates) in room_updates.read {
|
||||
if user_id.server_name() != sender_servername {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%user_id,
|
||||
%sender_servername,
|
||||
"Got receipt EDU from incorrect homeserver, \
|
||||
|
|
@ -874,7 +877,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
)?;
|
||||
} else {
|
||||
// TODO fetch missing events
|
||||
debug!(
|
||||
t::debug!(
|
||||
?user_updates,
|
||||
"No known event ids in read receipt",
|
||||
);
|
||||
|
|
@ -884,7 +887,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
}
|
||||
Edu::Typing(typing) => {
|
||||
if typing.user_id.server_name() != sender_servername {
|
||||
warn!(
|
||||
t::warn!(
|
||||
user_id = %typing.user_id,
|
||||
%sender_servername,
|
||||
"Got typing EDU from incorrect homeserver, ignoring",
|
||||
|
|
@ -922,7 +925,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
..
|
||||
}) => {
|
||||
if user_id.server_name() != sender_servername {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%user_id,
|
||||
%sender_servername,
|
||||
"Got device list update EDU from incorrect homeserver, \
|
||||
|
|
@ -939,7 +942,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
messages,
|
||||
}) => {
|
||||
if sender.server_name() != sender_servername {
|
||||
warn!(
|
||||
t::warn!(
|
||||
user_id = %sender,
|
||||
%sender_servername,
|
||||
"Got direct-to-device EDU from incorrect homeserver, \
|
||||
|
|
@ -965,7 +968,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
&ev_type.to_string(),
|
||||
event.deserialize_as().map_err(
|
||||
|error| {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%error,
|
||||
object = ?event.json(),
|
||||
"To-Device event is invalid",
|
||||
|
|
@ -1018,7 +1021,7 @@ pub(crate) async fn send_transaction_message_route(
|
|||
self_signing_key,
|
||||
}) => {
|
||||
if user_id.server_name() != sender_servername {
|
||||
warn!(
|
||||
t::warn!(
|
||||
%user_id,
|
||||
%sender_servername,
|
||||
"Got signing key update from incorrect homeserver, \
|
||||
|
|
@ -1063,7 +1066,7 @@ pub(crate) async fn get_event_route(
|
|||
let event =
|
||||
services().rooms.timeline.get_pdu_json(&body.event_id)?.ok_or_else(
|
||||
|| {
|
||||
warn!(event_id = %body.event_id, "Event not found");
|
||||
t::warn!(event_id = %body.event_id, "Event not found");
|
||||
Error::BadRequest(ErrorKind::NotFound, "Event not found.")
|
||||
},
|
||||
)?;
|
||||
|
|
@ -1116,7 +1119,7 @@ pub(crate) async fn get_backfill_route(
|
|||
let sender_servername =
|
||||
body.sender_servername.as_ref().expect("server is authenticated");
|
||||
|
||||
debug!(server = %sender_servername, "Got backfill request");
|
||||
t::debug!(server = %sender_servername, "Got backfill request");
|
||||
|
||||
if !services()
|
||||
.rooms
|
||||
|
|
@ -1225,7 +1228,7 @@ pub(crate) async fn get_missing_events_route(
|
|||
})?;
|
||||
|
||||
if event_room_id != body.room_id {
|
||||
warn!(
|
||||
t::warn!(
|
||||
event_id = %queued_events[i],
|
||||
expected_room_id = %body.room_id,
|
||||
actual_room_id = %event_room_id,
|
||||
|
|
@ -1308,7 +1311,7 @@ pub(crate) async fn get_event_authorization_route(
|
|||
let event =
|
||||
services().rooms.timeline.get_pdu_json(&body.event_id)?.ok_or_else(
|
||||
|| {
|
||||
warn!(event_id = %body.event_id, "Event not found");
|
||||
t::warn!(event_id = %body.event_id, "Event not found");
|
||||
Error::BadRequest(ErrorKind::NotFound, "Event not found.")
|
||||
},
|
||||
)?;
|
||||
|
|
@ -1399,7 +1402,7 @@ pub(crate) async fn get_room_state_route(
|
|||
{
|
||||
Some(PduEvent::convert_to_outgoing_federation_event(json))
|
||||
} else {
|
||||
error!(%event_id, "Could not find event JSON for event");
|
||||
t::error!(%event_id, "Could not find event JSON for event");
|
||||
None
|
||||
}
|
||||
})
|
||||
|
|
@ -1504,7 +1507,7 @@ pub(crate) async fn create_join_event_template_route(
|
|||
.map(|join_rules_event| {
|
||||
serde_json::from_str(join_rules_event.content.get()).map_err(
|
||||
|error| {
|
||||
warn!(%error, "Invalid join rules event");
|
||||
t::warn!(%error, "Invalid join rules event");
|
||||
Error::bad_database("Invalid join rules event in db.")
|
||||
},
|
||||
)
|
||||
|
|
@ -1601,7 +1604,7 @@ async fn create_join_event(
|
|||
.map(|join_rules_event| {
|
||||
serde_json::from_str(join_rules_event.content.get()).map_err(
|
||||
|error| {
|
||||
warn!(%error, "Invalid join rules event");
|
||||
t::warn!(%error, "Invalid join rules event");
|
||||
Error::bad_database("Invalid join rules event in db.")
|
||||
},
|
||||
)
|
||||
|
|
@ -1864,7 +1867,7 @@ pub(crate) async fn create_invite_route(
|
|||
|
||||
let pdu: PduEvent =
|
||||
serde_json::from_value(event.into()).map_err(|error| {
|
||||
warn!(%error, "Invalid invite event");
|
||||
t::warn!(%error, "Invalid invite event");
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Invalid invite event.")
|
||||
})?;
|
||||
|
||||
|
|
@ -2099,7 +2102,7 @@ pub(crate) async fn media_download_route(
|
|||
|
||||
let content_disposition = content_disposition.and_then(|s| {
|
||||
s.parse().inspect_err(
|
||||
|error| warn!(%error, "Invalid Content-Disposition in database"),
|
||||
|error| t::warn!(%error, "Invalid Content-Disposition in database"),
|
||||
)
|
||||
.ok()
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue