Skip to content

Commit 2da9377

Browse files
committed
feat: update README with new wallet balance metrics and monitoring instructions
1 parent b007d78 commit 2da9377

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

apps/price_pusher/README.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ The following metrics are available:
271271
- **pyth_price_last_published_time**: The last published time of a price feed in unix timestamp
272272
- **pyth_price_updates_total**: Total number of price updates pushed to the chain
273273
- **pyth_price_update_duration_seconds**: Duration of price update operations in seconds
274-
- **pyth_active_price_feeds**: Number of active price feeds being monitored
274+
- **pyth_price_feeds_total**: Total number of price feeds being monitored
275275
- **pyth_price_update_errors_total**: Total number of errors encountered during price updates
276276
- **pyth_price_update_attempts_total**: Total number of price update attempts
277+
- **pyth_wallet_balance**: Current wallet balance of the price pusher in native token units
277278

278279
### Configuration
279280

@@ -290,7 +291,21 @@ node lib/index.js evm --config config.evm.mainnet.json --metrics-port 9091
290291

291292
### Running Locally with Docker
292293

293-
You can run a local Prometheus instance to test the metrics:
294+
You can run the monitoring stack (Prometheus and Grafana) using the provided docker-compose configuration:
295+
296+
1. Use the sample docker-compose file for metrics:
297+
298+
```bash
299+
docker-compose -f docker-compose.metrics.sample.yaml up
300+
```
301+
302+
This will start:
303+
- Prometheus server on port 9090 with the alerts configured in alerts.yml
304+
- Grafana server on port 3000 with default credentials (admin/admin)
305+
306+
The docker-compose.metrics.sample.yaml file also includes commented examples of price_pusher services for different blockchains that you can uncomment and customize for your specific needs.
307+
308+
Alternatively, if you prefer to set up the monitoring stack manually:
294309

295310
1. Create a `prometheus.yml` file:
296311

@@ -309,6 +324,7 @@ scrape_configs:
309324
```bash
310325
docker run -d --name prometheus -p 9090:9090 \
311326
-v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
327+
-v $(pwd)/alerts.yml:/etc/prometheus/alerts.yml \
312328
prom/prometheus
313329
```
314330

@@ -347,3 +363,30 @@ time() - pyth_price_last_published_time > 3600
347363
```
348364
rate(pyth_price_update_duration_seconds_sum[5m]) / rate(pyth_price_update_duration_seconds_count[5m])
349365
```
366+
367+
5. Monitor wallet balances:
368+
369+
```
370+
pyth_wallet_balance
371+
```
372+
373+
6. Detect low wallet balances (below 0.1 tokens):
374+
375+
```
376+
pyth_wallet_balance < 0.1
377+
```
378+
379+
### Alerting
380+
381+
The price pusher includes pre-configured Prometheus alerting rules in the `alerts.yml` file. These rules monitor various aspects of the price pusher's operation, including:
382+
383+
- Price feeds not being updated for an extended period (>1 hour)
384+
- High error rates in price updates
385+
- No recent price updates across all feeds
386+
- Service availability
387+
- High update durations
388+
- Low wallet balances with two severity levels:
389+
- Warning: Balance below 0.1 native tokens
390+
- Critical: Balance below 0.01 native tokens (transactions may fail soon)
391+
392+
When using the docker-compose setup, these alerts are automatically loaded into Prometheus and can be viewed in the Alerting section of Grafana after setting up the Prometheus data source.

0 commit comments

Comments
 (0)