@@ -14,6 +14,7 @@ export class PricePusherMetrics {
14
14
public lastPublishedTime : Gauge < string > ;
15
15
public priceUpdateAttempts : Counter < string > ;
16
16
public priceFeedsTotal : Gauge < string > ;
17
+ public priceUpdateDelay : Gauge < string > ;
17
18
// Wallet metrics
18
19
public walletBalance : Gauge < string > ;
19
20
@@ -46,6 +47,13 @@ export class PricePusherMetrics {
46
47
registers : [ this . registry ] ,
47
48
} ) ;
48
49
50
+ this . priceUpdateDelay = new Gauge ( {
51
+ name : "pyth_price_update_delay" ,
52
+ help : "Delay between source and target timestamps relative to configured threshold (positive means over threshold)" ,
53
+ labelNames : [ "price_id" , "alias" ] ,
54
+ registers : [ this . registry ] ,
55
+ } ) ;
56
+
49
57
// Wallet balance metric
50
58
this . walletBalance = new Gauge ( {
51
59
name : "pyth_wallet_balance" ,
@@ -133,6 +141,20 @@ export class PricePusherMetrics {
133
141
this . priceFeedsTotal . set ( count ) ;
134
142
}
135
143
144
+ // Update price delay relative to threshold
145
+ public updatePriceDelay (
146
+ priceId : string ,
147
+ alias : string ,
148
+ targetLatestPricePublishTime : number ,
149
+ sourceLatestPricePublishTime : number ,
150
+ priceConfigTimeDifference : number ,
151
+ ) : void {
152
+ this . priceUpdateDelay . set (
153
+ { price_id : priceId , alias } ,
154
+ sourceLatestPricePublishTime - targetLatestPricePublishTime - priceConfigTimeDifference
155
+ ) ;
156
+ }
157
+
136
158
// Update wallet balance
137
159
public updateWalletBalance (
138
160
walletAddress : string ,
0 commit comments