tracing instruments for ruma state res
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
d92e8e170f
commit
5f11d68616
2 changed files with 9 additions and 7 deletions
|
@ -25,7 +25,6 @@ impl Service {
|
||||||
self.db.cache_auth_chain(key, auth_chain)
|
self.db.cache_auth_chain(key, auth_chain)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self, starting_events))]
|
|
||||||
pub async fn get_auth_chain<'a>(
|
pub async fn get_auth_chain<'a>(
|
||||||
&self, room_id: &RoomId, starting_events: Vec<Arc<EventId>>,
|
&self, room_id: &RoomId, starting_events: Vec<Arc<EventId>>,
|
||||||
) -> Result<impl Iterator<Item = Arc<EventId>> + 'a> {
|
) -> Result<impl Iterator<Item = Arc<EventId>> + 'a> {
|
||||||
|
|
|
@ -78,6 +78,7 @@ impl Service {
|
||||||
/// room, if not soft fail it
|
/// room, if not soft fail it
|
||||||
// We use some AsyncRecursiveType hacks here so we can call this async funtion
|
// We use some AsyncRecursiveType hacks here so we can call this async funtion
|
||||||
// recursively
|
// recursively
|
||||||
|
#[tracing::instrument(skip(self, origin, value, is_timeline_event, pub_key_map), name = "pdu")]
|
||||||
pub(crate) async fn handle_incoming_pdu<'a>(
|
pub(crate) async fn handle_incoming_pdu<'a>(
|
||||||
&self, origin: &'a ServerName, event_id: &'a EventId, room_id: &'a RoomId,
|
&self, origin: &'a ServerName, event_id: &'a EventId, room_id: &'a RoomId,
|
||||||
value: BTreeMap<String, CanonicalJsonValue>, is_timeline_event: bool,
|
value: BTreeMap<String, CanonicalJsonValue>, is_timeline_event: bool,
|
||||||
|
@ -453,7 +454,8 @@ impl Service {
|
||||||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Event has been soft failed"));
|
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Event has been soft failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Upgrading {} to timeline pdu", incoming_pdu.event_id);
|
debug!("Upgrading {} to timeline pdu", incoming_pdu.event_id);
|
||||||
|
let timer = tokio::time::Instant::now();
|
||||||
|
|
||||||
let create_event_content: RoomCreateEventContent =
|
let create_event_content: RoomCreateEventContent =
|
||||||
serde_json::from_str(create_event.content.get()).map_err(|e| {
|
serde_json::from_str(create_event.content.get()).map_err(|e| {
|
||||||
|
@ -872,7 +874,11 @@ impl Service {
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
debug!("Appended incoming pdu");
|
let elapsed = timer.elapsed();
|
||||||
|
debug!(
|
||||||
|
elapsed = ?elapsed,
|
||||||
|
"Appended incoming pdu",
|
||||||
|
);
|
||||||
|
|
||||||
// Event has passed all auth/stateres checks
|
// Event has passed all auth/stateres checks
|
||||||
drop(state_lock);
|
drop(state_lock);
|
||||||
|
@ -978,7 +984,6 @@ impl Service {
|
||||||
/// b. Look at outlier pdu tree
|
/// b. Look at outlier pdu tree
|
||||||
/// c. Ask origin server over federation
|
/// c. Ask origin server over federation
|
||||||
/// d. TODO: Ask other servers over federation?
|
/// d. TODO: Ask other servers over federation?
|
||||||
#[tracing::instrument(skip_all)]
|
|
||||||
pub(crate) fn fetch_and_handle_outliers<'a>(
|
pub(crate) fn fetch_and_handle_outliers<'a>(
|
||||||
&'a self, origin: &'a ServerName, events: &'a [Arc<EventId>], create_event: &'a PduEvent, room_id: &'a RoomId,
|
&'a self, origin: &'a ServerName, events: &'a [Arc<EventId>], create_event: &'a PduEvent, room_id: &'a RoomId,
|
||||||
room_version_id: &'a RoomVersionId, pub_key_map: &'a RwLock<BTreeMap<String, BTreeMap<String, Base64>>>,
|
room_version_id: &'a RoomVersionId, pub_key_map: &'a RwLock<BTreeMap<String, BTreeMap<String, Base64>>>,
|
||||||
|
@ -1105,7 +1110,6 @@ impl Service {
|
||||||
|
|
||||||
// We go through all the signatures we see on the PDUs and their unresolved
|
// We go through all the signatures we see on the PDUs and their unresolved
|
||||||
// dependencies and fetch the corresponding signing keys
|
// dependencies and fetch the corresponding signing keys
|
||||||
info!("fetch_required_signing_keys for {}", origin);
|
|
||||||
self.fetch_required_signing_keys(
|
self.fetch_required_signing_keys(
|
||||||
events_with_auth_events
|
events_with_auth_events
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -1265,7 +1269,6 @@ impl Service {
|
||||||
Ok((sorted, eventid_info))
|
Ok((sorted, eventid_info))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip_all)]
|
|
||||||
pub(crate) async fn fetch_required_signing_keys<'a, E>(
|
pub(crate) async fn fetch_required_signing_keys<'a, E>(
|
||||||
&'a self, events: E, pub_key_map: &RwLock<BTreeMap<String, BTreeMap<String, Base64>>>,
|
&'a self, events: E, pub_key_map: &RwLock<BTreeMap<String, BTreeMap<String, Base64>>>,
|
||||||
) -> Result<()>
|
) -> Result<()>
|
||||||
|
@ -1301,7 +1304,7 @@ impl Service {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
info!(
|
debug!(
|
||||||
"Fetch keys for {}",
|
"Fetch keys for {}",
|
||||||
server_key_ids
|
server_key_ids
|
||||||
.keys()
|
.keys()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue