diff --git a/apps/price_pusher/README.md b/apps/price_pusher/README.md index 6ddc76aec7..a1c515ab9f 100644 --- a/apps/price_pusher/README.md +++ b/apps/price_pusher/README.md @@ -211,12 +211,12 @@ and the on-chain Pyth contract and deciding whether to push a new price. You can ### Example -For example, to push `BTC/USD` and `BNB/USD` prices on Fantom testnet, run the following command: +For example, to push `BTC/USD` and `BNB/USD` prices on Sonic blaze testnet, run the following command: ```sh pnpm run dev evm \ - --endpoint https://endpoints.omniatech.io/v1/fantom/testnet/public \ - --pyth-contract-address 0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb \ + --endpoint https://rpc.blaze.soniclabs.com \ + --pyth-contract-address 0x2880aB155794e7179c9eE2e38200202908C17B43 \ --price-service-endpoint https://hermes.pyth.network \ --mnemonic-file "./mnemonic" \ --price-config-file "./price-config.stable.sample.yaml" \ @@ -272,6 +272,8 @@ The following metrics are available: - **pyth_price_last_published_time** (Gauge): The last published time of a price feed in unix timestamp, labeled by price_id and alias - **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 - **pyth_price_feeds_total** (Gauge): Total number of price feeds being monitored +- **pyth_source_price** (Gauge): Latest price value from Pyth source, labeled by price_id and alias +- **pyth_target_price** (Gauge): Latest price value from target chain, labeled by price_id and alias - **pyth_wallet_balance** (Gauge): Current wallet balance of the price pusher in native token units, labeled by wallet_address and network ### Configuration @@ -343,6 +345,30 @@ pyth_wallet_balance pyth_wallet_balance < 0.1 ``` +7. Monitor current source price values: + +``` +pyth_source_price +``` + +8. Monitor current target price values: + +``` +pyth_target_price +``` + +9. Compare source vs target price differences: + +``` +abs(pyth_source_price - pyth_target_price) / pyth_source_price * 100 +``` + +10. Detect significant price deviations (>1%): + +``` +abs(pyth_source_price - pyth_target_price) / pyth_source_price * 100 > 1 +``` + ### Dashboard The docker-compose setup includes a pre-configured Grafana dashboard (`grafana-dashboard.sample.json`) that provides monitoring of your price pusher operations. The dashboard includes the following panels: @@ -353,6 +379,8 @@ The docker-compose setup includes a pre-configured Grafana dashboard (`grafana-d - **Price Feeds List**: A table listing all configured price feeds with their details. - **Successful Updates (Current Range)**: Graph showing the number of successful price updates over the current range with timeline. - **Update Conditions Distribution**: Pie chart showing the distribution of update conditions (YES/NO/EARLY) over the selected time range. +- **Source vs Target Price Values**: Graphs showing current price values from both Pyth source and target chains for comparison. +- **Price Deviation Monitoring**: Panels to track price differences between source and target chains. - **Wallet Balance**: Current balance of your wallet in native token units. - **Wallet Balance Over Time**: Graph tracking your wallet balance over time to monitor consumption. - **Failed Updates (Current Range)**: Graph showing the number of failed price updates over the current range with timeline. diff --git a/apps/price_pusher/package.json b/apps/price_pusher/package.json index d0bc049495..38f4442f88 100644 --- a/apps/price_pusher/package.json +++ b/apps/price_pusher/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/price-pusher", - "version": "10.0.0", + "version": "10.1.0", "description": "Pyth Price Pusher", "homepage": "https://pyth.network", "main": "lib/index.js", diff --git a/apps/price_pusher/src/controller.ts b/apps/price_pusher/src/controller.ts index ffedd414f0..1a1538e95e 100644 --- a/apps/price_pusher/src/controller.ts +++ b/apps/price_pusher/src/controller.ts @@ -61,6 +61,12 @@ export class Controller { sourceLatestPrice.publishTime, priceConfig.timeDifference, ); + this.metrics.updatePriceValues( + priceId, + alias, + sourceLatestPrice.price, + targetLatestPrice.price, + ); } const priceShouldUpdate = shouldUpdate( diff --git a/apps/price_pusher/src/metrics.ts b/apps/price_pusher/src/metrics.ts index 700c6e979b..abea497d3a 100644 --- a/apps/price_pusher/src/metrics.ts +++ b/apps/price_pusher/src/metrics.ts @@ -15,6 +15,8 @@ export class PricePusherMetrics { public priceFeedsTotal: Gauge; public sourceTimestamp: Gauge; public configuredTimeDifference: Gauge; + public sourcePriceValue: Gauge; + public targetPriceValue: Gauge; // Wallet metrics public walletBalance: Gauge; @@ -61,6 +63,20 @@ export class PricePusherMetrics { registers: [this.registry], }); + this.sourcePriceValue = new Gauge({ + name: "pyth_source_price", + help: "Latest price value from Pyth source", + labelNames: ["price_id", "alias"], + registers: [this.registry], + }); + + this.targetPriceValue = new Gauge({ + name: "pyth_target_price", + help: "Latest price value from target chain", + labelNames: ["price_id", "alias"], + registers: [this.registry], + }); + // Wallet balance metric this.walletBalance = new Gauge({ name: "pyth_wallet_balance", @@ -158,6 +174,27 @@ export class PricePusherMetrics { ); } + // Update price values + public updatePriceValues( + priceId: string, + alias: string, + sourcePrice: string | undefined, + targetPrice: string | undefined, + ): void { + if (sourcePrice !== undefined) { + this.sourcePriceValue.set( + { price_id: priceId, alias }, + Number(sourcePrice), + ); + } + if (targetPrice !== undefined) { + this.targetPriceValue.set( + { price_id: priceId, alias }, + Number(targetPrice), + ); + } + } + // Update wallet balance public updateWalletBalance( walletAddress: string,