Skip to content
Last Updated: 2025-08-22 The Kora Metrics Crate provides comprehensive metrics collection and monitoring for the Kora RPC server. Kora exposes a /metrics endpoint that provides real-time performance data in Prometheus format. Set port in [metrics] to the RPC port to serve metrics on the RPC server, or to another port to run a separate metrics listener. The examples on this page use a separate listener on 8081, with the RPC server on 8080.

​Configuration

Metrics are configured in the [metrics] section of your kora.toml. The [metrics] section configures metrics collection and monitoring. This section is optional and by default, metrics are disabled.
OptionDescriptionRequiredType
enabledEnable metrics collection✅boolean
endpointCustom metrics endpoint path✅string
portMetrics port: the RPC port to serve metrics there, or a separate port✅number
scrape_intervalFrequency of Prometheus scrape (seconds)✅number
When port equals the RPC port, Kora logs Metrics endpoint enabled at /metrics on RPC server and answers /metrics on the RPC port. With a separate port, only that port answers /metrics.

​Fee Payer Balance Tracking

The [metrics.fee_payer_balance] section configures automatic monitoring of your fee payer’s SOL balance: Leave the section out to keep balance tracking off. If you include it, set both keys:
OptionDescriptionRequiredType
enabledEnable fee payer balance tracking✅boolean
expiry_secondsBackground tracking interval in seconds✅number
When enabled, Kora automatically tracks your fee payer’s SOL balance and exposes it via the signer_balance_lamports Prometheus gauge, labeled with signer_name and signer_pubkey. This helps with capacity planning and low-balance alerting.

​Quick Start

Access metrics:

​What You’ll See

The metrics show how your RPC server is performing:
If you haven’t called the RPC server yet, you will not see any metrics. You can run a simple test by calling the getConfig method:
and then check the metrics:

​Key Metrics Explained

  1. kora_http_requests_total - How many requests you’ve handled
    • method: Which RPC method was called
    • status: HTTP status code of the response
    • JSON-RPC errors, such as a rejected transaction or a missing parameter, are returned with HTTP 200, so they’re counted under status="200". Requests that fail authentication are counted under status="401". Unknown or disabled methods get HTTP 405 before metrics are collected, so they aren’t counted.
    • Use this to track usage patterns and authentication failures
  2. kora_http_request_duration_seconds - How fast your requests are
    • A Prometheus histogram with bucket, sum, and count series; compute p50, p95, and p99 response times with histogram_quantile()
    • Use this to identify slow endpoints
  3. signer_balance_lamports - Current SOL balance of each signer
    • Shows balance in lamports (1 SOL = 1,000,000,000 lamports) for each signer
    • Labels: signer_name (human-readable name) and signer_pubkey (public key)
    • Updated automatically in the background when enabled
    • Use this for capacity planning and low-balance alerts across all signers

​Using the Data

​Option 1: Quick Health Check

For graphs and alerts, run the full monitoring stack:
Then visit:
  • Prometheus: http://localhost:9090 (query metrics)
  • Grafana Pre-built Kora dashboard: http://localhost:3000
    • Default login: admin/admin (or use the GF_SECURITY_ADMIN_PASSWORD and GF_SECURITY_ADMIN_USER credentials from your .env file)

​Option 3: Your Own Monitoring

Point any Prometheus-compatible tool at http://your-server:8081/metrics:
  • Datadog
  • New Relic
  • CloudWatch
  • VictoriaMetrics

​Example Queries (Prometheus)

​Multi-Signer Monitoring

When using multiple signers, you can monitor each signer individually or track aggregate metrics:

​Individual Signer Metrics

​Prometheus Queries for Multi-Signer Setups

​Security Note

The /metrics endpoint is public by default. In production, consider:
  • Putting it behind a firewall
  • Using a separate metrics port
  • Adding authentication via reverse proxy

​How Metrics Collection Works

  1. HTTP Middleware Layer - Intercepts all requests and collects:
    • Request count by JSON-RPC method and status
    • Request duration by method
  2. Metrics Endpoint - /metrics endpoint exposed automatically when feature is enabled
    • Handled by MetricsHandlerLayer
    • Returns Prometheus-formatted metrics
  3. Prometheus Scraping - Configured to scrape Kora every 60 seconds (see crates/lib/src/metrics/prometheus.yml)