Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/price_pusher/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 6 additions & 0 deletions apps/price_pusher/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export class Controller {
sourceLatestPrice.publishTime,
priceConfig.timeDifference,
);
this.metrics.updatePriceValues(
priceId,
alias,
sourceLatestPrice.price,
targetLatestPrice.price,
);
}

const priceShouldUpdate = shouldUpdate(
Expand Down
37 changes: 37 additions & 0 deletions apps/price_pusher/src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export class PricePusherMetrics {
public priceFeedsTotal: Gauge<string>;
public sourceTimestamp: Gauge<string>;
public configuredTimeDifference: Gauge<string>;
public sourcePriceValue: Gauge<string>;
public targetPriceValue: Gauge<string>;
// Wallet metrics
public walletBalance: Gauge<string>;

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
Loading