From 2b6348781ae660f765c2ac0742fdeffb547e79b2 Mon Sep 17 00:00:00 2001 From: Atanas Minkov Date: Thu, 2 Mar 2023 05:26:14 +0000 Subject: [PATCH] Log a debug message when a request fails for a beacon node candidate (#4036) ## Issue Addressed #3985 ## Proposed Changes Log a debug message when a BN candidate returns an error. `Mar 01 16:40:24.011 DEBG Request to beacon node failed error: ServerMessage(ErrorMessage { code: 503, message: "SERVICE_UNAVAILABLE: beacon node is syncing: head slot is 8416, current slot is 5098402", stacktraces: [] }), node: http://localhost:5052/` --- validator_client/src/beacon_node_fallback.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/validator_client/src/beacon_node_fallback.rs b/validator_client/src/beacon_node_fallback.rs index 82f085c43fb..06ddcbaf3b4 100644 --- a/validator_client/src/beacon_node_fallback.rs +++ b/validator_client/src/beacon_node_fallback.rs @@ -7,7 +7,7 @@ use crate::http_metrics::metrics::{inc_counter_vec, ENDPOINT_ERRORS, ENDPOINT_RE use environment::RuntimeContext; use eth2::BeaconNodeHttpClient; use futures::future; -use slog::{error, info, warn, Logger}; +use slog::{debug, error, info, warn, Logger}; use slot_clock::SlotClock; use std::fmt; use std::fmt::Debug; @@ -409,10 +409,12 @@ impl BeaconNodeFallback { where F: Fn(&'a BeaconNodeHttpClient) -> R, R: Future>, + Err: Debug, { let mut errors = vec![]; let mut to_retry = vec![]; let mut retry_unsynced = vec![]; + let log = &self.log.clone(); // Run `func` using a `candidate`, returning the value or capturing errors. // @@ -427,6 +429,12 @@ impl BeaconNodeFallback { match func(&$candidate.beacon_node).await { Ok(val) => return Ok(val), Err(e) => { + debug!( + log, + "Request to beacon node failed"; + "node" => $candidate.beacon_node.to_string(), + "error" => ?e, + ); // If we have an error on this function, make the client as not-ready. // // There exists a race condition where the candidate may have been marked @@ -626,6 +634,7 @@ impl BeaconNodeFallback { where F: Fn(&'a BeaconNodeHttpClient) -> R, R: Future>, + Err: Debug, { if self.disable_run_on_all { self.first_success(require_synced, offline_on_failure, func)