4.0 KiB
4.0 KiB
📊 Lumina Explorer - Monitoring & Analytics Setup
Real-time dashboards for Accounts · Assets · Liquidity Pools · Network health
Quick Start
1. Install prom-client
cd api
npm install prom-client
2. Start Monitoring Services
docker compose -f docker-compose.prod.yml up -d prometheus grafana node-exporter cadvisor
3. Access Dashboards
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3001
- Username:
admin - Password:
admin123(change on first login)
- Username:
What You Get
Real-Time Metrics
| Metric | Description | Update Frequency |
|---|---|---|
lumina_account_balance_xlm |
Top whale account balances | Every 10s |
lumina_asset_price_usd |
Asset prices (XLM, USDC, AQUA, etc.) | Every 10s |
lumina_pool_tvl_xlm |
Liquidity pool TVL leaderboard | Every 10s |
lumina_network_tps |
Network transactions per second | Every 10s |
System Metrics
- Node Exporter: CPU, RAM, disk, network
- cAdvisor: Docker container metrics
- Prometheus: All metrics aggregated
Grafana Dashboards
-
Lumina Overview (auto-provisioned)
- Network TPS graph
- Top whale balances
- Asset prices
- Liquidity pool TVL
-
System Health (built-in)
- Container CPU/RAM usage
- Disk I/O
- Network traffic
Adding Custom Metrics
Edit api/api/routes/metrics.js to add your own metrics:
const customMetric = new client.Gauge({
name: 'lumina_custom_metric',
help: 'Your custom metric description',
labelNames: ['label1', 'label2']
});
// Update it
customMetric.set({ label1: 'value1', label2: 'value2' }, 123.45);
Monitoring Top Accounts
To monitor specific accounts, edit api/api/routes/metrics.js:
const accounts = [
'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', // USDC issuer
'YOUR_ACCOUNT_HERE', // Add your accounts
];
Querying Metrics
Prometheus Queries
# Top 10 pools by TVL
topk(10, lumina_pool_tvl_xlm)
# Average TPS over 5 minutes
avg_over_time(lumina_network_tps[5m])
# Total XLM in monitored accounts
sum(lumina_account_balance_xlm)
# Asset price changes
rate(lumina_asset_price_usd[5m])
Grafana Queries
- Go to Grafana → Explore
- Select "Prometheus" datasource
- Enter PromQL query
- Click "Run query"
Alerting (Coming Soon)
Set up alerts for:
- Whale movements (>$10M)
- TPS drops below threshold
- Pool TVL changes
- API errors
Troubleshooting
Metrics Not Appearing
- Check if prom-client is installed:
cd api && npm list prom-client
- Check API logs:
docker compose -f docker-compose.prod.yml logs api | grep METRICS
- Verify metrics endpoint:
curl http://localhost:3000/explorer/public/metrics
Prometheus Not Scraping
-
Check Prometheus targets:
- Go to http://localhost:9090/targets
- All targets should show "UP"
-
Check Prometheus logs:
docker compose -f docker-compose.prod.yml logs prometheus
Grafana Not Loading
- Check Grafana logs:
docker compose -f docker-compose.prod.yml logs grafana
- Verify datasource:
- Go to Grafana → Configuration → Data Sources
- Prometheus should be configured and tested
Performance
- Metrics update: Every 10 seconds
- Scrape interval: 15 seconds (Prometheus)
- Storage: Prometheus stores 15 days by default
- Resource usage: ~200MB RAM per service
Security
Change Default Passwords
- Grafana: Change on first login or set via environment:
environment:
- GF_SECURITY_ADMIN_PASSWORD=your_secure_password
- Expose only via reverse proxy in production:
- Add to nginx.conf
- Use authentication
- Enable HTTPS only
Next Steps
- Set up alerting rules
- Add custom dashboards
- Monitor specific accounts
- Track historical trends
- Set up alert notifications (Telegram, Slack, etc.)
Your explorer now has institutional-grade monitoring! 📊