From a263b6506db139ae8c8eedfcccfe0dae9c21fd26 Mon Sep 17 00:00:00 2001
From: kscheidecker <kilian.scheidecker@orange.fr>
Date: Thu, 20 Feb 2025 12:20:27 +0000
Subject: [PATCH] Update dashboards/anyway_logs.json

---
 dashboards/anyway_logs.json | 329 ++++++++++++++++++++++++++++++------
 1 file changed, 278 insertions(+), 51 deletions(-)

diff --git a/dashboards/anyway_logs.json b/dashboards/anyway_logs.json
index 48fae22..32d92b0 100644
--- a/dashboards/anyway_logs.json
+++ b/dashboards/anyway_logs.json
@@ -27,9 +27,45 @@
         "type": "loki",
         "uid": "P8E80F9AEF21F6940"
       },
-      "description": "Total  Count of log lines in the specified time range",
+      "description": "Trips generated over the period of time",
       "fieldConfig": {
         "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisBorderShow": false,
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
+            "axisLabel": "Trips",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "barWidthFactor": 0.6,
+            "drawStyle": "bars",
+            "fillOpacity": 100,
+            "gradientMode": "hue",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "insertNulls": false,
+            "lineInterpolation": "stepBefore",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "never",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
           "mappings": [
             {
               "options": {
@@ -48,14 +84,6 @@
               {
                 "color": "rgb(31, 255, 7)",
                 "value": null
-              },
-              {
-                "color": "rgb(31, 255, 7)",
-                "value": 10
-              },
-              {
-                "color": "rgb(31, 255, 7)",
-                "value": 50
               }
             ]
           },
@@ -64,29 +92,25 @@
         "overrides": []
       },
       "gridPos": {
-        "h": 3,
-        "w": 12,
+        "h": 6,
+        "w": 13,
         "x": 0,
         "y": 0
       },
       "id": 11,
       "maxDataPoints": 100,
       "options": {
-        "colorMode": "value",
-        "graphMode": "area",
-        "justifyMode": "auto",
-        "orientation": "horizontal",
-        "percentChangeColorMode": "standard",
-        "reduceOptions": {
-          "calcs": [
-            "sum"
-          ],
-          "fields": "",
-          "values": false
+        "legend": {
+          "calcs": [],
+          "displayMode": "list",
+          "placement": "bottom",
+          "showLegend": false
         },
-        "showPercentChange": false,
-        "textMode": "auto",
-        "wideLayout": true
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "single",
+          "sort": "none"
+        }
       },
       "pluginVersion": "11.5.1",
       "targets": [
@@ -95,24 +119,29 @@
             "type": "loki",
             "uid": "P8E80F9AEF21F6940"
           },
-          "editorMode": "code",
-          "expr": "sum(count_over_time(({app=\"anyway\", environment=~\"$environment\"})[$__interval]))",
+          "direction": "backward",
+          "editorMode": "builder",
+          "expr": "sum(count_over_time({app=\"anyway\", environment=~\"$environment\"} |= `Generated a trip` [$__interval]))",
           "hide": false,
+          "legendFormat": "trips generated",
           "queryType": "range",
-          "refId": "A"
+          "refId": "generated trips"
         }
       ],
