Skip to content

Commit afa4a0f

Browse files
committed
refactor(metrics): remove target timestamp metric and update last published time logic
1 parent ff853d0 commit afa4a0f

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

apps/price_pusher/src/controller.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ export class Controller {
5353
const sourceLatestPrice =
5454
this.sourcePriceListener.getLatestPriceInfo(priceId);
5555

56-
// Update metrics for the last published time if available
57-
if (this.metrics && targetLatestPrice) {
58-
this.metrics.updateLastPublishedTime(
59-
priceId,
60-
alias,
61-
targetLatestPrice,
62-
);
63-
}
64-
6556
if (this.metrics && targetLatestPrice && sourceLatestPrice) {
6657
this.metrics.updateTimestamps(
6758
priceId,

apps/price_pusher/src/metrics.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Registry, Counter, Gauge } from "prom-client";
22
import express from "express";
3-
import { PriceInfo } from "./interface";
43
import { Logger } from "pino";
54
import { UpdateCondition } from "./price-config";
65

@@ -15,7 +14,6 @@ export class PricePusherMetrics {
1514
public priceUpdateAttempts: Counter<string>;
1615
public priceFeedsTotal: Gauge<string>;
1716
public sourceTimestamp: Gauge<string>;
18-
public targetTimestamp: Gauge<string>;
1917
public configuredTimeDifference: Gauge<string>;
2018
// Wallet metrics
2119
public walletBalance: Gauge<string>;
@@ -56,13 +54,6 @@ export class PricePusherMetrics {
5654
registers: [this.registry],
5755
});
5856

59-
this.targetTimestamp = new Gauge({
60-
name: "pyth_target_timestamp",
61-
help: "Latest target chain price publish timestamp",
62-
labelNames: ["price_id", "alias"],
63-
registers: [this.registry],
64-
});
65-
6657
this.configuredTimeDifference = new Gauge({
6758
name: "pyth_configured_time_difference",
6859
help: "Configured time difference threshold between source and target chains",
@@ -92,18 +83,6 @@ export class PricePusherMetrics {
9283
});
9384
}
9485

95-
// Update the last published time for a price feed
96-
public updateLastPublishedTime(
97-
priceId: string,
98-
alias: string,
99-
priceInfo: PriceInfo,
100-
): void {
101-
this.lastPublishedTime.set(
102-
{ price_id: priceId, alias },
103-
priceInfo.publishTime,
104-
);
105-
}
106-
10786
// Record a successful price update
10887
public recordPriceUpdate(
10988
priceId: string,
@@ -169,7 +148,7 @@ export class PricePusherMetrics {
169148
{ price_id: priceId, alias },
170149
sourceLatestPricePublishTime,
171150
);
172-
this.targetTimestamp.set(
151+
this.lastPublishedTime.set(
173152
{ price_id: priceId, alias },
174153
targetLatestPricePublishTime,
175154
);

0 commit comments

Comments
 (0)