Overview
The Sol RPC Router exposes Prometheus metrics on a dedicated port (default: 28901) and includes pre-built Grafana dashboards for comprehensive monitoring.Metrics Endpoint
The router runs a dedicated metrics server:http://localhost:28901/metrics
Prometheus Histogram Configuration
The router configures Prometheus histograms with specific buckets for accurate latency percentile calculations:_bucket, _sum, _count) instead of summaries, enabling histogram_quantile() queries in Grafana.
Available Metrics
HTTP Request Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
rpc_requests_total | Counter | method, status, rpc_method, backend, owner | Total RPC requests |
rpc_request_duration_seconds | Histogram | rpc_method, backend, owner | Request duration distribution |
Backend Health Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
rpc_backend_health | Gauge | backend | Backend health status (1.0 = healthy, 0.0 = unhealthy) |
WebSocket Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
ws_connections_total | Counter | backend, owner, status | Connection attempts |
ws_active_connections | Gauge | backend, owner | Currently open WebSocket sessions |
ws_messages_total | Counter | backend, owner, direction | Frames relayed (client_to_backend / backend_to_client) |
ws_connection_duration_seconds | Histogram | backend, owner | Session duration from upgrade to close |
WebSocket Connection Statuses
Thews_connections_total metric tracks these status values:
connected- Successful connectionsauth_failed- Invalid API keyrate_limited- Rate limit exceededno_backend- No healthy backends availablebackend_connect_failed- Failed to connect to backenderror- Other errors
Prometheus Setup
Configuration
Createprometheus.yml:
Running Prometheus
http://localhost:9090
Verifying Metrics Collection
- Open Prometheus UI:
http://localhost:9090 - Go to Status → Targets
- Verify
sol-rpc-routertarget is UP - Query metrics:
rpc_requests_total
Grafana Setup
Quick Start with Docker Compose
The repository includes a complete Grafana setup with provisioned datasources and dashboards. Createdocker-compose.yml:
http://localhost:3000 (default credentials: admin/admin)
Datasource Configuration
The repository includes automatic Prometheus datasource provisioning atgrafana/provisioning/datasources/datasource.yml:
Dashboard Provisioning
Dashboards are automatically loaded fromgrafana/provisioning/dashboards/dashboard.yml:
Pre-Built Dashboard
The router includes a comprehensive Grafana dashboard atgrafana/dashboards/sol-rpc-router.json.
Dashboard Panels
Overall Performance
Total Requests Per SecondBackend Monitoring
RPS by BackendWebSocket Section
WS Active ConnectionsDashboard Features
- Auto-refresh: Updates every 5 seconds
- Time range: Last 15 minutes by default
- Templating: Uses Prometheus datasource variable for easy switching
- Sections: Organized into HTTP and WebSocket metrics
Useful Queries
Request Rate Analysis
Latency Analysis
Backend Health
WebSocket Monitoring
Rate Limiting
Alerting
Prometheus Alert Rules
Createalerts.yml:
prometheus.yml:
Health Check Endpoint
The router exposes a health check endpoint at/health that returns detailed backend status:
- Load balancer health checks
- Kubernetes liveness/readiness probes
- External monitoring systems
Next Steps
- Configure hot reload for configuration updates
- Troubleshoot issues using logs and metrics