Skip to content

solbound-dev/solana_wallet_exporter

Repository files navigation

solana_wallet_exporter

CI Go Report Card Go version GitHub release

Prometheus exporter for Solana wallet SOL and token balance.

Quick start

docker run --rm --name solana_wallet_exporter -p 18899:18899 \
  ghcr.io/solbound-dev/solana-wallet-exporter \
  --solana.wallets LptbYRq7UNXhmzXoKaa2fbeikF7hSoKFY65vzMCen1N

Exporter is now running on http://localhost:18899/metrics

Installation

Pre-built binaries from the Github releases page can be used to run exporter without docker.

To build and start exporter locally make sure you have go and make installed. Then run:

git clone https://github.com/solbound-dev/solana_wallet_exporter
cd solana_wallet_exporter
make build
./solana_wallet_exporter <flags>

Configuration

Exporter configuration can be changed via command line parameters:

  • --solana.wallets - Comma separated list of solana wallet public keys. (Required)
  • --solana.rpc - Solana RPC provider URL. (Default: https://api.mainnet-beta.solana.com)
  • --solana.cacheseconds - Number of seconds to cache values for. (Default: 300)
  • --web.listen-address - Address to listen on for web interface and telemetry. (Default: :18899)

Generated metrics

All solana wallet related metrics generated by the exporter are prefixed with solana_wallet_.

# HELP solana_wallet_balance Balance of a given wallet in SOL.
# TYPE solana_wallet_balance gauge
solana_wallet_balance{wallet="DnAqjBM3uLfCrVCUz43Fnvncjn7qcPwRvTHFgxPQikR"} 0.098543076
solana_wallet_balance{wallet="LptbYRq7UNXhmzXoKaa2fbeikF7hSoKFY65vzMCen1N"} 0.704110004
# HELP solana_wallet_last_update_ts Timestamp of the last update.
# TYPE solana_wallet_last_update_ts gauge
solana_wallet_last_update_ts 1.687044895e+09
# HELP solana_wallet_token_balance Balance of a given wallet in a given token.
# TYPE solana_wallet_token_balance gauge
solana_wallet_token_balance{token="BU8n2Mw4vQqjAXrxbDhGCDFfYCDx6CKo4g1z1atfhWHn",wallet="DnAqjBM3uLfCrVCUz43Fnvncjn7qcPwRvTHFgxPQikR"} 0
solana_wallet_token_balance{token="Buz5BTqXD67hQHuvyKVpiUENL8wYh4gXciF6w1ScWjED",wallet="DnAqjBM3uLfCrVCUz43Fnvncjn7qcPwRvTHFgxPQikR"} 0
solana_wallet_token_balance{token="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",wallet="DnAqjBM3uLfCrVCUz43Fnvncjn7qcPwRvTHFgxPQikR"} 715.40052
solana_wallet_token_balance{token="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",wallet="LptbYRq7UNXhmzXoKaa2fbeikF7hSoKFY65vzMCen1N"} 178.914426
solana_wallet_token_balance{token="FnVPD3fRutXcibEHDYP1gv8kuYJx2SNCi2EizcAsR4wN",wallet="DnAqjBM3uLfCrVCUz43Fnvncjn7qcPwRvTHFgxPQikR"} 1535
...

Prometheus configuration

scrape_configs:
  - job_name: solana_wallet
    static_configs:
      - targets: ['localhost:18899']

You can poll as often as you want but, by default, the exporter only refreshes cached values every five minutes to prevent overloading RPC provider with requests. This can be changed using --solana.cacheseconds.