浏览代码

refactor(metrics): remove target timestamp metric and update last published time logic

Daniel Chew 6 月之前
父节点
当前提交
afa4a0fa1d
共有 2 个文件被更改,包括 1 次插入31 次删除
  1. 0 9
      apps/price_pusher/src/controller.ts
  2. 1 22
      apps/price_pusher/src/metrics.ts

+ 0 - 9
apps/price_pusher/src/controller.ts

@@ -53,15 +53,6 @@ export class Controller {
         const sourceLatestPrice =
           this.sourcePriceListener.getLatestPriceInfo(priceId);
 
-        // Update metrics for the last published time if available
-        if (this.metrics && targetLatestPrice) {
-          this.metrics.updateLastPublishedTime(
-            priceId,
-            alias,
-            targetLatestPrice,
-          );
-        }
-
         if (this.metrics && targetLatestPrice && sourceLatestPrice) {
           this.metrics.updateTimestamps(
             priceId,

+ 1 - 22
apps/price_pusher/src/metrics.ts

@@ -1,6 +1,5 @@
 import { Registry, Counter, Gauge } from "prom-client";
 import express from "express";
-import { PriceInfo } from "./interface";
 import { Logger } from "pino";
 import { UpdateCondition } from "./price-config";
 
@@ -15,7 +14,6 @@ export class PricePusherMetrics {
   public priceUpdateAttempts: Counter<string>;
   public priceFeedsTotal: Gauge<string>;
   public sourceTimestamp: Gauge<string>;
-  public targetTimestamp: Gauge<string>;
   public configuredTimeDifference: Gauge<string>;
   // Wallet metrics
   public walletBalance: Gauge<string>;
@@ -56,13 +54,6 @@ export class PricePusherMetrics {
       registers: [this.registry],
     });
 
-    this.targetTimestamp = new Gauge({
-      name: "pyth_target_timestamp",
-      help: "Latest target chain price publish timestamp",
-      labelNames: ["price_id", "alias"],
-      registers: [this.registry],
-    });
-
     this.configuredTimeDifference = new Gauge({
       name: "pyth_configured_time_difference",
       help: "Configured time difference threshold between source and target chains",
@@ -92,18 +83,6 @@ export class PricePusherMetrics {
     });
   }
 
-  // Update the last published time for a price feed
-  public updateLastPublishedTime(
-    priceId: string,
-    alias: string,
-    priceInfo: PriceInfo,
-  ): void {
-    this.lastPublishedTime.set(
-      { price_id: priceId, alias },
-      priceInfo.publishTime,
-    );
-  }
-
   // Record a successful price update
   public recordPriceUpdate(
     priceId: string,
@@ -169,7 +148,7 @@ export class PricePusherMetrics {
       { price_id: priceId, alias },
       sourceLatestPricePublishTime,
     );
-    this.targetTimestamp.set(
+    this.lastPublishedTime.set(
       { price_id: priceId, alias },
       targetLatestPricePublishTime,
     );