Skip to content

Commit

Permalink
Add payload id hit/miss metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Mar 8, 2022
1 parent 4811406 commit c86ada0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions beacon_node/execution_layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ impl ExecutionLayer {
.await
{
// The payload id has been cached for this engine.
metrics::inc_counter_vec(
&metrics::EXECUTION_LAYER_PRE_PREPARED_PAYLOAD_ID,
&[metrics::HIT],
);
id
} else {
// The payload id has *not* been cached for this engine. Trigger an artificial
Expand All @@ -469,6 +473,10 @@ impl ExecutionLayer {
// TODO(merge): a better algorithm might try to favour a node that already had a
// cached payload id, since a payload that has had more time to produce is
// likely to be more profitable.
metrics::inc_counter_vec(
&metrics::EXECUTION_LAYER_PRE_PREPARED_PAYLOAD_ID,
&[metrics::MISS],
);
let fork_choice_state = ForkChoiceState {
head_block_hash: parent_hash,
safe_block_hash: parent_hash,
Expand Down
7 changes: 7 additions & 0 deletions beacon_node/execution_layer/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub use lighthouse_metrics::*;

pub const HIT: &str = "hit";
pub const MISS: &str = "miss";
pub const GET_PAYLOAD: &str = "get_payload";
pub const NEW_PAYLOAD: &str = "new_payload";
pub const FORKCHOICE_UPDATED: &str = "forkchoice_updated";
Expand All @@ -24,4 +26,9 @@ lazy_static::lazy_static! {
"execution_layer_payload_attributes_lookahead",
"Duration between a fcU call with PayloadAttributes and when the block should be produced",
);
pub static ref EXECUTION_LAYER_PRE_PREPARED_PAYLOAD_ID: Result<IntCounterVec> = try_create_int_counter_vec(
"execution_layer_pre_prepared_payload_id",
"Indicates hits or misses for already having prepared a payload id before payload production",
&["event"]
);
}

0 comments on commit c86ada0

Please sign in to comment.