From 5de244b8481862028c882dd3b9b995f764e5cb9d Mon Sep 17 00:00:00 2001 From: asonix Date: Thu, 27 Jul 2023 10:39:24 -0500 Subject: [PATCH] Add complete to signature thread duration --- src/spawner.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/spawner.rs b/src/spawner.rs index a0aaa5c..5b765cb 100644 --- a/src/spawner.rs +++ b/src/spawner.rs @@ -12,11 +12,9 @@ fn signature_thread(receiver: flume::Receiver>, id: usi while let Ok(f) = receiver.recv() { let start = Instant::now(); metrics::increment_counter!("relay.signature-thread.operation.start", "id" => id.to_string()); - let res = std::panic::catch_unwind(AssertUnwindSafe(move || { - (f)(); - })); + let res = std::panic::catch_unwind(AssertUnwindSafe(f)); metrics::increment_counter!("relay.signature-thread.operation.end", "complete" => res.is_ok().to_string(), "id" => id.to_string()); - metrics::histogram!("relay.signature-thread.operation.duration", start.elapsed().as_secs_f64(), "id" => id.to_string()); + metrics::histogram!("relay.signature-thread.operation.duration", start.elapsed().as_secs_f64(), "complete" => res.is_ok().to_string(), "id" => id.to_string()); if let Err(e) = res { tracing::warn!("Signature fn panicked: {e:?}");