From f6727a72dd2b156c3a20dbdd9185f4d78a4ac722 Mon Sep 17 00:00:00 2001 From: Wet Date: Thu, 9 Oct 2025 15:14:36 +0800 Subject: [PATCH 1/4] feat(engine): add precompile name in the metric labels --- crates/engine/tree/src/tree/payload_validator.rs | 9 +++++++-- crates/engine/tree/src/tree/precompile_cache.rs | 11 +++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/engine/tree/src/tree/payload_validator.rs b/crates/engine/tree/src/tree/payload_validator.rs index cd2c37d1e91..3ca35052874 100644 --- a/crates/engine/tree/src/tree/payload_validator.rs +++ b/crates/engine/tree/src/tree/payload_validator.rs @@ -14,7 +14,7 @@ use crate::tree::{ }; use alloy_consensus::transaction::Either; use alloy_eips::{eip1898::BlockWithParent, NumHash}; -use alloy_evm::Evm; +use alloy_evm::{precompiles::Precompile, Evm}; use alloy_primitives::B256; use reth_chain_state::{ CanonicalInMemoryState, ExecutedBlock, ExecutedBlockWithTrieUpdates, ExecutedTrieUpdates, @@ -663,7 +663,12 @@ where let metrics = self .precompile_cache_metrics .entry(*address) - .or_insert_with(|| CachedPrecompileMetrics::new_with_address(*address)) + .or_insert_with(|| { + CachedPrecompileMetrics::new_with_address_and_name( + *address, + precompile.precompile_id().name(), + ) + }) .clone(); CachedPrecompile::wrap( precompile, diff --git a/crates/engine/tree/src/tree/precompile_cache.rs b/crates/engine/tree/src/tree/precompile_cache.rs index c88cb4bc720..e805d206413 100644 --- a/crates/engine/tree/src/tree/precompile_cache.rs +++ b/crates/engine/tree/src/tree/precompile_cache.rs @@ -235,12 +235,15 @@ pub(crate) struct CachedPrecompileMetrics { } impl CachedPrecompileMetrics { - /// Creates a new instance of [`CachedPrecompileMetrics`] with the given address. + /// Creates a new instance of [`CachedPrecompileMetrics`] with the given address and name. /// /// Adds address as an `address` label padded with zeros to at least two hex symbols, prefixed - /// by `0x`. - pub(crate) fn new_with_address(address: Address) -> Self { - Self::new_with_labels(&[("address", format!("0x{address:02x}"))]) + /// by `0x`, and the precompile name as a `name` label. + pub(crate) fn new_with_address_and_name(address: Address, name: &str) -> Self { + Self::new_with_labels(&[ + ("address", format!("0x{address:02x}")), + ("name", name.to_string()), + ]) } } From 8f2b3497c578a8f9c4e67e8446e5a9ddc4606f0b Mon Sep 17 00:00:00 2001 From: Wet Date: Thu, 9 Oct 2025 15:14:56 +0800 Subject: [PATCH 2/4] feat(grafana): use precompile name as legend --- etc/grafana/dashboards/overview.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/grafana/dashboards/overview.json b/etc/grafana/dashboards/overview.json index 5b271d7ea8e..d8abb392f55 100644 --- a/etc/grafana/dashboards/overview.json +++ b/etc/grafana/dashboards/overview.json @@ -3931,7 +3931,7 @@ "hide": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "Precompile cache hits", + "legendFormat": "{{name}}", "range": true, "refId": "A", "useBackend": false From e4b3e09e4528735626be863ed6da716b1f1bc588 Mon Sep 17 00:00:00 2001 From: Wet Date: Thu, 9 Oct 2025 15:37:51 +0800 Subject: [PATCH 3/4] Revert "feat(engine): add precompile name in the metric labels" This reverts commit f6727a72dd2b156c3a20dbdd9185f4d78a4ac722. --- crates/engine/tree/src/tree/payload_validator.rs | 9 ++------- crates/engine/tree/src/tree/precompile_cache.rs | 11 ++++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/crates/engine/tree/src/tree/payload_validator.rs b/crates/engine/tree/src/tree/payload_validator.rs index 3ca35052874..cd2c37d1e91 100644 --- a/crates/engine/tree/src/tree/payload_validator.rs +++ b/crates/engine/tree/src/tree/payload_validator.rs @@ -14,7 +14,7 @@ use crate::tree::{ }; use alloy_consensus::transaction::Either; use alloy_eips::{eip1898::BlockWithParent, NumHash}; -use alloy_evm::{precompiles::Precompile, Evm}; +use alloy_evm::Evm; use alloy_primitives::B256; use reth_chain_state::{ CanonicalInMemoryState, ExecutedBlock, ExecutedBlockWithTrieUpdates, ExecutedTrieUpdates, @@ -663,12 +663,7 @@ where let metrics = self .precompile_cache_metrics .entry(*address) - .or_insert_with(|| { - CachedPrecompileMetrics::new_with_address_and_name( - *address, - precompile.precompile_id().name(), - ) - }) + .or_insert_with(|| CachedPrecompileMetrics::new_with_address(*address)) .clone(); CachedPrecompile::wrap( precompile, diff --git a/crates/engine/tree/src/tree/precompile_cache.rs b/crates/engine/tree/src/tree/precompile_cache.rs index e805d206413..c88cb4bc720 100644 --- a/crates/engine/tree/src/tree/precompile_cache.rs +++ b/crates/engine/tree/src/tree/precompile_cache.rs @@ -235,15 +235,12 @@ pub(crate) struct CachedPrecompileMetrics { } impl CachedPrecompileMetrics { - /// Creates a new instance of [`CachedPrecompileMetrics`] with the given address and name. + /// Creates a new instance of [`CachedPrecompileMetrics`] with the given address. /// /// Adds address as an `address` label padded with zeros to at least two hex symbols, prefixed - /// by `0x`, and the precompile name as a `name` label. - pub(crate) fn new_with_address_and_name(address: Address, name: &str) -> Self { - Self::new_with_labels(&[ - ("address", format!("0x{address:02x}")), - ("name", name.to_string()), - ]) + /// by `0x`. + pub(crate) fn new_with_address(address: Address) -> Self { + Self::new_with_labels(&[("address", format!("0x{address:02x}"))]) } } From 248d9a2809f5f7ee517d25070e36bb1c6fc6de3a Mon Sep 17 00:00:00 2001 From: Wet Date: Thu, 9 Oct 2025 15:38:36 +0800 Subject: [PATCH 4/4] use address instead --- etc/grafana/dashboards/overview.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/grafana/dashboards/overview.json b/etc/grafana/dashboards/overview.json index d8abb392f55..46a465ca4a4 100644 --- a/etc/grafana/dashboards/overview.json +++ b/etc/grafana/dashboards/overview.json @@ -3931,7 +3931,7 @@ "hide": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "{{name}}", + "legendFormat": "{{address}}", "range": true, "refId": "A", "useBackend": false