From cbe169b0f560da348725f7f489848e0838b79ae5 Mon Sep 17 00:00:00 2001
From: moson <moson@archlinux.org>
Date: Sat, 8 Jul 2023 15:22:22 +0200
Subject: [PATCH] grafana: update AUR dashboard (search requests)

* Remove API Requests panel (no values; replaced by goaurrpc dashboard)
* Add panel to visualize new metrics for search requests
* Set default timespan to 1 day (from 30d)

Ref: archlinux/aurweb@814ccf6b
Signed-off-by: moson <moson@archlinux.org>
---
 roles/grafana/files/dashboards/aur.json | 53 +++++++++++++++++--------
 1 file changed, 37 insertions(+), 16 deletions(-)

diff --git a/roles/grafana/files/dashboards/aur.json b/roles/grafana/files/dashboards/aur.json
index 798d13f6e..19c4f39f5 100644
--- a/roles/grafana/files/dashboards/aur.json
+++ b/roles/grafana/files/dashboards/aur.json
@@ -28,7 +28,7 @@
     {
       "datasource": {
         "type": "prometheus",
-        "uid": "PBFA97CFB590B2093"
+        "uid": "Prometheus"
       },
       "fieldConfig": {
         "defaults": {
@@ -36,6 +36,8 @@
             "mode": "palette-classic"
           },
           "custom": {
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
             "axisLabel": "",
             "axisPlacement": "auto",
             "barAlignment": 0,
@@ -91,7 +93,8 @@
         "legend": {
           "calcs": [],
           "displayMode": "list",
-          "placement": "bottom"
+          "placement": "bottom",
+          "showLegend": true
         },
         "tooltip": {
           "mode": "single",
@@ -102,7 +105,7 @@
         {
           "datasource": {
             "type": "prometheus",
-            "uid": "PBFA97CFB590B2093"
+            "uid": "Prometheus"
           },
           "exemplar": true,
           "expr": "rate(http_requests_total{job=\"aurweb\"}[5m])",
@@ -117,7 +120,7 @@
     {
       "datasource": {
         "type": "prometheus",
-        "uid": "PBFA97CFB590B2093"
+        "uid": "Prometheus"
       },
       "description": "",
       "fieldConfig": {
@@ -126,6 +129,8 @@
             "mode": "palette-classic"
           },
           "custom": {
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
             "axisLabel": "",
             "axisPlacement": "auto",
             "barAlignment": 0,
@@ -181,7 +186,8 @@
         "legend": {
           "calcs": [],
           "displayMode": "list",
-          "placement": "bottom"
+          "placement": "bottom",
+          "showLegend": true
         },
         "tooltip": {
           "mode": "single",
@@ -192,16 +198,31 @@
         {
           "datasource": {
             "type": "prometheus",
-            "uid": "PBFA97CFB590B2093"
+            "uid": "Prometheus"
           },
+          "editorMode": "code",
           "exemplar": true,
-          "expr": "rate(http_api_requests_total{job=\"aurweb\"}[5m])",
+          "expr": "rate(search_requests_total{job=\"aurweb\"}[5m])",
           "interval": "",
-          "legendFormat": "{{ type }} {{ status }}",
+          "legendFormat": "cache-{{ cache }}",
+          "range": true,
           "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "Prometheus"
+          },
+          "editorMode": "builder",
+          "expr": "sum(rate(search_requests_total{job=\"aurweb\"}[5m]))",
+          "hide": false,
+          "instant": false,
+          "legendFormat": "total",
+          "range": true,
+          "refId": "B"
         }
       ],
-      "title": "HTTP API Requests Total",
+      "title": "Search requests",
       "type": "timeseries"
     },
     {
@@ -211,7 +232,7 @@
       "dashes": false,
       "datasource": {
         "type": "prometheus",
-        "uid": "PBFA97CFB590B2093"
+        "uid": "Prometheus"
       },
       "description": "The two different user types, normal and trusted users.",
       "fill": 1,
@@ -240,7 +261,7 @@
         "alertThreshold": true
       },
       "percentage": false,
-      "pluginVersion": "8.5.0-pre",
+      "pluginVersion": "10.0.1",
       "pointradius": 2,
       "points": false,
       "renderer": "flot",
@@ -297,7 +318,7 @@
       "dashes": false,
       "datasource": {
         "type": "prometheus",
-        "uid": "PBFA97CFB590B2093"
+        "uid": "Prometheus"
       },
       "description": "The total AUR packages state listing orphan ,ever updated and updated packages.",
       "fill": 1,
@@ -326,7 +347,7 @@
         "alertThreshold": true
       },
       "percentage": false,
-      "pluginVersion": "8.5.0-pre",
+      "pluginVersion": "10.0.1",
       "pointradius": 2,
       "points": false,
       "renderer": "flot",
@@ -377,15 +398,15 @@
       }
     }
   ],
-  "refresh": false,
-  "schemaVersion": 35,
+  "refresh": "",
+  "schemaVersion": 38,
   "style": "dark",
   "tags": [],
   "templating": {
     "list": []
   },
   "time": {
-    "from": "now-30d",
+    "from": "now-1d",
     "to": "now"
   },
   "timepicker": {},
-- 
GitLab