Skip to content

Commit 08ea7db

Browse files
committed
refactor: update Grafana dashboard expressions and simplify error tracking metrics
1 parent 7cf6259 commit 08ea7db

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

apps/price_pusher/grafana-dashboard.sample.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,13 @@
526526
"uid": "prometheus"
527527
},
528528
"editorMode": "code",
529-
"expr": "sum(increase(pyth_price_updates_total[1h]))",
529+
"expr": "sum(increase(pyth_price_updates_total[$__range]))",
530530
"legendFormat": "Updates",
531531
"range": true,
532532
"refId": "A"
533533
}
534534
],
535-
"title": "Price Updates (Last Hour)",
535+
"title": "Price Updates (Current Range)",
536536
"type": "timeseries"
537537
},
538538
{
@@ -909,7 +909,7 @@
909909
"uid": "prometheus"
910910
},
911911
"editorMode": "code",
912-
"expr": "sum(increase(pyth_price_update_errors_total[5m]))",
912+
"expr": "sum(increase(pyth_price_update_errors_total[$__range]))",
913913
"legendFormat": "Errors",
914914
"range": true,
915915
"refId": "A"

apps/price_pusher/src/controller.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ export class Controller {
121121
// Record errors in metrics
122122
if (this.metrics) {
123123
for (const config of pricesToPush) {
124-
this.metrics.recordPriceUpdateError(
125-
config.id,
126-
config.alias,
127-
error instanceof Error ? error.name : "unknown",
128-
);
124+
this.metrics.recordPriceUpdateError(config.id, config.alias);
129125
}
130126
}
131127
}

apps/price_pusher/src/metrics.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class PricePusherMetrics {
5151
this.priceUpdateErrors = new Counter({
5252
name: "pyth_price_update_errors_total",
5353
help: "Total number of errors encountered during price updates",
54-
labelNames: ["price_id", "alias", "error_type"],
54+
labelNames: ["price_id", "alias"],
5555
registers: [this.registry],
5656
});
5757

@@ -116,15 +116,10 @@ export class PricePusherMetrics {
116116
}
117117

118118
// Record a price update error
119-
public recordPriceUpdateError(
120-
priceId: string,
121-
alias: string,
122-
errorType: string,
123-
): void {
119+
public recordPriceUpdateError(priceId: string, alias: string): void {
124120
this.priceUpdateErrors.inc({
125121
price_id: priceId,
126122
alias,
127-
error_type: errorType,
128123
});
129124
}
130125

0 commit comments

Comments
 (0)