Skip to content

Commit c913457

Browse files
authored
Get blobs v2 metrics (#8641)
N/A Add standardized metrics for getBlobsV2 from ethereum/beacon-metrics#14. Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
1 parent 57bbc93 commit c913457

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

beacon_node/beacon_chain/src/fetch_blobs/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,24 @@ async fn fetch_and_process_blobs_v2<T: BeaconChainTypes>(
247247

248248
metrics::observe(&metrics::BLOBS_FROM_EL_EXPECTED, num_expected_blobs as f64);
249249
debug!(num_expected_blobs, "Fetching blobs from the EL");
250+
251+
// Track request count and duration for standardized metrics
252+
inc_counter(&metrics::BEACON_ENGINE_GET_BLOBS_V2_REQUESTS_TOTAL);
253+
let _timer =
254+
metrics::start_timer(&metrics::BEACON_ENGINE_GET_BLOBS_V2_REQUEST_DURATION_SECONDS);
255+
250256
let response = chain_adapter
251257
.get_blobs_v2(versioned_hashes)
252258
.await
253259
.inspect_err(|_| {
254260
inc_counter(&metrics::BLOBS_FROM_EL_ERROR_TOTAL);
255261
})?;
256262

263+
drop(_timer);
264+
265+
// Track successful response
266+
inc_counter(&metrics::BEACON_ENGINE_GET_BLOBS_V2_RESPONSES_TOTAL);
267+
257268
let Some(blobs_and_proofs) = response else {
258269
debug!(num_expected_blobs, "No blobs fetched from the EL");
259270
inc_counter(&metrics::BLOBS_FROM_EL_MISS_TOTAL);

beacon_node/beacon_chain/src/metrics.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,33 @@ pub static BLOBS_FROM_EL_RECEIVED: LazyLock<Result<Histogram>> = LazyLock::new(|
16891689
)
16901690
});
16911691

1692+
/*
1693+
* Standardized getBlobs metrics across clients from https://github.com/ethereum/beacon-metrics
1694+
*/
1695+
pub static BEACON_ENGINE_GET_BLOBS_V2_REQUESTS_TOTAL: LazyLock<Result<IntCounter>> =
1696+
LazyLock::new(|| {
1697+
try_create_int_counter(
1698+
"beacon_engine_getBlobsV2_requests_total",
1699+
"Total number of engine_getBlobsV2 requests made to the execution layer",
1700+
)
1701+
});
1702+
1703+
pub static BEACON_ENGINE_GET_BLOBS_V2_RESPONSES_TOTAL: LazyLock<Result<IntCounter>> =
1704+
LazyLock::new(|| {
1705+
try_create_int_counter(
1706+
"beacon_engine_getBlobsV2_responses_total",
1707+
"Total number of successful engine_getBlobsV2 responses from the execution layer",
1708+
)
1709+
});
1710+
1711+
pub static BEACON_ENGINE_GET_BLOBS_V2_REQUEST_DURATION_SECONDS: LazyLock<Result<Histogram>> =
1712+
LazyLock::new(|| {
1713+
try_create_histogram(
1714+
"beacon_engine_getBlobsV2_request_duration_seconds",
1715+
"Duration of engine_getBlobsV2 requests to the execution layer in seconds",
1716+
)
1717+
});
1718+
16921719
/*
16931720
* Light server message verification
16941721
*/

0 commit comments

Comments
 (0)