From 9e122e75035eeae6a52e8f0c674c968629d412ca Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Mon, 28 Nov 2022 10:27:18 +1030 Subject: [PATCH] Log `Failed to fetch attestation` as error We only log it as error if the event timestamp is `10` minutes in the past to avoid false negative error reports when the oracle is slow to report the attestation. The `event_id` is added to the log statement for more context. --- crates/daemon/src/oracle.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/daemon/src/oracle.rs b/crates/daemon/src/oracle.rs index 798324f6c..cb6825d6e 100644 --- a/crates/daemon/src/oracle.rs +++ b/crates/daemon/src/oracle.rs @@ -262,8 +262,16 @@ impl Actor { Ok(()) }, - |e| async move { - tracing::debug!("Failed to fetch attestation: {:#}", e); + move |e| async move { + let now = OffsetDateTime::now_utc(); + + // If the event is more than 10 minutes in the past we expect an attestation to + // be available and log an error if we can't fetch it + if now > event_id.timestamp() + Duration::minutes(10) { + tracing::error!("Failed to fetch attestation for {event_id}: {e:#}"); + } else { + tracing::debug!("Failed to fetch attestation for {event_id}: {e:#}"); + } }, ) }