EIPs Explained

EIP-2159 · Final · Interface · 2019-07-01

EIP-2159: Common Prometheus Metrics Names for Clients

Standard Prometheus metric names for chain height, sync target and peers, so operators can monitor different Ethereum clients with one dashboard and one set of alerts.

What problem does it solve?

Most Ethereum clients export metrics in Prometheus format so operators can graph performance and alert when something goes wrong. But each client named its metrics differently. If you ran a mix of clients, which is good for resilience, you needed separate dashboards and alert rules for each one.

EIP-2159 picks standard names for a few metrics that every client can report. With them, one dashboard and one alert configuration work across a heterogeneous set of nodes.

How it works

The EIP defines four gauges. Clients may export many more metrics, but non-standard ones should not use the ethereum_ prefix.

Metric Meaning JSON-RPC equivalent
ethereum_blockchain_height Current height of the canonical chain eth_blockNumber
ethereum_best_known_block_number Estimated highest block available highestBlock from eth_syncing, or eth_blockNumber if not syncing
ethereum_peer_count Peers currently connected net_peerCount
ethereum_peer_limit Maximum peers allowed none

ethereum_best_known_block_number always has a value: when the node is not syncing, it equals the current chain height. That makes "how far behind am I?" a simple subtraction.

The spec deliberately does not say how to expose metrics (port, path, flags), since clients already differ and standardizing that brings little benefit.

Sample code

A Prometheus scrape config and three alert rules built only on the standard names:

# prometheus.yml
scrape_configs:
  - job_name: ethereum
    static_configs:
      - targets: ["node-a:METRICS_PORT", "node-b:METRICS_PORT"]  # each client's metrics port
# alerts.yml
groups:
  - name: ethereum
    rules:
      - alert: NodeFallingBehind
        expr: ethereum_best_known_block_number - ethereum_blockchain_height > 10
        for: 5m
      - alert: ChainStalled
        expr: increase(ethereum_blockchain_height[5m]) == 0
        for: 5m
      - alert: LowPeers
        expr: ethereum_peer_count < 5
        for: 10m

A dashboard panel for peer usage:

ethereum_peer_count / ethereum_peer_limit

Things to know

  • Status: Final. It is an Interface standard and does not affect consensus.
  • Thresholds in the sample alerts are illustrative. Tune them to your network and block time.
  • Clients that already exported these values under old names may break existing dashboards when switching. The spec suggests exposing both names during a transition.
  • The metrics port and enabling flag differ by client and are not covered here. Check each client's documentation.
  • Consensus-layer (beacon chain) clients follow a separate, more detailed metrics specification.

#monitoring #prometheus #metrics #clients #operations

Details

Authors
Adrian Sutton (@ajsutton)
Status
Final
Type
Standards Track / Interface
Created
2019-07-01

Machine-readable: Markdown · JSON