{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Single-tenant dashboard for requests, file I/O, quota, SSE/events, dedicated DB resources, and tenant-attributed failures.",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": null,
  "links": [
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": false,
      "keepTime": true,
      "targetBlank": false,
      "title": "Server Overview",
      "type": "link",
      "url": "/d/drive9-server-overview"
    },
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "targetBlank": false,
      "title": "Organization Overview",
      "type": "link",
      "url": "/d/drive9-organization-overview"
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "panels": [],
      "title": "Tenant Summary",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Requests attributed to the selected tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 1
      },
      "id": 2,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_tenant_requests_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "requests/s",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Request Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Server-error ratio for the selected tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "percentunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 1
      },
      "id": 3,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_tenant_requests_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",status_class=\"5xx\"}[$__rate_interval])) / clamp_min(sum(rate(drive9_tenant_requests_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval])), 0.000001)",
          "legendFormat": "5xx",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "5xx Ratio",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Current tenant-attributed in-flight work.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 1
      },
      "id": 4,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(drive9_tenant_inflight_requests{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "in-flight",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "In-flight Requests",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Confirmed logical storage from the latest tenant quota snapshot.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 1
      },
      "id": 5,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"confirmed\"})",
          "legendFormat": "confirmed",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Confirmed Storage",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Confirmed plus reserved storage divided by a present positive limit.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "percentunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 5
      },
      "id": 6,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "((sum(max by (state) (drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=~\"confirmed|reserved\"})) / max(drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"limit\"})) and (max(drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"limit\"}) > 0))",
          "legendFormat": "usage",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Storage Usage Ratio",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "In-flight quota reservation bytes.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 5
      },
      "id": 7,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"reserved\"})",
          "legendFormat": "reserved",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Reserved Storage",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Current event-stream connections for this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 5
      },
      "id": 8,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(drive9_sse_inflight_connections{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "connections",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE In-flight",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Dedicated role=user DB connections. No data is expected for native_shared tenants.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 5
      },
      "id": 9,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(drive9_db_pool_connections{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"open\"}) or on() (0 * sum(drive9_db_pool_registered{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}))",
          "legendFormat": "open",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Dedicated DB Open",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Tenant-attributed request rate by status class.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 9
      },
      "id": 10,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (status_class) (rate(drive9_tenant_requests_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{status_class}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Request Outcomes",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Missing quota snapshots remain no data rather than false zero.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 9
      },
      "id": 11,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max by (state) (drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "{{state}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Storage State",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 17
      },
      "id": 12,
      "panels": [],
      "title": "Requests and File I/O",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "The request counter is tenant-attributed for data-plane surfaces and control-plane errors.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 18
      },
      "id": 13,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (surface, action, status_class) (rate(drive9_tenant_requests_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{surface}} / {{action}} / {{status_class}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Requests by Surface and Action",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Per-surface workload shape for the selected tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 18
      },
      "id": 14,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (surface) (rate(drive9_tenant_requests_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{surface}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Request Rate by Surface",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Logical bytes attributed to reads and writes for this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "Bps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 26
      },
      "id": 15,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (direction) (rate(drive9_tenant_file_bytes_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{direction}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Logical File I/O",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Current tenant in-flight work by surface.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 26
      },
      "id": 16,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (surface) (drive9_tenant_inflight_requests{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "{{surface}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "In-flight by Surface",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 34
      },
      "id": 17,
      "panels": [],
      "title": "Storage Quota and Usage",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "No data means no positive limit gauge is currently published.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 35
      },
      "id": 18,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"limit\"})",
          "legendFormat": "limit",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Storage Limit",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Confirmed, reserved, and limit gauges for the selected tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 35
      },
      "id": 22,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max by (state) (drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "{{state}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Storage Usage and Limit",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Ratio is absent when a positive storage limit is absent.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "percentunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 35
      },
      "id": 23,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "((sum(max by (state) (drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=~\"confirmed|reserved\"})) / max(drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"limit\"})) and (max(drive9_tenant_storage_bytes{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"limit\"}) > 0))",
          "legendFormat": "usage",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Storage Usage Ratio Trend",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 43
      },
      "id": 51,
      "panels": [],
      "title": "File Count",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Confirmed logical file count from the central file metadata shadow; in-flight upload reservations are excluded until they complete. Refreshed by the shard owner's tenant maintenance loop (default 5 minutes), not on the request path.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 0,
        "y": 44
      },
      "id": 52,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(max by (storage_type) (drive9_tenant_file_count{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"confirmed\"}))",
          "legendFormat": "files",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Confirmed Files",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "db9/s3 split appears once the storage tier scan completes and the per-tier counts reconcile with the confirmed total; before that only the \"all\" series exists.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 18,
        "x": 6,
        "y": 44
      },
      "id": 53,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max by (storage_type) (drive9_tenant_file_count{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"confirmed\"})",
          "legendFormat": "{{storage_type}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "File Count by Storage Tier",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 52
      },
      "id": 26,
      "panels": [],
      "title": "Events and SSE",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Current open event streams.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 53
      },
      "id": 27,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(drive9_sse_inflight_connections{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "connections",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE Connections",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Connection lifecycle events per second.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 53
      },
      "id": 28,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_sse_connections_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "connections/s",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE Connection Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Reset events sent per second.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 53
      },
      "id": 29,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_sse_resets_sent_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "resets/s",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE Reset Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Most recently published fs_events row count.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 53
      },
      "id": 30,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_fs_events_rows{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "rows",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "fs_events Rows",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Connection closures grouped by reason.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 57
      },
      "id": 31,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (reason) (rate(drive9_sse_connections_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{reason}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE Connection Outcomes",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Replay/reset startup latency is tenant-attributed independently from HTTP request latency.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 57
      },
      "id": 32,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "histogram_quantile(0.95, sum by (le) (rate(drive9_sse_phase1_duration_seconds_bucket{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE Phase-1 P95",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "File-change events delivered by operation.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 65
      },
      "id": 33,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (op) (rate(drive9_sse_events_sent_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{op}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE Events Sent",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Reset reasons for this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 65
      },
      "id": 34,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (reason) (rate(drive9_sse_resets_sent_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{reason}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "SSE Reset Reasons",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 73
      },
      "id": 35,
      "panels": [],
      "title": "Dedicated Tenant Database",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Dedicated role=user pools for this tenant. Native_shared tenants do not emit a tenant-specific DB pool.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 74
      },
      "id": 36,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(drive9_db_pool_registered{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "pools",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Registered DB Pools",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Open dedicated DB connections.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 74
      },
      "id": 37,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(drive9_db_pool_connections{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"open\"}) or on() (0 * sum(drive9_db_pool_registered{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}))",
          "legendFormat": "open",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Open Connections",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "In-use dedicated DB connections.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 74
      },
      "id": 38,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(drive9_db_pool_connections{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",state=\"in_use\"}) or on() (0 * sum(drive9_db_pool_registered{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}))",
          "legendFormat": "in-use",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "In-use Connections",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Wait events appear after this pool has observed contention.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 74
      },
      "id": 39,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_db_pool_wait_count_total{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval])) or on() (0 * sum(drive9_db_pool_registered{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}))",
          "legendFormat": "waits/s",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "DB Wait Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Available per-tenant states are open and in_use; max_open is role-level only.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 78
      },
      "id": 40,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (state) (drive9_db_pool_connections{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"})",
          "legendFormat": "{{state}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Dedicated DB Connections",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Connection wait and recycling activity for this tenant pool.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 78
      },
      "id": 41,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_db_pool_wait_count_total{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "waits/s",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (reason) (rate(drive9_db_pool_closes_total{role=\"user\",tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "close {{reason}}",
          "range": true,
          "refId": "B"
        }
      ],
      "title": "Dedicated DB Wait and Close",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 86
      },
      "id": 42,
      "panels": [],
      "title": "Failures and Recovery",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Tenant-attributed service operation failures.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 0,
        "y": 87
      },
      "id": 43,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_tenant_operation_failures_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "failures/s",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Failure Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Pending central quota mutations for this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 6,
        "y": 87
      },
      "id": 44,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_service_gauge{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",component=\"mutation_replay\",name=\"pending_mutations\"})",
          "legendFormat": "pending",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Mutation Backlog",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Age of the oldest pending mutation.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 12,
        "y": 87
      },
      "id": 45,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_service_gauge{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",component=\"mutation_replay\",name=\"oldest_pending_age_seconds\"})",
          "legendFormat": "oldest",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Oldest Pending Mutation",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Tenant failures emitted by quota-related components.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 18,
        "y": 87
      },
      "id": 46,
      "options": {
        "colorMode": "none",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(rate(drive9_tenant_operation_failures_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",component=~\"server_quota|quota_config_cache|mutation_replay\"}[$__rate_interval]))",
          "legendFormat": "failures/s",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Quota Failure Rate",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Stable failure results attributed to this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 91
      },
      "id": 47,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (component, operation, result) (rate(drive9_tenant_operation_failures_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{component}} / {{operation}} / {{result}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Failures by Component and Operation",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Pending mutation count for this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 91
      },
      "id": 48,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_service_gauge{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",component=\"mutation_replay\",name=\"pending_mutations\"})",
          "legendFormat": "pending",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Mutation Replay Backlog",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Age of the oldest pending mutation for this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 99
      },
      "id": 49,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(drive9_service_gauge{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",component=\"mutation_replay\",name=\"oldest_pending_age_seconds\"})",
          "legendFormat": "oldest",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Mutation Replay Oldest Age",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "Lifecycle events that the metric contract attributes to this tenant.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 99
      },
      "id": 50,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (event, provider, result) (rate(drive9_business_events_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\",event=~\"tenant_provision|tenant_schema_init|tenant_status\"}[$__rate_interval]))",
          "legendFormat": "{{event}} / {{provider}} / {{result}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Tenant Lifecycle Outcomes",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "description": "File read/write ops per second by direction for this tenant (drive9_tenant_file_ops_total; db9 and s3 bill as separate SKUs (pooled vs non-pooled ops units)).",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 107
      },
      "id": 54,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (direction, traffic_path) (rate(drive9_tenant_file_ops_total{tidbcloud_org_id=\"$org\",tenant_id=\"$tenant\"}[$__rate_interval]))",
          "legendFormat": "{{direction}}/{{traffic_path}}",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Logical File Ops",
      "type": "timeseries"
    }
  ],
  "refresh": "30s",
  "schemaVersion": 41,
  "tags": [
    "drive9",
    "prometheus",
    "core",
    "tenant"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Datasource",
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      },
      {
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "definition": "label_values(drive9_organization_tenant_count{tidbcloud_org_id!=\"guest\"}, tidbcloud_org_id)",
        "hide": 0,
        "includeAll": false,
        "label": "TiDB Cloud Org ID",
        "multi": false,
        "name": "org",
        "options": [],
        "query": "label_values(drive9_organization_tenant_count{tidbcloud_org_id!=\"guest\"}, tidbcloud_org_id)",
        "refresh": 1,
        "regex": "",
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "select-a-tenant",
          "value": "select-a-tenant"
        },
        "description": "Enter one exact tenant ID. Panels stay empty until you replace the placeholder. This variable does not run a Prometheus tenant-inventory query.",
        "hide": 0,
        "label": "Tenant ID",
        "name": "tenant",
        "options": [],
        "query": "",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "Drive9 Tenant Overview",
  "uid": "drive9-tenant-overview",
  "version": 1,
  "weekStart": ""
}
