Skip to content

Commit 8ca483b

Browse files
committed
feat: enhance README and alerts configuration with updated metrics and error tracking
1 parent 48bfa09 commit 8ca483b

File tree

2 files changed

+9
-52
lines changed

2 files changed

+9
-52
lines changed

apps/price_pusher/README.md

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,10 @@ The price_pusher now supports Prometheus metrics to monitor the health and perfo
268268

269269
The following metrics are available:
270270

271-
- **pyth_price_last_published_time** (Gauge): The last published time of a price feed in unix timestamp
272-
- **pyth_price_updates_total** (Counter): Total number of price updates pushed to the chain
271+
- **pyth_price_last_published_time** (Gauge): The last published time of a price feed in unix timestamp, labeled by price_id and alias
272+
- **pyth_price_update_attempts_total** (Counter): Total number of price update attempts with their trigger condition and status, labeled by price_id, alias, trigger, and status
273273
- **pyth_price_feeds_total** (Gauge): Total number of price feeds being monitored
274-
- **pyth_price_update_errors_total** (Counter): Total number of errors encountered during price updates
275-
- **pyth_update_conditions_total** (Counter): Count of update condition checks by status (YES/NO/EARLY)
276-
- **pyth_wallet_balance** (Gauge): Current wallet balance of the price pusher in native token units
274+
- **pyth_wallet_balance** (Gauge): Current wallet balance of the price pusher in native token units, labeled by wallet_address and network
277275

278276
### Configuration
279277

@@ -304,37 +302,6 @@ This will start:
304302

305303
The docker-compose.metrics.sample.yaml file includes a pre-configured Grafana dashboard (see the [Dashboard](#dashboard) section below) that displays all the metrics mentioned above. This dashboard provides monitoring of your price pusher operations with panels for configured feeds, active feeds, wallet balance, update statistics, and error tracking. The dashboard is automatically provisioned when you start the stack with docker-compose.
306304

307-
Alternatively, if you prefer to set up the monitoring stack manually:
308-
309-
1. Create a `prometheus.sample.yml` file:
310-
311-
```yaml
312-
global:
313-
scrape_interval: 15s
314-
315-
scrape_configs:
316-
- job_name: "price_pusher"
317-
static_configs:
318-
- targets: ["localhost:9090"]
319-
```
320-
321-
2. Run Prometheus with Docker:
322-
323-
```bash
324-
docker run -d --name prometheus -p 9090:9090 \
325-
-v $(pwd)/prometheus.sample.yml:/etc/prometheus/prometheus.yml \
326-
-v $(pwd)/alerts.sample.yml:/etc/prometheus/alerts.yml \
327-
prom/prometheus
328-
```
329-
330-
3. Run Grafana with Docker:
331-
332-
```bash
333-
docker run -d --name grafana -p 3000:3000 grafana/grafana
334-
```
335-
336-
4. Access Grafana at http://localhost:3000 (default credentials: admin/admin) and add Prometheus as a data source (URL: http://host.docker.internal:9090).
337-
338305
### Example Grafana Queries
339306

340307
Here are some example Grafana queries to monitor your price feeds:
@@ -348,7 +315,7 @@ pyth_price_last_published_time
348315
2. Number of price updates in the last hour:
349316

350317
```
351-
sum(increase(pyth_price_updates_total[1h]))
318+
sum(increase(pyth_price_update_attempts_total{status="success"}[1h]))
352319
```
353320

354321
3. Price feeds not updated in the last hour:
@@ -398,10 +365,9 @@ This dashboard is automatically provisioned when you start the docker-compose st
398365
The price pusher includes pre-configured Prometheus alerting rules in the `alerts.sample.yml` file. These rules monitor various aspects of the price pusher's operation, including:
399366

400367
- Price feeds not being updated for an extended period (>1 hour)
401-
- High error rates in price updates
402-
- No recent price updates across all feeds
403-
- Service availability
404-
- High update durations
368+
- High error rates in price update attempts
369+
- No successful price updates across all feeds in the last 30 minutes
370+
- Service availability monitoring
405371
- Low wallet balances with two severity levels:
406372
- Warning: Balance below 0.1 native tokens
407373
- Critical: Balance below 0.01 native tokens (transactions may fail soon)

apps/price_pusher/alerts.sample.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ groups:
1111
description: "Price feed {{ $labels.alias }} has not been updated for more than 1 hour"
1212

1313
- alert: HighErrorRate
14-
expr: sum(increase(pyth_price_update_errors_total[15m])) > 5
14+
expr: sum(increase(pyth_price_update_attempts_total{status="error"}[15m])) > 5
1515
for: 5m
1616
labels:
1717
severity: warning
@@ -20,7 +20,7 @@ groups:
2020
description: "There have been more than 5 errors in the last 15 minutes"
2121

2222
- alert: NoRecentPriceUpdates
23-
expr: sum(increase(pyth_price_updates_total[30m])) == 0
23+
expr: sum(increase(pyth_price_update_attempts_total{status="success"}[30m])) == 0
2424
for: 5m
2525
labels:
2626
severity: critical
@@ -37,15 +37,6 @@ groups:
3737
summary: "Price pusher service is down"
3838
description: "The price pusher service {{ $labels.instance }} is down"
3939

40-
- alert: HighUpdateDuration
41-
expr: rate(pyth_price_update_duration_seconds_sum[5m]) / rate(pyth_price_update_duration_seconds_count[5m]) > 5
42-
for: 5m
43-
labels:
44-
severity: warning
45-
annotations:
46-
summary: "High update duration"
47-
description: "Price updates are taking longer than 5 seconds on average"
48-
4940
- alert: WalletBalanceLow
5041
expr: pyth_wallet_balance < 0.1
5142
for: 5m

0 commit comments

Comments
 (0)