Additional span logging of counter state; trace logging of contents.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-07-29 22:42:10 +00:00
parent 59b62b1453
commit 1bb16c8b73
9 changed files with 101 additions and 19 deletions

View File

@@ -48,6 +48,7 @@ use crate::rooms::timeline::RawPduId;
level = INFO_SPAN_LEVEL,
skip_all,
fields(%room_id, %event_id),
ret(Debug),
)]
pub async fn handle_incoming_pdu<'a>(
&self,

View File

@@ -17,6 +17,7 @@ use crate::rooms::{
};
#[implement(super::Service)]
#[tracing::instrument(name = "upgrade", level = "debug", skip_all, ret(Debug))]
pub(super) async fn upgrade_outlier_to_timeline_pdu<Pdu>(
&self,
incoming_pdu: PduEvent,

View File

@@ -93,6 +93,15 @@ impl crate::Service for Service {
impl Service {
/// Set the room to the given statehash and update caches.
#[tracing::instrument(
name = "force",
level = "debug",
skip_all,
fields(
count = ?self.services.globals.pending_count(),
%shortstatehash,
)
)]
pub async fn force_state(
&self,
room_id: &RoomId,
@@ -172,7 +181,14 @@ impl Service {
///
/// This adds all current state events (not including the incoming event)
/// to `stateid_pduid` and adds the incoming event to `eventid_statehash`.
#[tracing::instrument(skip(self, state_ids_compressed), level = "debug")]
#[tracing::instrument(
name = "set",
level = "debug",
skip(self, state_ids_compressed),
fields(
count = ?self.services.globals.pending_count(),
)
)]
pub async fn set_event_state(
&self,
event_id: &EventId,
@@ -248,7 +264,14 @@ impl Service {
///
/// This adds all current state events (not including the incoming event)
/// to `stateid_pduid` and adds the incoming event to `eventid_statehash`.
#[tracing::instrument(skip(self, new_pdu), level = "debug")]
#[tracing::instrument(
name = "set",
level = "debug",
skip(self, new_pdu),
fields(
count = ?self.services.globals.pending_count(),
)
)]
pub async fn append_to_state(&self, new_pdu: &PduEvent) -> Result<u64> {
const BUFSIZE: usize = size_of::<u64>();
@@ -332,7 +355,7 @@ impl Service {
}
}
#[tracing::instrument(skip_all, level = "debug")]
#[tracing::instrument(skip_all, level = "trace")]
pub async fn summary_stripped<Pdu>(&self, event: &Pdu) -> Vec<Raw<AnyStrippedStateEvent>>
where
Pdu: Event,
@@ -380,7 +403,11 @@ impl Service {
}
/// Returns the room's version.
#[tracing::instrument(skip(self), level = "debug")]
#[tracing::instrument(
level = "trace"
skip(self),
ret,
)]
pub async fn get_room_version(&self, room_id: &RoomId) -> Result<RoomVersionId> {
self.services
.state_accessor
@@ -390,6 +417,11 @@ impl Service {
.map_err(|e| err!(Request(NotFound("No create event found: {e:?}"))))
}
#[tracing::instrument(
level = "trace"
skip(self),
ret,
)]
pub async fn get_room_shortstatehash(&self, room_id: &RoomId) -> Result<ShortStateHash> {
self.db
.roomid_shortstatehash
@@ -411,6 +443,11 @@ impl Service {
.ignore_err()
}
#[tracing::instrument(
level = "debug"
skip_all,
fields(%room_id),
)]
pub async fn set_forward_extremities<'a, I>(
&'a self,
room_id: &'a RoomId,
@@ -434,7 +471,7 @@ impl Service {
}
/// This fetches auth events from the current state.
#[tracing::instrument(skip(self, content), level = "debug")]
#[tracing::instrument(skip(self, content), level = "trace")]
pub async fn get_auth_events(
&self,
room_id: &RoomId,

View File

@@ -33,7 +33,12 @@ use crate::{appservice::NamespaceRegex, rooms::state_compressor::CompressedState
/// Append the incoming event setting the state snapshot to the state from
/// the server that sent the event.
#[implement(super::Service)]
#[tracing::instrument(level = "debug", skip_all)]
#[tracing::instrument(
name = "append_incoming",
level = "debug",
skip_all,
ret(Debug)
)]
pub async fn append_incoming_pdu<'a, Leafs>(
&'a self,
pdu: &'a PduEvent,
@@ -81,7 +86,7 @@ where
///
/// Returns pdu id
#[implement(super::Service)]
#[tracing::instrument(level = "debug", skip_all)]
#[tracing::instrument(name = "append", level = "debug", skip_all, ret(Debug))]
pub async fn append_pdu<'a, Leafs>(
&'a self,
pdu: &'a PduEvent,

View File

@@ -23,7 +23,7 @@ use super::RoomMutexGuard;
/// takes a roomid_mutex_state, meaning that only this function is able to
/// mutate the room state.
#[implement(super::Service)]
#[tracing::instrument(skip(self, state_lock), level = "debug")]
#[tracing::instrument(skip(self, state_lock), level = "debug", ret)]
pub async fn build_and_append_pdu(
&self,
pdu_builder: PduBuilder,