Additional missing tracing spans on state_res::resolve components.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2026-01-25 23:51:00 +00:00
parent 23a3e87e93
commit daa869fced
7 changed files with 35 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ use crate::utils::stream::{IterStream, ReadyExt};
/// ## Returns
///
/// Outputs the event IDs that are not present in all the auth chains.
#[tracing::instrument(level = "debug", skip_all)]
pub(super) fn auth_difference<'a, AuthSets, Id>(auth_sets: AuthSets) -> impl Stream<Item = Id>
where
AuthSets: Stream<Item = AuthSet<Id>>,

View File

@@ -25,6 +25,7 @@ struct Local {
stack: Vec<Vec<OwnedEventId>>,
}
#[tracing::instrument(name = "conflicted_subgraph", level = "debug", skip_all)]
pub(super) fn conflicted_subgraph_dfs<ConflictedEventIds, Fetch, Fut, Pdu>(
conflicted_event_ids: ConflictedEventIds,
fetch: &Fetch,
@@ -65,6 +66,15 @@ where
.flatten_stream()
}
#[tracing::instrument(
name = "descent",
level = "trace",
skip_all,
fields(
event_id = %conflicted_event_id,
event_ids = conflicted_event_ids.len(),
)
)]
async fn subgraph_descent<Fetch, Fut, Pdu>(
state: Arc<Global>,
conflicted_event_id: OwnedEventId,

View File

@@ -79,11 +79,11 @@ where
#[tracing::instrument(
name = "check",
level = "debug",
level = "trace",
skip_all,
fields(
%event_id,
%state_key,
?state_key,
)
)]
async fn auth_check<Fetch, Fut, Pdu>(

View File

@@ -98,6 +98,7 @@ where
/// Add the event with the given event ID and all the events in its auth chain
/// that are in the full conflicted set to the graph.
#[tracing::instrument(
name = "auth_chain",
level = "trace",
skip_all,
fields(
@@ -182,6 +183,7 @@ where
/// Returns the power level of the sender of the event or an `Err(_)` if one of
/// the auth events if malformed.
#[tracing::instrument(
name = "sender_power",
level = "trace",
skip_all,
fields(

View File

@@ -25,6 +25,7 @@ use crate::validated;
/// ## Returns
///
/// Returns an `(unconflicted_state, conflicted_states)` tuple.
#[tracing::instrument(name = "split", level = "debug", skip_all)]
pub(super) async fn split_conflicted_state<'a, Maps, Id>(
state_maps: Maps,
) -> (StateMap<Id>, StateMap<Vec<Id>>)

View File

@@ -13,7 +13,14 @@ use tuwunel_core::{
use crate::rooms::state_compressor::CompressedState;
#[implement(super::Service)]
#[tracing::instrument(name = "resolve", level = "debug", skip_all)]
#[tracing::instrument(
name = "state",
level = "debug",
skip_all,
fields(
incoming = ?incoming_state.len()
),
)]
pub async fn resolve_state(
&self,
room_id: &RoomId,
@@ -64,7 +71,7 @@ pub async fn resolve_state(
trace!("Resolving state");
let state = self
.state_resolution(room_version, fork_states, auth_chain_sets)
.state_resolution(room_id, room_version, fork_states, auth_chain_sets)
.await?;
trace!("State resolution done.");
@@ -96,8 +103,15 @@ pub async fn resolve_state(
}
#[implement(super::Service)]
#[tracing::instrument(
name = "resolve",
level = "debug",
skip_all,
fields(%room_id),
)]
pub(super) async fn state_resolution<StateSets, AuthSets>(
&self,
room_id: &RoomId,
room_version: &RoomVersionId,
state_sets: StateSets,
auth_chains: AuthSets,

View File

@@ -17,7 +17,7 @@ use crate::rooms::short::ShortStateHash;
// TODO: if we know the prev_events of the incoming event we can avoid the
#[implement(super::Service)]
// request and build the state from a known point and resolve if > 1 prev_event
#[tracing::instrument(name = "state", level = "debug", skip_all)]
#[tracing::instrument(name = "state1", level = "debug", skip_all)]
pub(super) async fn state_at_incoming_degree_one<Pdu>(
&self,
incoming_pdu: &Pdu,
@@ -96,7 +96,7 @@ where
}
#[implement(super::Service)]
#[tracing::instrument(name = "state", level = "debug", skip_all)]
#[tracing::instrument(name = "stateN", level = "debug", skip_all)]
pub(super) async fn state_at_incoming_resolved<Pdu>(
&self,
incoming_pdu: &Pdu,
@@ -149,7 +149,7 @@ where
trace!("Resolving state");
let Ok(new_state) = self
.state_resolution(room_version, fork_states, auth_chain_sets)
.state_resolution(room_id, room_version, fork_states, auth_chain_sets)
.inspect_ok(|_| trace!("State resolution done."))
.await
else {