refactor: metrics architecture overhaul with complete pre-registration#89
Merged
refactor: metrics architecture overhaul with complete pre-registration#89
Conversation
- Reorganize metric structs by pipeline stage (request/cache/data-fetch/witness/execution/infra) - Add new metric types: ResponseSizeMetrics, DataSourceMetrics, SingleFlightMetrics, EvmExecutionMetrics - Add WitnessSourceMetrics for separate witness_generator/cloudflare tracking - Add db_size_bytes gauge to ChainSyncMetrics - Fix upstream duration timing bug (independent timing per tokio::join branch) - Simplify record_rpc_request/record_rpc_error with resolve_method lookup - Replace DebugTraceMetrics struct with pre_register_all_metrics() function - Remove TracingMetrics (no longer needed) - Complete pre-registration for all 31 label combinations across 10 metric structs
- Add method_name parameter to compute_debug_trace_block and compute_parity_trace_block - Add EvmExecutionMetrics and ResponseSizeMetrics to debug_traceTransaction and trace_transaction handlers - Pre-register all 5 methods for both ResponseSizeMetrics and EvmExecutionMetrics
Troublor
reviewed
Feb 13, 2026
Troublor
approved these changes
Feb 14, 2026
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.
Summary
Reorganize metrics by pipeline stage, add missing metric types, fix the upstream duration timing bug, and ensure all metrics are pre-registered at startup. All
EvmExecutionMetricsandResponseSizeMetricsuse actual RPC method names as labels.Changes
New Metric Types
ResponseSizeMetrics— response payload size, per RPC method (all 5 methods)DataSourceMetrics— tracks which source served block data (cache / db / witness_generator / cloudflare)SingleFlightMetrics— single-flight coalescing events (new / coalesced / bypassed)EvmExecutionMetrics— EVM execution duration and tx count, per RPC method (all 5 methods)WitnessSourceMetrics— witness fetch success rate, duration, and size by sourceBug Fix
eth_getBlockByHashandmega_getWitnesspreviously reported identical durations because both were measured aftertokio::join!completed. Now each branch has its ownInstant::now()inside the async block.Cleanup
TracingMetrics(no longer used)DebugTraceMetricsstruct withpre_register_all_metrics()function to eliminate#[allow(dead_code)]record_rpc_request/record_rpc_errorwithresolve_method()lookupdb_size_bytesgauge toChainSyncMetricscache_entries/cache_bytesgauges toCacheMetricsMetrics Coverage
10 structs, 37 label combinations, all pre-registered at startup:
RpcMethodMetricsRpcGlobalMetricsResponseSizeMetricsCacheMetricsDataSourceMetricsSingleFlightMetricsUpstreamMetricsWitnessSourceMetricsEvmExecutionMetricsChainSyncMetrics