Browse Source

refactor: update Grafana dashboard expressions and simplify error tracking metrics

Daniel Chew 8 months ago
parent
commit
08ea7dbb65

+ 3 - 3
apps/price_pusher/grafana-dashboard.sample.json

@@ -526,13 +526,13 @@
             "uid": "prometheus"
           },
           "editorMode": "code",
-          "expr": "sum(increase(pyth_price_updates_total[1h]))",
+          "expr": "sum(increase(pyth_price_updates_total[$__range]))",
           "legendFormat": "Updates",
           "range": true,
           "refId": "A"
         }
       ],
-      "title": "Price Updates (Last Hour)",
+      "title": "Price Updates (Current Range)",
       "type": "timeseries"
     },
     {
@@ -909,7 +909,7 @@
             "uid": "prometheus"
           },
           "editorMode": "code",
-          "expr": "sum(increase(pyth_price_update_errors_total[5m]))",
+          "expr": "sum(increase(pyth_price_update_errors_total[$__range]))",
           "legendFormat": "Errors",
           "range": true,
           "refId": "A"

+ 1 - 5
apps/price_pusher/src/controller.ts

@@ -121,11 +121,7 @@ export class Controller {
           // Record errors in metrics
           if (this.metrics) {
             for (const config of pricesToPush) {
-              this.metrics.recordPriceUpdateError(
-                config.id,
-                config.alias,
-                error instanceof Error ? error.name : "unknown",
-              );
+              this.metrics.recordPriceUpdateError(config.id, config.alias);
             }
           }
         }

+ 2 - 7
apps/price_pusher/src/metrics.ts

@@ -51,7 +51,7 @@ export class PricePusherMetrics {
     this.priceUpdateErrors = new Counter({
       name: "pyth_price_update_errors_total",
       help: "Total number of errors encountered during price updates",
-      labelNames: ["price_id", "alias", "error_type"],
+      labelNames: ["price_id", "alias"],
       registers: [this.registry],
     });
 
@@ -116,15 +116,10 @@ export class PricePusherMetrics {
   }
 
   // Record a price update error
-  public recordPriceUpdateError(
-    priceId: string,
-    alias: string,
-    errorType: string,
-  ): void {
+  public recordPriceUpdateError(priceId: string, alias: string): void {
     this.priceUpdateErrors.inc({
       price_id: priceId,
       alias,
-      error_type: errorType,
     });
   }