Skip to content

Comments

metrics: add more monitor metrics for EVN;#3084

Merged
zzzckck merged 3 commits intobnb-chain:developfrom
galaio:new-broadcast
May 12, 2025
Merged

metrics: add more monitor metrics for EVN;#3084
zzzckck merged 3 commits intobnb-chain:developfrom
galaio:new-broadcast

Conversation

@galaio
Copy link
Contributor

@galaio galaio commented May 12, 2025

Description

This PR adds more monitor metrics for EVN, it can be used for monitor the network improvement from EVM.

Example

  1. Monitor new block fetching feature:
# legacy block fetching cost time
eth_fetcher_block_legacy_cost{job=~"$jobs",quantile=~"$percentile"}
# new block fetching cost time
eth_fetcher_block_quick_cost{job=~"$jobs",quantile=~"$percentile"}
# new block fetching success rate
eth_fetcher_block_quick_success{job=~"$jobs"}/(eth_fetcher_block_quick_success{job=~"$jobs"}+eth_fetcher_block_quick_err{job=~"$jobs"})
# new block fetching fallback rate
eth_fetcher_block_quick_fallback{job=~"$jobs"}/(eth_fetcher_block_quick_success{job=~"$jobs"}+eth_fetcher_block_quick_err{job=~"$jobs"})
  1. EVN Peer Monitor
# total peers
p2p_peers{job=~"$jobs"}
# even proxyed peers
evn_peer_proxed{job=~"$jobs"}
# even onchainValidator peers
evn_peer_ onchainValidator{job=~"$jobs"}
# even whiteList peers
evn_peer_ whiteList{job=~"$jobs"}

You can also query the peers RPC to get the detailed EVN feature flags for a peer.

./bsc attach --exec "admin.peers" ./geth.ipc

Changes

Notable changes:

  • metrics: add evn peer monitor metrics;
  • metrics: add block fetching timer, success rate;
  • chore: opt some broadcast logs;

@galaio galaio requested review from MatusKysel, buddh0 and zzzckck May 12, 2025 12:45
@MatusKysel MatusKysel requested a review from Copilot May 12, 2025 12:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances monitoring for EVN by introducing new metrics for peer flags and block fetching performance.

  • Added new EVN flag fields in the PeerInfo structure (p2p/peer.go).
  • Introduced new metrics in eth/peerset.go to track proxied, whitelist, and on-chain validator peers.
  • Instrumented block fetching performance metrics and improved logging for EVN peers in eth/handler.go and eth/fetcher/block_fetcher.go.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
p2p/peer.go Added new EVN flag fields to PeerInfo for monitoring purposes.
eth/peerset.go Registered new gauges for EVN peer metrics and updated feature counts.
eth/handler.go Enhanced debug logging to include EVN flag status during broadcasts.
eth/fetcher/block_fetcher.go Added timers and meters to track block fetching costs and outcomes.
Comments suppressed due to low confidence (4)

p2p/peer.go:591

  • [nitpick] Consider renaming 'ProxyedValidatorFlag' to 'ProxiedValidatorFlag' for clarity and consistency.
ProxyedValidatorFlag bool                   `json:"proxyedValidatorFlag"`

eth/peerset.go:75

  • [nitpick] Consider renaming 'evnProxedPeerGuage' to 'evnProxiedPeerGauge' to correct the spelling and improve consistency.
evnProxedPeerGuage           = metrics.NewRegisteredGauge("evn/peer/proxed", nil)

eth/peerset.go:76

  • [nitpick] Consider renaming 'evnWhiteListPeerGuage' to 'evnWhitelistPeerGauge' to fix the spelling of 'Gauge' and standardize naming.
evnWhiteListPeerGuage        = metrics.NewRegisteredGauge("evn/peer/whiteList", nil)

eth/peerset.go:77

  • [nitpick] Consider renaming 'evnOnchainValidatorPeerGuage' to 'evnOnchainValidatorPeerGauge' to correct the spelling of 'Gauge'.
evnOnchainValidatorPeerGuage = metrics.NewRegisteredGauge("evn/peer/onchainValidator", nil)

@zzzckck zzzckck merged commit a2370d7 into bnb-chain:develop May 12, 2025
7 checks passed
galaio added a commit to galaio/bsc that referenced this pull request May 29, 2025
galaio added a commit to galaio/bsc that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants