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:

docker run --network host \
--user "$(id -u):$(id -g)" \
-v /path/to/config.json:/app/config/config.json \
nethermind/starknet-staking-v2 \
--config /app/config/config.json \
--metrics --metrics-host "0.0.0.0" --metrics-port "9090"

If the metrics server can't listen on that host and port (an invalid port, a port already in use), the validator exits with an error at startup.

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:

MetricTypeLabels
validator_attestation_starknet_latest_block_numberGaugenetwork
validator_attestation_current_epoch_idGaugenetwork
validator_attestation_current_epoch_lengthGaugenetwork
validator_attestation_current_epoch_starting_block_numberGaugenetwork
validator_attestation_current_epoch_assigned_block_numberGaugenetwork
validator_attestation_last_attestation_timestamp_secondsGaugenetwork
validator_attestation_attestation_submitted_countCounternetwork
validator_attestation_attestation_failure_countCounternetwork
validator_attestation_attestation_confirmed_countCounternetwork
validator_attestation_epoch_info_fetch_failure_countCounternetwork
validator_attestation_signer_balanceGaugenetwork
validator_attestation_signer_below_thresholdGaugenetwork
validator_attestation_balance_check_failure_countCounternetwork, account
validator_attestation_reward_balanceGaugenetwork
validator_attestation_reward_below_thresholdGaugenetwork
validator_attestation_reward_unclaimedGaugenetwork
validator_attestation_reward_claim_submitted_countCounternetwork
validator_attestation_reward_claim_confirmed_countCounternetwork
validator_attestation_reward_claim_failure_countCounternetwork
validator_attestation_reward_claim_max_fee_exceeded_countCounternetwork
validator_attestation_reward_last_claim_timestamp_secondsGaugenetwork

Every metric has a network label with the chain id of the provider's network, such as SN_MAIN or SN_SEPOLIA. Metrics with an account label report signer or reward in it. A scrape of /metrics returns lines such as:

validator_attestation_current_epoch_id{network="SN_SEPOLIA"} 42

Reading the counters:

  • An increase of validator_attestation_epoch_info_fetch_failure_count means the validator is stalled, since block headers are not processed while the fetch fails.
  • While validator_attestation_balance_check_failure_count grows, the balance metrics of that account keep their last value.
  • A reward claim that is submitted but neither confirmed nor counted as a failure was not accepted within 2 minutes: check its status manually.
Reward metrics

All the validator_attestation_reward_* metrics are only reported if the auto-claim rewards feature is enabled. The reward account balance metrics are not reported when the reward account is the operational account, whose balance is already reported by the signer metrics.

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