feat(metrics): measure fcu lateness and missed flashblocks#29
Open
avalonche wants to merge 1 commit into
Open
Conversation
Add authrpc config for block time and flashblocks-per-block, and emit two metrics from the proxy postprocessor (off the client-response hot path): - fcu_lateness (ms): how late the first forkchoice-update with attributes lands into each block's building window, anchored on the payload's block timestamp - fcu_missed_flashblocks: flashblocks that no longer fit before the block's sealing deadline as a result (deadline-based attribution) Scoped to the first fcu-with-attributes per block via a monotonic block-timestamp high-water mark, with a clock-skew guard. Measurement is opt-in (--authrpc-flashblocks-per-block defaults to 0) and inert for the rpc proxy. block_time/flashblocks_per_block are exposed on the ConfigProxyHttp trait so the shared emit path can read them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Prometheus instrumentation to quantify (1) how late the first engine_forkchoiceUpdated* call with payload attributes arrives within a block’s building window, and (2) how many flashblocks are missed as a result, with authrpc-specific configuration knobs.
Changes:
- Emit two new per-proxy metrics (
fcu_arrival,fcu_reduced_flashblocks) from the HTTP proxy postprocessor path. - Extend the HTTP proxy config trait with
block_timeandflashblocks_per_block, implemented for authrpc (real values) and rpc (disabled via zeroes). - Add authrpc CLI/env configuration and validation for the new measurement inputs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rproxy/src/server/proxy/http/proxy.rs | Adds FCU lateness/flashblock-loss metric emission on successful proxied responses. |
| crates/rproxy/src/server/proxy/http/config.rs | Extends ConfigProxyHttp with block/flashblock timing accessors. |
| crates/rproxy/src/server/proxy/config/rpc.rs | Implements new config trait methods for rpc as disabled (zero values). |
| crates/rproxy/src/server/proxy/config/authrpc.rs | Adds authrpc CLI/env flags and validation + implements new config trait methods. |
| crates/rproxy/src/server/metrics.rs | Introduces metric families/counters and an atomic dedupe guard for “first FCU per block”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1274
to
+1282
| let arrival_ms = (req.start().unix_timestamp_nanos() / 1_000_000) as i64; | ||
| let block_ts_ms = block_ts_secs * 1_000; | ||
| let block_time_ms = block_time.as_millis() as i64; | ||
|
|
||
| let ms_into_slot = arrival_ms - (block_ts_ms - block_time_ms); | ||
| let interval_ms = block_time_ms / flashblocks_per_block as i64; | ||
| let remaining_flashblocks = ((block_ts_ms - arrival_ms) / interval_ms) | ||
| .clamp(0, flashblocks_per_block as i64) as u64; | ||
| let reduced_flashblocks = flashblocks_per_block - remaining_flashblocks; |
| fcu_arrival: Family::default(), | ||
| fcu_reduced_flashblocks: Family::default(), | ||
|
|
||
| fcu_block_timestamp_latest: AtomicI64::new(0), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds measurement of how late the first
engine_forkchoiceUpdated*with payload attributes lands in each block, and how many flashblocks missed as two Prometheus metrics.Config (authrpc)
--authrpc-block-time(RPROXY_AUTHRPC_BLOCK_TIME, default1s) — block duration--authrpc-flashblocks-per-block(RPROXY_AUTHRPC_FLASHBLOCKS_PER_BLOCK, default0) — number of flashblocks per block;0disables the measurementMetrics
rproxy_fcu_arrival(milliseconds) — how far into the block's building window the FCU arrived (negative if early). Based on block timestamp in the payload attribute.rproxy_fcu_reduced_flashblocks— flashblocks that are reduced than the expected number due to the fcu timing