{
  "editable": true,
  "graphTooltip": 1,
  "id": null,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "panels": [],
      "title": "Overview",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 10
              },
              {
                "color": "red",
                "value": 50
              }
            ]
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 1
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_http_requests_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval]))",
          "legendFormat": "requests/s",
          "refId": "A"
        }
      ],
      "title": "Request Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 1
              },
              {
                "color": "red",
                "value": 5
              }
            ]
          },
          "unit": "percent"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 1
      },
      "id": 3,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "100 * sum(rate(mcp_http_requests_total{namespace=\"$namespace\", pod=~\"$pod\", status_code=~\"5..\"}[$interval])) / sum(rate(mcp_http_requests_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval]))",
          "legendFormat": "error %",
          "refId": "A"
        }
      ],
      "title": "Error Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 3,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.5
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "unit": "s"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 1
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "histogram_quantile(0.95, sum(rate(mcp_http_request_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (le))",
          "legendFormat": "p95",
          "refId": "A"
        }
      ],
      "title": "P95 Latency",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 10
              },
              {
                "color": "red",
                "value": 50
              }
            ]
          },
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 1
      },
      "id": 5,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "sum(mcp_http_requests_in_progress{namespace=\"$namespace\", pod=~\"$pod\"})",
          "legendFormat": "in-flight",
          "refId": "A"
        }
      ],
      "title": "Active Requests",
      "type": "stat"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "id": 10,
      "panels": [],
      "title": "HTTP Metrics (RED Pattern)",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 6
      },
      "id": 11,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_http_requests_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (endpoint)",
          "legendFormat": "{{endpoint}}",
          "refId": "A"
        }
      ],
      "title": "Request Rate by Endpoint",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 6
      },
      "id": 12,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_http_requests_total{namespace=\"$namespace\", pod=~\"$pod\", status_code=~\"4..|5..\"}[$interval])) by (status_code)",
          "legendFormat": "{{status_code}}",
          "refId": "A"
        }
      ],
      "title": "Error Rate by Status Code",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 0,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "s"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 14
      },
      "id": 13,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "histogram_quantile(0.50, sum(rate(mcp_http_request_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (le))",
          "legendFormat": "p50",
          "refId": "A"
        },
        {
          "expr": "histogram_quantile(0.95, sum(rate(mcp_http_request_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (le))",
          "legendFormat": "p95",
          "refId": "B"
        },
        {
          "expr": "histogram_quantile(0.99, sum(rate(mcp_http_request_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (le))",
          "legendFormat": "p99",
          "refId": "C"
        }
      ],
      "title": "Latency Percentiles",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 14
      },
      "id": 14,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "percent"
          ],
          "displayMode": "table",
          "placement": "right"
        },
        "pieType": "donut"
      },
      "targets": [
        {
          "expr": "sum(increase(mcp_http_requests_total{namespace=\"$namespace\", pod=~\"$pod\"}[$__range])) by (status_code)",
          "legendFormat": "{{status_code}}",
          "refId": "A"
        }
      ],
      "title": "Status Code Distribution",
      "type": "piechart"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 22
      },
      "id": 20,
      "panels": [],
      "title": "MCP Tools",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-GrYlRd"
          },
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 23
      },
      "id": 21,
      "options": {
        "displayMode": "gradient",
        "orientation": "horizontal",
        "showUnfilled": true
      },
      "targets": [
        {
          "expr": "topk(10, sum(increase(mcp_tool_calls_total{namespace=\"$namespace\", pod=~\"$pod\"}[$__range])) by (tool_name))",
          "legendFormat": "{{tool_name}}",
          "refId": "A"
        }
      ],
      "title": "Top Tools by Call Volume",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 23
      },
      "id": 22,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_tool_calls_total{namespace=\"$namespace\", pod=~\"$pod\", status=\"error\"}[$interval])) by (tool_name)",
          "legendFormat": "{{tool_name}}",
          "refId": "A"
        }
      ],
      "title": "Tool Error Rate",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 0,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "s"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 31
      },
      "id": 23,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "histogram_quantile(0.95, sum(rate(mcp_tool_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (tool_name, le))",
          "legendFormat": "{{tool_name}}",
          "refId": "A"
        }
      ],
      "title": "Tool Execution Duration (P95)",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 39
      },
      "id": 30,
      "panels": [],
      "title": "Nextcloud API",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 40
      },
      "id": 31,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_nextcloud_api_requests_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (app)",
          "legendFormat": "{{app}}",
          "refId": "A"
        }
      ],
      "title": "API Calls by App",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 0,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "s"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 40
      },
      "id": 32,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "histogram_quantile(0.95, sum(rate(mcp_nextcloud_api_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (app, le))",
          "legendFormat": "{{app}}",
          "refId": "A"
        }
      ],
      "title": "API Latency by App (P95)",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 48
      },
      "id": 33,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_nextcloud_api_retries_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (reason)",
          "legendFormat": "{{reason}}",
          "refId": "A"
        }
      ],
      "title": "API Retries by Reason",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 1
              },
              {
                "color": "red",
                "value": 5
              }
            ]
          },
          "unit": "percent"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 48
      },
      "id": 34,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "100 * sum(rate(mcp_nextcloud_api_requests_total{namespace=\"$namespace\", pod=~\"$pod\", status_code=~\"5..\"}[$interval])) / sum(rate(mcp_nextcloud_api_requests_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval]))",
          "legendFormat": "error %",
          "refId": "A"
        }
      ],
      "title": "API Error Rate",
      "type": "stat"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 56
      },
      "id": 40,
      "panels": [],
      "title": "OAuth & Authentication",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 57
      },
      "id": 41,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_oauth_token_validations_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (status)",
          "legendFormat": "{{status}}",
          "refId": "A"
        }
      ],
      "title": "Token Validations",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 57
      },
      "id": 42,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_oauth_token_exchange_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (status)",
          "legendFormat": "{{status}}",
          "refId": "A"
        }
      ],
      "title": "Token Exchange Operations",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "yellow",
                "value": 50
              },
              {
                "color": "green",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 65
      },
      "id": 43,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "100 * sum(rate(mcp_oauth_token_cache_hits_total{namespace=\"$namespace\", pod=~\"$pod\", result=\"hit\"}[$interval])) / sum(rate(mcp_oauth_token_cache_hits_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval]))",
          "legendFormat": "hit %",
          "refId": "A"
        }
      ],
      "title": "Token Cache Hit Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "reqps"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 65
      },
      "id": 44,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_oauth_refresh_token_operations_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (operation)",
          "legendFormat": "{{operation}}",
          "refId": "A"
        }
      ],
      "title": "Refresh Token Operations",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 73
      },
      "id": 50,
      "panels": [],
      "title": "Dependencies & Health",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [
            {
              "options": {
                "0": {
                  "color": "red",
                  "text": "DOWN"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "1": {
                  "color": "green",
                  "text": "UP"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          },
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 74
      },
      "id": 51,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "mcp_dependency_health{namespace=\"$namespace\", pod=~\"$pod\", dependency=\"nextcloud\"}",
          "legendFormat": "status",
          "refId": "A"
        }
      ],
      "title": "Nextcloud Health",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [
            {
              "options": {
                "0": {
                  "color": "red",
                  "text": "DOWN"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "1": {
                  "color": "green",
                  "text": "UP"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          },
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 74
      },
      "id": 52,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "mcp_dependency_health{namespace=\"$namespace\", pod=~\"$pod\", dependency=\"qdrant\"}",
          "legendFormat": "status",
          "refId": "A"
        }
      ],
      "title": "Qdrant Health",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [
            {
              "options": {
                "0": {
                  "color": "red",
                  "text": "DOWN"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "1": {
                  "color": "green",
                  "text": "UP"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          },
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 74
      },
      "id": 53,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "mcp_dependency_health{namespace=\"$namespace\", pod=~\"$pod\", dependency=\"keycloak\"}",
          "legendFormat": "status",
          "refId": "A"
        }
      ],
      "title": "Keycloak Health",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [
            {
              "options": {
                "0": {
                  "color": "red",
                  "text": "DOWN"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "1": {
                  "color": "green",
                  "text": "UP"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          },
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 74
      },
      "id": 54,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "values": false
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "mcp_dependency_health{namespace=\"$namespace\", pod=~\"$pod\", dependency=\"unstructured\"}",
          "legendFormat": "status",
          "refId": "A"
        }
      ],
      "title": "Unstructured API Health",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 0,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "s"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 78
      },
      "id": 55,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "mcp_dependency_check_duration_seconds{namespace=\"$namespace\", pod=~\"$pod\"}",
          "legendFormat": "{{dependency}}",
          "refId": "A"
        }
      ],
      "title": "Health Check Duration",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 0,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "s"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 78
      },
      "id": 56,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "histogram_quantile(0.95, sum(rate(mcp_db_operation_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (db, operation, le))",
          "legendFormat": "{{db}}/{{operation}}",
          "refId": "A"
        }
      ],
      "title": "Database Operation Latency",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 86
      },
      "id": 60,
      "panels": [],
      "title": "Vector Sync (when enabled)",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "ops"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 87
      },
      "id": 61,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_vector_sync_documents_processed_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (status)",
          "legendFormat": "{{status}}",
          "refId": "A"
        }
      ],
      "title": "Documents Processed Rate",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "max": 200,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 50
              },
              {
                "color": "red",
                "value": 100
              }
            ]
          },
          "unit": "short"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 87
      },
      "id": 62,
      "options": {
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "targets": [
        {
          "expr": "mcp_vector_sync_queue_size{namespace=\"$namespace\", pod=~\"$pod\"}",
          "legendFormat": "queue",
          "refId": "A"
        }
      ],
      "title": "Processing Queue Depth",
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "ops"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 95
      },
      "id": 63,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "sum(rate(mcp_qdrant_operations_total{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (operation)",
          "legendFormat": "{{operation}}",
          "refId": "A"
        }
      ],
      "title": "Qdrant Operations",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 0,
            "lineInterpolation": "smooth",
            "showPoints": "never"
          },
          "unit": "s"
        }
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 95
      },
      "id": 64,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        }
      },
      "targets": [
        {
          "expr": "histogram_quantile(0.95, sum(rate(mcp_vector_sync_processing_duration_seconds_bucket{namespace=\"$namespace\", pod=~\"$pod\"}[$interval])) by (le))",
          "legendFormat": "p95",
          "refId": "A"
        }
      ],
      "title": "Document Processing Duration (P95)",
      "type": "timeseries"
    }
  ],
  "refresh": "30s",
  "tags": [
    "nextcloud-mcp-server",
    "operations",
    "kubernetes",
    "mcp"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "Prometheus",
          "value": "prometheus"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "$datasource"
        },
        "hide": 0,
        "includeAll": true,
        "multi": false,
        "name": "namespace",
        "options": [],
        "query": "label_values(mcp_http_requests_total, namespace)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "$datasource"
        },
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "pod",
        "options": [],
        "query": "label_values(mcp_http_requests_total{namespace=\"$namespace\"}, pod)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "text": "5m",
          "value": "5m"
        },
        "hide": 0,
        "name": "interval",
        "options": [
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": true,
            "text": "5m",
            "value": "5m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          }
        ],
        "query": "1m,5m,10m,30m,1h",
        "refresh": 0,
        "skipUrlSync": false,
        "type": "interval"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timezone": "browser",
  "title": "Nextcloud MCP Server - Operations",
  "uid": "nextcloud-mcp-server",
  "version": 1
}
