From 1a835863d4b6dbfe72819e008f556ed7bdbdd46f Mon Sep 17 00:00:00 2001 From: asonix Date: Tue, 13 Dec 2022 23:06:29 -0600 Subject: [PATCH] core: Improve tracing --- jobs-core/src/processor_map.rs | 2 +- jobs-core/src/storage.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/jobs-core/src/processor_map.rs b/jobs-core/src/processor_map.rs index 432844a..55caa4d 100644 --- a/jobs-core/src/processor_map.rs +++ b/jobs-core/src/processor_map.rs @@ -192,7 +192,7 @@ where span.record("exception.message", &tracing::field::display(&display)); span.record("exception.details", &tracing::field::display(&debug)); #[cfg(feature = "error-logging")] - tracing::warn!("Job errored: {:?}", e); + tracing::warn!("Job errored"); ReturnJobInfo::fail(id) } Err(_) => { diff --git a/jobs-core/src/storage.rs b/jobs-core/src/storage.rs index f2c8c73..c42bb40 100644 --- a/jobs-core/src/storage.rs +++ b/jobs-core/src/storage.rs @@ -200,6 +200,7 @@ pub mod memory_storage { self.inner.lock().unwrap().jobs.get(id).cloned() } + #[tracing::instrument(skip(self))] fn try_deque(&self, queue: &str, now: SystemTime) -> Option { let mut inner = self.inner.lock().unwrap(); @@ -223,6 +224,7 @@ pub mod memory_storage { None } + #[tracing::instrument(skip(self))] fn listener(&self, queue: &str, now: SystemTime) -> (Duration, EventListener) { let mut inner = self.inner.lock().unwrap(); @@ -321,6 +323,7 @@ pub mod memory_storage { if duration > Duration::from_secs(0) { let _ = self.timer.timeout(duration, listener).await; } + tracing::debug!("Finished waiting, trying dequeue"); } }