A Prometheus exporter that connects to a Solana RPC node and exposes various metrics about Solana cluster performance, health, and more.
Inspired by asymmetric-research/solana-exporter. This project has been adapted specifically for running against a Solana RPC node instead of a validator node, and focuses on RPC-related metrics and cluster-wide information.
- Overview
- Features
- Installation
- Usage
- Configuration
- Exposed Metrics
- Prometheus Configuration
- Development
- License
Solana RPC Exporter queries a Solana RPC endpoint for various statistics—such as slot height, block height, epoch info, transaction counts—and exposes them as Prometheus metrics. This allows you to easily monitor your Solana node(s) (or remote RPC endpoints) in your existing Prometheus + Grafana stack.
By focusing on RPC interactions rather than validator-specific internals, this exporter is well-suited for:
- Lightweight setups that only have an RPC node rather than a full validator.
- Third-party services that rely on remote RPC endpoints for data.
- Multiple clusters (e.g., mainnet-beta, testnet, devnet, localnet) where you want a unified exporter.
- Slot and block metrics: current slot, block height, epoch boundaries, etc.
- RPC node health checks: node commitment, network health, and more.
- Transaction metrics: total transaction counts, transaction pacing, etc.
- Flexible configuration: set custom RPC URLs, poll intervals, timeouts, etc.
- Prometheus-compatible: exposes metrics over an HTTP endpoint.
- Extensible codebase: you can add custom queries or instrumentation.
If you have Go installed, you can clone this repo and build:
git clone https://github.com/naviat/solana-rpc-exporter.git
cd solana-rpc-exporter
go build -o solana-rpc-exporter cmd/solana-exporter/main.go
This will produce an executable named solana-rpc-exporter
Build and run a Docker image:
docker build -t solana-rpc-exporter .
docker run -p 8080:8080 solana-rpc-exporter \
--rpc-url http://your-solana-rpc:8899 \
--network mainnet-beta
Run the exporter with default settings (pointing to a local Solana RPC node):
./solana-rpc-exporter \
--rpc-url http://localhost:8899 \
--listen-address :8080 \
--network mainnet-beta
The metrics will be available at:
http://localhost:8080/metrics
You can then configure Prometheus to scrape localhost:8080/metrics
.
The exporter supports several CLI flags and environment variables. Below is a summary of the most common options:
Flag / Env Var | Default | Description |
---|---|---|
--rpc-url |
http://localhost:8899 |
URL of the Solana RPC endpoint. |
--listen-address |
:8080 |
Host and port for the exporter’s HTTP server. |
--network |
mainnet-beta |
Network name (mainnet-beta , testnet , devnet , or localnet ). |
Tip: Use
--help
or consult the documentation for additional flags and corresponding environment variables (e.g.,SOLANA_URL
,HTTP_TIMEOUT
, etc.).
Below is a selection of key metrics that the exporter publishes at /metrics
:
Metric & Labels | Value | Type | Help |
---|---|---|---|
solana_network_epoch |
822 |
gauge | (Inferred) Current epoch for the network (not explicitly labeled in the sample). |
solana_node_block_height |
3.43303272e+08 |
gauge | Current block height of the RPC node. |
solana_node_first_available_block |
3.47071418e+08 |
gauge | First available block in the RPC node's ledger. |
solana_node_health |
1 |
gauge | Health status of the RPC node (1 = healthy, 0 = unhealthy). |
solana_node_minimum_ledger_slot |
3.47071417e+08 |
gauge | Lowest slot that the RPC node has information about in its ledger. |
solana_node_num_slots_behind |
0 |
gauge | Number of slots the RPC node is behind. |
solana_node_slot_height |
3.55233915e+08 |
gauge | Current slot height of the RPC node. |
solana_node_transaction_count |
1.499279778e+10 |
gauge | Total number of transactions processed by the RPC node. |
solana_node_version_info |
1 |
gauge | Version information of the RPC node. |
These metrics can be scraped by Prometheus and then visualized in your preferred dashboarding tool (e.g., Grafana).
In your prometheus.yml, add:
scrape_configs:
- job_name: 'solana-rpc-exporter'
static_configs:
- targets: ['localhost:8080']
Adjust if you’re running on a different host or port.
git clone https://github.com/naviat/solana-rpc-exporter.git
cd solana-rpc-exporter
go mod tidy
go test -v ./cmd/solana-exporter
go test -v ./pkg/rpc
go test -v -coverprofile=coverage.out ./...
go build -o solana-rpc-exporter cmd/solana-exporter/main.go
./solana-rpc-exporter --rpc-url=http://localhost:8899 --listen-address=:8080 --network=mainnet-beta
Feel free to open pull requests or issues to add more metrics, fix bugs, or improve performance.
This project is licensed under the MIT License.
Happy exporting! If you have any questions or suggestions, please open an issue. We welcome feedback and contributions.