{
  "__inputs": [],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "12.4.0"
    },
    {
      "type": "datasource",
      "id": "loki",
      "name": "Loki",
      "version": "1.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": false,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "loki",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "Log Lines / min",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "tooltip": false,
              "viz": false,
              "legend": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "sum by (container) (count_over_time({container=~\"mvp-.*\"}[1m]))",
          "legendFormat": "{{container}}",
          "refId": "A"
        }
      ],
      "title": "Container Log Volume Over Time",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 1
              },
              {
                "color": "red",
                "value": 5
              }
            ]
          },
          "unit": "percent",
          "decimals": 2
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 8,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "values": false,
          "calcs": [
            "lastNotNull"
          ],
          "fields": ""
        },
        "textMode": "auto"
      },
      "pluginVersion": "12.4.0",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "sum(count_over_time({container=~\"mvp-.*\"} | json | level=\"error\" [5m])) / sum(count_over_time({container=~\"mvp-.*\"}[5m])) * 100",
          "refId": "A"
        }
      ],
      "title": "Error Rate Across All Containers",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "fillOpacity": 80,
            "gradientMode": "none",
            "hideFrom": {
              "tooltip": false,
              "viz": false,
              "legend": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 16,
        "x": 8,
        "y": 8
      },
      "id": 3,
      "options": {
        "barRadius": 0,
        "barWidth": 0.97,
        "fullHighlight": false,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "orientation": "auto",
        "showValue": "auto",
        "stacking": "normal",
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        },
        "xTickLabelRotation": 0,
        "xTickLabelSpacing": 0
      },
      "pluginVersion": "12.4.0",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "sum by (container, level) (count_over_time({container=~\"mvp-.*\"} | json [5m]))",
          "legendFormat": "{{level}}",
          "refId": "A"
        }
      ],
      "title": "Log Level Distribution Per Container",
      "type": "barchart"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 24,
        "x": 0,
        "y": 14
      },
      "id": 4,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "values": false,
          "calcs": [
            "lastNotNull"
          ],
          "fields": ""
        },
        "textMode": "name"
      },
      "pluginVersion": "12.4.0",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-backend(-staging)?\"}[5m])",
          "legendFormat": "mvp-backend",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-frontend(-staging)?\"}[5m])",
          "legendFormat": "mvp-frontend",
          "refId": "B"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-postgres(-staging)?\"}[5m])",
          "legendFormat": "mvp-postgres",
          "refId": "C"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-redis(-staging)?\"}[5m])",
          "legendFormat": "mvp-redis",
          "refId": "D"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-traefik(-staging)?\"}[5m])",
          "legendFormat": "mvp-traefik",
          "refId": "E"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-ocr(-staging)?\"}[5m])",
          "legendFormat": "mvp-ocr",
          "refId": "F"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-loki(-staging)?\"}[5m])",
          "legendFormat": "mvp-loki",
          "refId": "G"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-alloy(-staging)?\"}[5m])",
          "legendFormat": "mvp-alloy",
          "refId": "H"
        },
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-grafana(-staging)?\"}[5m])",
          "legendFormat": "mvp-grafana",
          "refId": "I"
        }
      ],
      "title": "Container Health Status",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "blue"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "Requests / min",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "tooltip": false,
              "viz": false,
              "legend": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 18
      },
      "id": 5,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "count_over_time({container=~\"mvp-backend(-staging)?\"} | json | msg=\"Request processed\" [1m])",
          "legendFormat": "Backend Requests",
          "refId": "A"
        }
      ],
      "title": "Total Request Count Over Time",
      "type": "timeseries"
    }
  ],
  "refresh": "30s",
  "schemaVersion": 39,
  "tags": [
    "overview",
    "logs",
    "containers"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "Loki",
          "value": "Loki"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Datasource",
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "loki",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "Application Overview",
  "uid": "application-overview",
  "version": 1,
  "weekStart": ""
}
