Skip to content

Commit df358b8

Browse files
committed
Add metrics for EE PayloadStatus returns (#3486)
## Issue Addressed NA ## Proposed Changes Adds some metrics so we can track payload status responses from the EE. I think this will be useful for troubleshooting and alerting. I also bumped the `BecaonChain::per_slot_task` to `debug` since it doesn't seem too noisy and would have helped us with some things we were debugging in the past. ## Additional Info NA
1 parent 043fa21 commit df358b8

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4274,8 +4274,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
42744274
/// it contains a call to `fork_choice` which may eventually call
42754275
/// `tokio::runtime::block_on` in certain cases.
42764276
pub async fn per_slot_task(self: &Arc<Self>) {
4277-
trace!(self.log, "Running beacon chain per slot tasks");
42784277
if let Some(slot) = self.slot_clock.now() {
4278+
debug!(
4279+
self.log,
4280+
"Running beacon chain per slot tasks";
4281+
"slot" => ?slot
4282+
);
4283+
42794284
// Always run the light-weight pruning tasks (these structures should be empty during
42804285
// sync anyway).
42814286
self.naive_aggregation_pool.write().prune(slot);

beacon_node/execution_layer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ fork_choice = { path = "../../consensus/fork_choice" }
4343
mev-build-rs = {git = "https://github.com/ralexstokes/mev-rs", tag = "v0.2.0"}
4444
ethereum-consensus = {git = "https://github.com/ralexstokes/ethereum-consensus"}
4545
ssz-rs = {git = "https://github.com/ralexstokes/ssz-rs"}
46-
46+
strum = "0.24.0"

beacon_node/execution_layer/src/engine_api.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use http::deposit_methods::RpcError;
44
pub use json_structures::TransitionConfigurationV1;
55
use reqwest::StatusCode;
66
use serde::{Deserialize, Serialize};
7+
use strum::IntoStaticStr;
78
pub use types::{
89
Address, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader, FixedVector,
910
Hash256, Uint256, VariableList,
@@ -71,7 +72,8 @@ impl From<builder_client::Error> for Error {
7172
}
7273
}
7374

74-
#[derive(Clone, Copy, Debug, PartialEq)]
75+
#[derive(Clone, Copy, Debug, PartialEq, IntoStaticStr)]
76+
#[strum(serialize_all = "snake_case")]
7577
pub enum PayloadStatusV1Status {
7678
Valid,
7779
Invalid,

beacon_node/execution_layer/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,13 @@ impl<T: EthSpec> ExecutionLayer<T> {
893893
.request(|engine| engine.api.new_payload_v1(execution_payload.clone()))
894894
.await;
895895

896+
if let Ok(status) = &result {
897+
metrics::inc_counter_vec(
898+
&metrics::EXECUTION_LAYER_PAYLOAD_STATUS,
899+
&["new_payload", status.status.into()],
900+
);
901+
}
902+
896903
process_payload_status(execution_payload.block_hash, result, self.log())
897904
.map_err(Box::new)
898905
.map_err(Error::EngineError)
@@ -1032,6 +1039,13 @@ impl<T: EthSpec> ExecutionLayer<T> {
10321039
})
10331040
.await;
10341041

1042+
if let Ok(status) = &result {
1043+
metrics::inc_counter_vec(
1044+
&metrics::EXECUTION_LAYER_PAYLOAD_STATUS,
1045+
&["forkchoice_updated", status.payload_status.status.into()],
1046+
);
1047+
}
1048+
10351049
process_payload_status(
10361050
head_block_hash,
10371051
result.map(|response| response.payload_status),

beacon_node/execution_layer/src/metrics.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ lazy_static::lazy_static! {
3636
"execution_layer_get_payload_by_block_hash_time",
3737
"Time to reconstruct a payload from the EE using eth_getBlockByHash"
3838
);
39+
pub static ref EXECUTION_LAYER_PAYLOAD_STATUS: Result<IntCounterVec> = try_create_int_counter_vec(
40+
"execution_layer_payload_status",
41+
"Indicates the payload status returned for a particular method",
42+
&["method", "status"]
43+
);
3944
}

0 commit comments

Comments
 (0)