additional info level span adjustments

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-01-26 04:46:10 +00:00
parent af399fd517
commit 329925c661
7 changed files with 24 additions and 13 deletions

View file

@ -13,7 +13,7 @@ use crate::{Error, Result, Ruma};
/// # `POST /_matrix/federation/v1/publicRooms`
///
/// Lists the public rooms on this server.
#[tracing::instrument(skip_all, fields(%client), name = "publicrooms")]
#[tracing::instrument(name = "publicrooms", level = "debug", skip_all, fields(%client))]
pub(crate) async fn get_public_rooms_filtered_route(
State(services): State<crate::State>,
InsecureClientIp(client): InsecureClientIp,
@ -51,7 +51,7 @@ pub(crate) async fn get_public_rooms_filtered_route(
/// # `GET /_matrix/federation/v1/publicRooms`
///
/// Lists the public rooms on this server.
#[tracing::instrument(skip_all, fields(%client), "publicrooms")]
#[tracing::instrument(name = "publicrooms", level = "debug", skip_all, fields(%client))]
pub(crate) async fn get_public_rooms_route(
State(services): State<crate::State>,
InsecureClientIp(client): InsecureClientIp,

View file

@ -3,7 +3,9 @@ use std::{collections::BTreeMap, net::IpAddr, time::Instant};
use axum::extract::State;
use axum_client_ip::InsecureClientIp;
use conduwuit::{
debug, debug_warn, err, error,
debug,
debug::INFO_SPAN_LEVEL,
debug_warn, err, error,
result::LogErr,
trace,
utils::{
@ -49,8 +51,8 @@ type Pdu = (OwnedRoomId, OwnedEventId, CanonicalJsonObject);
///
/// Push EDUs and PDUs to this server.
#[tracing::instrument(
name = "send",
level = "debug",
name = "txn",
level = INFO_SPAN_LEVEL,
skip_all,
fields(
%client,

View file

@ -4,6 +4,7 @@ use std::{any::Any, panic};
// Export debug proc_macros
pub use conduwuit_macros::recursion_depth;
use tracing::Level;
// Export all of the ancillary tools from here as well.
pub use crate::{result::DebugInspect, utils::debug::*};
@ -51,6 +52,12 @@ macro_rules! debug_info {
}
}
pub const INFO_SPAN_LEVEL: Level = if cfg!(debug_assertions) {
Level::INFO
} else {
Level::DEBUG
};
pub fn set_panic_trap() {
let next = panic::take_hook();
panic::set_hook(Box::new(move |info| {

View file

@ -2,8 +2,8 @@ use std::{fmt::Debug, mem};
use bytes::Bytes;
use conduwuit::{
debug, debug_error, debug_warn, err, error::inspect_debug_log, implement, trace,
utils::string::EMPTY, Err, Error, Result,
debug, debug::INFO_SPAN_LEVEL, debug_error, debug_warn, err, error::inspect_debug_log,
implement, trace, utils::string::EMPTY, Err, Error, Result,
};
use http::{header::AUTHORIZATION, HeaderValue};
use ipaddress::IPAddress;
@ -48,7 +48,8 @@ where
#[implement(super::Service)]
#[tracing::instrument(
level = "debug"
name = "fed",
level = INFO_SPAN_LEVEL,
skip(self, client, request),
)]
pub async fn execute_on<T>(

View file

@ -3,7 +3,7 @@ use std::{
time::Instant,
};
use conduwuit::{debug, err, implement, warn, Err, Result};
use conduwuit::{debug, debug::INFO_SPAN_LEVEL, err, implement, warn, Err, Result};
use futures::{
future::{try_join5, OptionFuture},
FutureExt,
@ -42,7 +42,7 @@ use crate::rooms::timeline::RawPduId;
#[implement(super::Service)]
#[tracing::instrument(
name = "pdu",
level = "debug",
level = INFO_SPAN_LEVEL,
skip_all,
fields(%room_id, %event_id),
)]

View file

@ -5,7 +5,8 @@ use std::{
};
use conduwuit::{
debug, implement, utils::continue_exponential_backoff_secs, Err, PduEvent, Result,
debug, debug::INFO_SPAN_LEVEL, implement, utils::continue_exponential_backoff_secs, Err,
PduEvent, Result,
};
use ruma::{CanonicalJsonValue, EventId, OwnedEventId, RoomId, ServerName, UInt};
@ -14,7 +15,7 @@ use ruma::{CanonicalJsonValue, EventId, OwnedEventId, RoomId, ServerName, UInt};
#[allow(clippy::too_many_arguments)]
#[tracing::instrument(
name = "prev",
level = "debug",
level = INFO_SPAN_LEVEL,
skip_all,
fields(%prev_id),
)]

View file

@ -268,7 +268,7 @@ impl Service {
}
/// Gets the summary of a space using solely federation
#[tracing::instrument(skip(self))]
#[tracing::instrument(level = "debug", skip(self))]
async fn get_summary_and_children_federation(
&self,
current_room: &OwnedRoomId,