-      "title": "Total  Count of logs",
-      "type": "stat"
+      "title": "Trips generated",
+      "type": "timeseries"
     },
     {
       "datasource": {
         "type": "loki",
         "uid": "P8E80F9AEF21F6940"
       },
-      "description": "Total Count: of $searchable_pattern in the specified time range",
+      "description": "Successfully generated trips",
       "fieldConfig": {
         "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
           "mappings": [
             {
               "options": {
@@ -130,10 +159,6 @@
               {
                 "color": "green",
                 "value": null
-              },
-              {
-                "color": "red",
-                "value": 80
               }
             ]
           },
@@ -143,17 +168,17 @@
       },
       "gridPos": {
         "h": 3,
-        "w": 12,
-        "x": 12,
+        "w": 4,
+        "x": 13,
         "y": 0
       },
-      "id": 6,
+      "id": 23,
       "maxDataPoints": 100,
       "options": {
         "colorMode": "value",
-        "graphMode": "area",
+        "graphMode": "none",
         "justifyMode": "auto",
-        "orientation": "horizontal",
+        "orientation": "auto",
         "percentChangeColorMode": "standard",
         "reduceOptions": {
           "calcs": [
@@ -173,14 +198,216 @@
             "type": "loki",
             "uid": "P8E80F9AEF21F6940"
           },
-          "editorMode": "code",
-          "expr": "sum(count_over_time(({app=\"anyway\", environment=~\"$environment\"} |~ \"(?i)$searchable_pattern\")[$__interval]))",
+          "direction": "backward",
+          "editorMode": "builder",
+          "expr": "sum(count_over_time({app=\"anyway\", environment=~\"$environment\"} | json |= `Generated a trip` [$__interval]))",
           "hide": false,
           "queryType": "range",
           "refId": "A"
         }
       ],
-      "title": "Total Count: of $searchable_pattern",
+      "title": "Generated Trips",
+      "type": "stat"
+    },
+    {
+      "datasource": {
+        "type": "loki",
+        "uid": "P8E80F9AEF21F6940"
+      },
+      "description": "Detailed distribution of error types",
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            }
+          },
+          "mappings": [
+            {
+              "options": {
+                "match": "null",
+                "result": {
+                  "text": "0"
+                }
+              },
+              "type": "special"
+            }
+          ]
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 6,
+        "w": 7,
+        "x": 17,
+        "y": 0
+      },
+      "id": 22,
+      "maxDataPoints": 100,
+      "options": {
+        "displayLabels": [
+          "value"
+        ],
+        "legend": {
+          "displayMode": "list",
+          "placement": "right",
+          "showLegend": true,
+          "values": []
+        },
+        "pieType": "pie",
+        "reduceOptions": {
+          "calcs": [
+            "sum"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "single",
+          "sort": "none"
+        }
+      },
+      "pluginVersion": "11.5.1",
+      "targets": [
+        {
+          "datasource": {
+            "type": "loki",
+            "uid": "P8E80F9AEF21F6940"
+          },
+          "direction": "backward",
+          "editorMode": "code",
+          "expr": "sum(count_over_time(({app=\"anyway\", environment=~\"$environment\"}\n| json\n| detected_level =~ \"error\"\n| function =~ \"solve_optimization\"\n)[$__interval]))",
+          "hide": false,
+          "legendFormat": "Optimizer",
+          "queryType": "range",
+          "refId": "optimization_errors",
+          "step": ""
+        },
+        {
+          "datasource": {
+            "type": "loki",
+            "uid": "P8E80F9AEF21F6940"
+          },
+          "direction": "backward",
+          "editorMode": "code",
+          "expr": "sum(count_over_time(({app=\"anyway\", environment=~\"$environment\"}\n| json\n| detected_level =~ \"error\"\n| function =~ \"fill_cache\"\n)[$__interval]))",
+          "hide": false,
+          "legendFormat": "Cache",
+          "queryType": "range",
+          "refId": "cache_errors"
+        },
+        {
+          "datasource": {
+            "type": "loki",
+            "uid": "P8E80F9AEF21F6940"
+          },
+          "direction": "backward",
+          "editorMode": "builder",
+          "expr": "sum(count_over_time({app=\"anyway\", environment=~\"$environment\"} | json | detected_level =~ `error` |= `Overpass API` or `overpass API` [$__interval]))",
+          "hide": false,
+          "legendFormat": "Overpass API",
+          "queryType": "range",
+          "refId": "overpass"
+        },
+        {
+          "datasource": {
+            "type": "loki",
+            "uid": "P8E80F9AEF21F6940"
+          },
+          "direction": "backward",
+          "editorMode": "builder",
+          "expr": "sum(count_over_time({app=\"anyway\", environment=~\"$environment\"} | json | detected_level =~ `error` | function !~ `fill_cache` | function !~ `solve_optimization` != `Overpass API` or `overpass API` [$__interval]))",
+          "hide": false,
+          "legendFormat": "Other",
+          "queryType": "range",
+          "refId": "other"
+        }
+      ],
+      "title": "Error detail",
+      "type": "piechart"
+    },
+    {
+      "datasource": {
+        "type": "loki",
+        "uid": "P8E80F9AEF21F6940"
+      },
+      "description": "Total count of log errors",
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "mappings": [
+            {
+              "options": {
+                "match": "null",
+                "result": {
+                  "text": "0"
+                }
+              },
+              "type": "special"
+            }
+          ],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "red",
+                "value": null
+              }
+            ]
+          },
+          "unit": "short"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 3,
+        "w": 4,
+        "x": 13,
+        "y": 3
+      },
+      "id": 6,
+      "maxDataPoints": 100,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "none",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "percentChangeColorMode": "standard",
+        "reduceOptions": {
+          "calcs": [
+            "sum"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "showPercentChange": false,
+        "textMode": "auto",
+        "wideLayout": true
+      },
+      "pluginVersion": "11.5.1",
+      "targets": [
+        {
+          "datasource": {
+            "type": "loki",
+            "uid": "P8E80F9AEF21F6940"
+          },
+          "direction": "backward",
+          "editorMode": "code",
+          "expr": "sum(count_over_time(({app=\"anyway\", environment=~\"$environment\"}\n| json\n| detected_level =~ \"error\"\n)[$__interval]))",
+          "hide": false,
+          "queryType": "range",
+          "refId": "A"
+        }
+      ],
+      "title": "Total error count",
       "type": "stat"
     },
     {
@@ -197,7 +424,7 @@
         "h": 9,
         "w": 24,
         "x": 0,
-        "y": 3
+        "y": 6
       },
       "id": 2,
       "options": {
@@ -266,7 +493,7 @@
         "h": 7,
         "w": 9,
         "x": 0,
-        "y": 12
+        "y": 15
       },
       "id": 19,
       "maxDataPoints": 100,
@@ -332,7 +559,7 @@
         "h": 7,
         "w": 9,
         "x": 9,
-        "y": 12
+        "y": 15
       },
       "id": 20,
       "interval": "1m",
@@ -412,7 +639,7 @@
         "h": 7,
         "w": 6,
         "x": 18,
-        "y": 12
+        "y": 15
       },
       "id": 9,
       "maxDataPoints": 100,
@@ -514,7 +741,7 @@
         "h": 9,
         "w": 12,
         "x": 0,
-        "y": 19
+        "y": 22
       },
       "id": 18,
       "interval": "1m",
@@ -617,7 +844,7 @@
         "h": 9,
         "w": 12,
         "x": 12,
-        "y": 19
+        "y": 22
       },
       "id": 10,
       "maxDataPoints": 100,
@@ -771,7 +998,7 @@
         "h": 8,
         "w": 24,
         "x": 0,
-        "y": 28
+        "y": 31
       },
       "id": 7,
       "maxDataPoints": 100,
@@ -819,7 +1046,7 @@
         "h": 11,
         "w": 24,
         "x": 0,
-        "y": 36
+        "y": 39
       },
       "id": 21,
       "options": {