From c71b59b248d5d6aa2cf8ad89b2c23699073eabc0 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 18 May 2023 12:24:07 -0700 Subject: [PATCH 1/3] Log how long it takes to handle each RPC message --- crates/collab/src/rpc.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 001f3462d0bc76be01fa5314ca9d5e0448334196..ac86f8c17186bcdaa6295b4f19edde8e2b66b704 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -51,7 +51,7 @@ use std::{ atomic::{AtomicBool, Ordering::SeqCst}, Arc, }, - time::Duration, + time::{Duration, Instant}, }; use tokio::sync::{watch, Semaphore}; use tower::ServiceBuilder; @@ -397,10 +397,16 @@ impl Server { "message received" ); }); + let start_time = Instant::now(); let future = (handler)(*envelope, session); async move { - if let Err(error) = future.await { - tracing::error!(%error, "error handling message"); + let result = future.await; + let duration_ms = start_time.elapsed().as_micros() as f64 / 1000.0; + match result { + Err(error) => { + tracing::error!(%error, ?duration_ms, "error handling message") + } + Ok(()) => tracing::info!(?duration_ms, "finished handling message"), } } .instrument(span) From 55b241a4f6b42704fa1b3387b7fc8a242159627d Mon Sep 17 00:00:00 2001 From: Joseph Lyons Date: Wed, 17 May 2023 13:36:43 -0400 Subject: [PATCH 2/3] collab 0.12.2 --- Cargo.lock | 2 +- crates/collab/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce727a9c6c4af9aa1a5ecdb4c063d5144510f7aa..326c9f3e8186c15968cbc546c57e5e2ca208f180 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1230,7 +1230,7 @@ dependencies = [ [[package]] name = "collab" -version = "0.12.1" +version = "0.12.2" dependencies = [ "anyhow", "async-tungstenite", diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml index ba49373641fb8a9056a43316c19e6548f6aa8798..542a6e97bf07b1e65c263cbe36114bbdcb50ad48 100644 --- a/crates/collab/Cargo.toml +++ b/crates/collab/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] default-run = "collab" edition = "2021" name = "collab" -version = "0.12.1" +version = "0.12.2" publish = false [[bin]] From 2a11a898275ca0143514eddc331fb32cfe6a1cf9 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 18 May 2023 12:27:08 -0700 Subject: [PATCH 3/3] collab 0.12.3 --- Cargo.lock | 2 +- crates/collab/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 326c9f3e8186c15968cbc546c57e5e2ca208f180..7bd4e30021cbdc9859aa441b44304a6a16bbf5e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1230,7 +1230,7 @@ dependencies = [ [[package]] name = "collab" -version = "0.12.2" +version = "0.12.3" dependencies = [ "anyhow", "async-tungstenite", diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml index 542a6e97bf07b1e65c263cbe36114bbdcb50ad48..4544d411d09bb141027ea0ad150d842ddcc78780 100644 --- a/crates/collab/Cargo.toml +++ b/crates/collab/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Nathan Sobo "] default-run = "collab" edition = "2021" name = "collab" -version = "0.12.2" +version = "0.12.3" publish = false [[bin]]