Skip to main content

Metrics

The validator includes a built-in metrics server that exposes various metrics about the validator's operation. These metrics can be used to monitor the validator's performance and health.

Configuration​

By default, metrics are disabled. You can enable metrics tracking and customize the host and port with the following flags:

./build/validator --metrics --metrics-host "0.0.0.0" --metrics-port "9090"  # Listen on all interfaces, port 9090

Endpoints​

The metrics server exposes two endpoints:

  • /health: Returns a 200 OK response if the server is running
  • /metrics: Exposes Prometheus metrics

Available Metrics​

The following metrics are available:

Metric NameTypeDescriptionExample
validator_attestation_starknet_latest_block_numberGaugeThe latest block number seen by the validator on the Starknet networkvalidator_attestation_starknet_latest_block_number{network="SN_SEPOLIA"} 10500
validator_attestation_current_epoch_idGaugeThe ID of the current epoch the validator is participating invalidator_attestation_current_epoch_id{network="SN_SEPOLIA"} 42
validator_attestation_current_epoch_lengthGaugeThe total length (in blocks) of the current epochvalidator_attestation_current_epoch_length{network="SN_SEPOLIA"} 100
validator_attestation_current_epoch_starting_block_numberGaugeThe first block number of the current epochvalidator_attestation_current_epoch_starting_block_number{network="SN_SEPOLIA"} 10401
validator_attestation_current_epoch_assigned_block_numberGaugeThe specific block number within the current epoch for which the validator is assigned to attestvalidator_attestation_current_epoch_assigned_block_number{network="SN_SEPOLIA"} 10455
validator_attestation_last_attestation_timestamp_secondsGaugeThe Unix timestamp (in seconds) of the last successful attestation submissionvalidator_attestation_last_attestation_timestamp_seconds{network="SN_SEPOLIA"} 1678886400
validator_attestation_attestation_submitted_countCounterThe total number of attestations submitted by the validator since startupvalidator_attestation_attestation_submitted_count{network="SN_SEPOLIA"} 55
validator_attestation_attestation_failure_countCounterThe total number of attestation transaction submission failures encountered by the validator since startupvalidator_attestation_attestation_failure_count{network="SN_SEPOLIA"} 3
validator_attestation_attestation_confirmed_countCounterThe total number of attestations that have been confirmed on the network since validator startupvalidator_attestation_attestation_confirmed_count{network="SN_SEPOLIA"} 52
validator_attestation_signer_balanceCounterThe balance of the account that signs the attestation after each attest transactionvalidator_attestation_signer_balance{network="SN_SEPOLIA"} 113
validator_attestation_signer_below_thresholdCounterSet to one if the account that signs the attestation has it's balance below certain thresholdvalidator_attestation_signer_below_threshold{network="SN_SEPOLIA"} 0

All metrics include a network label that indicates the Starknet network (e.g., "SN_MAINNET", "SN_SEPOLIA").

Using with Prometheus​

To monitor these metrics with Prometheus, add the following to your Prometheus configuration:

scrape_configs:
- job_name: 'starknet-validator'
scrape_interval: 15s
static_configs:
- targets: ['localhost:9090']

You can then visualize these metrics using Grafana or any other Prometheus-compatible visualization tool.

Grafana Dashboard​

A sample Grafana dashboard is available to visualize the validator metrics: grafana-dashboard.json

This dashboard provides comprehensive monitoring of your validator's performance including:

  • Block and epoch progression
  • Attestation success rates
  • Network status and health metrics