mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-10 20:22:49 +02:00
pass and use transaction id to collect timing info
This commit is contained in:
parent
60b8c9f5f2
commit
9f08594136
1 changed files with 17 additions and 7 deletions
|
@ -79,10 +79,11 @@ pub(crate) async fn send_transaction_message_route(
|
|||
}
|
||||
|
||||
let txn_start_time = Instant::now();
|
||||
let transaction_id = body.transaction_id.to_string();
|
||||
trace!(
|
||||
pdus = body.pdus.len(),
|
||||
edus = body.edus.len(),
|
||||
id = ?body.transaction_id,
|
||||
id = transaction_id,
|
||||
"Processing transaction",
|
||||
);
|
||||
|
||||
|
@ -106,17 +107,17 @@ pub(crate) async fn send_transaction_message_route(
|
|||
pdus = body.pdus.len(),
|
||||
edus = body.edus.len(),
|
||||
elapsed = ?txn_start_time.elapsed(),
|
||||
id = ?body.transaction_id,
|
||||
id = transaction_id,
|
||||
"Validated transaction",
|
||||
);
|
||||
|
||||
let results = handle(&services, &client, body.origin(), txn_start_time, pdus, edus).await?;
|
||||
let results = handle(&services, &client, body.origin(), txn_start_time, pdus, edus, &*transaction_id).await?;
|
||||
|
||||
info!(
|
||||
pdus = body.pdus.len(),
|
||||
edus = body.edus.len(),
|
||||
elapsed = ?txn_start_time.elapsed(),
|
||||
id = ?body.transaction_id,
|
||||
id = transaction_id,
|
||||
"Finished txn",
|
||||
);
|
||||
for (id, result) in &results {
|
||||
|
@ -142,11 +143,13 @@ async fn handle(
|
|||
started: Instant,
|
||||
pdus: impl Stream<Item = Pdu> + Send,
|
||||
edus: impl Stream<Item = Edu> + Send,
|
||||
transaction_id: &str,
|
||||
) -> Result<ResolvedMap> {
|
||||
let handle_start = Instant::now();
|
||||
edus.for_each_concurrent(automatic_width(), |edu| handle_edu(services, client, origin, edu))
|
||||
.boxed()
|
||||
.await;
|
||||
|
||||
let pdu_start = Instant::now();
|
||||
// group pdus by room
|
||||
let pdus = pdus
|
||||
.collect()
|
||||
|
@ -157,7 +160,7 @@ async fn handle(
|
|||
.collect()
|
||||
})
|
||||
.await;
|
||||
|
||||
let results_start = Instant::now();
|
||||
// we can evaluate rooms concurrently
|
||||
let results: ResolvedMap = pdus
|
||||
.into_iter()
|
||||
|
@ -172,7 +175,14 @@ async fn handle(
|
|||
.try_collect()
|
||||
.boxed()
|
||||
.await?;
|
||||
|
||||
let handle_stop = Instant::now();
|
||||
info!(
|
||||
edus = pdu_start.saturating_duration_since(handle_start).as_micros(),
|
||||
pdus = results_start.saturating_duration_since(pdu_start).as_micros(),
|
||||
handle_room = handle_stop.saturating_duration_since(results_start).as_micros(),
|
||||
id = ?transaction_id,
|
||||
"handled incoming transaction",
|
||||
);
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue