forked from mirrors/relay
Add complete to signature thread duration
This commit is contained in:
parent
769f7451f9
commit
5de244b848
1 changed files with 2 additions and 4 deletions
|
@ -12,11 +12,9 @@ fn signature_thread(receiver: flume::Receiver<Box<dyn FnOnce() + Send>>, id: usi
|
||||||
while let Ok(f) = receiver.recv() {
|
while let Ok(f) = receiver.recv() {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
metrics::increment_counter!("relay.signature-thread.operation.start", "id" => id.to_string());
|
metrics::increment_counter!("relay.signature-thread.operation.start", "id" => id.to_string());
|
||||||
let res = std::panic::catch_unwind(AssertUnwindSafe(move || {
|
let res = std::panic::catch_unwind(AssertUnwindSafe(f));
|
||||||
(f)();
|
|
||||||
}));
|
|
||||||
metrics::increment_counter!("relay.signature-thread.operation.end", "complete" => res.is_ok().to_string(), "id" => id.to_string());
|
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 {
|
if let Err(e) = res {
|
||||||
tracing::warn!("Signature fn panicked: {e:?}");
|
tracing::warn!("Signature fn panicked: {e:?}");
|
||||||
|
|
Loading…
Reference in a new issue