{
 "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": "kvblockd operations: ops/throughput, tier residency (DRAM/NVMe/S3), per-tenant bytes vs quota, cold-tier health, reclaim/demote pressure. Every query uses only the kvb_* families the daemon actually exports (internal/metrics).",
 "editable": true,
 "fiscalYearStartMonth": 0,
 "graphTooltip": 1,
 "links": [],
 "panels": [
  {
   "collapsed": false,
   "gridPos": {
    "h": 1,
    "w": 24,
    "x": 0,
    "y": 0
   },
   "id": 100,
   "panels": [],
   "title": "Ops & throughput",
   "type": "row"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Served requests per second by verb (kvb_op_seconds count rate).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "ops"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 0,
    "y": 1
   },
   "id": 1,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum by (op) (rate(kvb_op_seconds_count[$__rate_interval]))",
     "legendFormat": "{{op}}",
     "refId": "A"
    }
   ],
   "title": "Ops/s by verb",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Block payload bytes per second: in = committed PUTs, out = served GETs (kvb_bytes_total).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "Bps"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 8,
    "y": 1
   },
   "id": 2,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum by (dir) (rate(kvb_bytes_total[$__rate_interval]))",
     "legendFormat": "{{dir}}",
     "refId": "A"
    }
   ],
   "title": "Throughput (payload bytes)",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "BATCH_GET per-key hit ratio across all tiers and tenants (kvb_hits_total vs kvb_misses_total).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 10,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "max": 1,
     "min": 0,
     "unit": "percentunit"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 16,
    "y": 1
   },
   "id": 3,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": false
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum(rate(kvb_hits_total[$__rate_interval])) / (sum(rate(kvb_hits_total[$__rate_interval])) + sum(rate(kvb_misses_total[$__rate_interval])))",
     "legendFormat": "hit ratio",
     "refId": "A"
    }
   ],
   "title": "GET hit ratio",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Mean server-side handling time by verb (decode + store + queue-to-writer; excludes the socket flush). Works on any Prometheus.",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "s"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 12,
    "x": 0,
    "y": 9
   },
   "id": 4,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum by (op) (rate(kvb_op_seconds_sum[$__rate_interval])) / sum by (op) (rate(kvb_op_seconds_count[$__rate_interval]))",
     "legendFormat": "{{op}}",
     "refId": "A"
    }
   ],
   "title": "Op latency: mean by verb",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "p99 from the kvb_op_seconds NATIVE histogram. Requires Prometheus with --enable-feature=native-histograms scraping protobuf; on a classic text scrape this histogram exports no buckets, so this panel shows No data (the mean panel is the fallback).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "s"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 12,
    "x": 12,
    "y": 9
   },
   "id": 5,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "histogram_quantile(0.99, sum by (op) (rate(kvb_op_seconds[$__rate_interval])))",
     "legendFormat": "{{op}} p99",
     "refId": "A"
    }
   ],
   "title": "Op latency: p99 by verb (native histogram)",
   "type": "timeseries"
  },
  {
   "collapsed": false,
   "gridPos": {
    "h": 1,
    "w": 24,
    "x": 0,
    "y": 17
   },
   "id": 200,
   "panels": [],
   "title": "Tier residency (DRAM / NVMe / S3)",
   "type": "row"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Committed blocks resident per tier (kvb_blocks).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 10,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "short"
    },
    "overrides": [
     {
      "matcher": {
       "id": "byName",
       "options": "dram"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "blue",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "nvme"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "green",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "s3"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "purple",
         "mode": "fixed"
        }
       }
      ]
     }
    ]
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 0,
    "y": 18
   },
   "id": 6,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum by (tier) (kvb_blocks)",
     "legendFormat": "{{tier}}",
     "refId": "A"
    }
   ],
   "title": "Blocks by tier",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Committed payload bytes resident per tier (kvb_store_bytes).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 10,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "bytes"
    },
    "overrides": [
     {
      "matcher": {
       "id": "byName",
       "options": "dram"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "blue",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "nvme"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "green",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "s3"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "purple",
         "mode": "fixed"
        }
       }
      ]
     }
    ]
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 8,
    "y": 18
   },
   "id": 7,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum by (tier) (kvb_store_bytes)",
     "legendFormat": "{{tier}}",
     "refId": "A"
    }
   ],
   "title": "Resident bytes by tier",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "DRAM arena occupancy: (total - free) / total from kvb_arena_bytes. Demotion starts at 90%, eviction at 95% (default watermarks).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "thresholds"
     },
     "max": 1,
     "min": 0,
     "thresholds": {
      "mode": "absolute",
      "steps": [
       {
        "color": "green",
        "value": null
       },
       {
        "color": "yellow",
        "value": 0.9
       },
       {
        "color": "red",
        "value": 0.95
       }
      ]
     },
     "unit": "percentunit"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 16,
    "y": 18
   },
   "id": 8,
   "options": {
    "minVizHeight": 75,
    "minVizWidth": 75,
    "orientation": "auto",
    "reduceOptions": {
     "calcs": [
      "lastNotNull"
     ],
     "fields": "",
     "values": false
    },
    "showThresholdLabels": false,
    "showThresholdMarkers": true,
    "sizing": "auto"
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "(kvb_arena_bytes{state=\"total\"} - ignoring(state) kvb_arena_bytes{state=\"free\"}) / ignoring(state) kvb_arena_bytes{state=\"total\"}",
     "legendFormat": "arena occupancy",
     "refId": "A"
    }
   ],
   "title": "DRAM arena occupancy",
   "type": "gauge"
  },
  {
   "collapsed": false,
   "gridPos": {
    "h": 1,
    "w": 24,
    "x": 0,
    "y": 26
   },
   "id": 300,
   "panels": [],
   "title": "Tenants: bytes vs quota",
   "type": "row"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Resident bytes charged to each tenant's tier quota (kvb_tenant_bytes; cardinality is namespaces x 3 tiers by construction).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "bytes"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 12,
    "x": 0,
    "y": 27
   },
   "id": 9,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum by (namespace, tier) (kvb_tenant_bytes{namespace=~\"$namespace\"})",
     "legendFormat": "{{namespace}} / {{tier}}",
     "refId": "A"
    }
   ],
   "title": "Tenant resident bytes by tier",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Quota consumption per (tenant, tier): kvb_tenant_bytes / kvb_tenant_quota_bytes. Unlimited quotas (0) are excluded: no bar means no cap configured.",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "thresholds"
     },
     "max": 1,
     "min": 0,
     "thresholds": {
      "mode": "absolute",
      "steps": [
       {
        "color": "green",
        "value": null
       },
       {
        "color": "yellow",
        "value": 0.8
       },
       {
        "color": "red",
        "value": 0.95
       }
      ]
     },
     "unit": "percentunit"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 12,
    "x": 12,
    "y": 27
   },
   "id": 10,
   "options": {
    "displayMode": "basic",
    "maxVizHeight": 300,
    "minVizHeight": 16,
    "minVizWidth": 8,
    "namePlacement": "auto",
    "orientation": "horizontal",
    "reduceOptions": {
     "calcs": [
      "lastNotNull"
     ],
     "fields": "",
     "values": false
    },
    "showUnfilled": true,
    "sizing": "auto",
    "valueMode": "color"
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "kvb_tenant_bytes{namespace=~\"$namespace\"} / (kvb_tenant_quota_bytes{namespace=~\"$namespace\"} > 0)",
     "legendFormat": "{{namespace}} / {{tier}}",
     "refId": "A"
    }
   ],
   "title": "Quota consumption (capped tenants)",
   "type": "bargauge"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Payload bytes served per data-plane namespace id (top 10). The ns label is the numeric id from namespaces.yaml; the tenant gauges above carry the name.",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "Bps"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 12,
    "x": 0,
    "y": 35
   },
   "id": 11,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "topk(10, sum by (ns) (rate(kvb_bytes_total{dir=\"out\"}[$__rate_interval])))",
     "legendFormat": "ns {{ns}}",
     "refId": "A"
    }
   ],
   "title": "Served bytes by namespace id (top 10)",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Pinned bytes charged against each namespace id's pin quota (kvb_pinned_bytes).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "bytes"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 12,
    "x": 12,
    "y": 35
   },
   "id": 12,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "topk(10, kvb_pinned_bytes)",
     "legendFormat": "ns {{ns}}",
     "refId": "A"
    }
   ],
   "title": "Pinned bytes by namespace id (top 10)",
   "type": "timeseries"
  },
  {
   "collapsed": false,
   "gridPos": {
    "h": 1,
    "w": 24,
    "x": 0,
    "y": 43
   },
   "id": 400,
   "panels": [],
   "title": "Cold tier (S3) health",
   "type": "row"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Spill/restore flow: whole segments up (spill-acks), whole segments down (lazy restore), cold per-block ranged GETs, and cold hits served after verification.",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "ops"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 0,
    "y": 44
   },
   "id": 13,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_spilled_segments_total[$__rate_interval])",
     "legendFormat": "segments spilled",
     "refId": "A"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_restores_total[$__rate_interval])",
     "legendFormat": "segments restored",
     "refId": "B"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_ranged_gets_total[$__rate_interval])",
     "legendFormat": "cold ranged GETs",
     "refId": "C"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_hits_total[$__rate_interval])",
     "legendFormat": "cold hits served",
     "refId": "D"
    }
   ],
   "title": "Spill / restore flow",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Cold-tier trouble: failed uploads, failed/expired cold reads, object-side checksum failures (answered NOT_FOUND, never served), and spill-queue drops (segment stays local, retried).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "ops"
    },
    "overrides": [
     {
      "matcher": {
       "id": "byName",
       "options": "put errors"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "orange",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "read errors"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "red",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "checksum errors"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "dark-red",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "spill drops"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "yellow",
         "mode": "fixed"
        }
       }
      ]
     }
    ]
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 8,
    "y": 44
   },
   "id": 14,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_put_errors_total[$__rate_interval])",
     "legendFormat": "put errors",
     "refId": "A"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_read_errors_total[$__rate_interval])",
     "legendFormat": "read errors",
     "refId": "B"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_checksum_errors_total[$__rate_interval])",
     "legendFormat": "checksum errors",
     "refId": "C"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_s3_spill_drops_total[$__rate_interval])",
     "legendFormat": "spill drops",
     "refId": "D"
    }
   ],
   "title": "Cold-tier errors & drops",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Blocks currently served from S3 (kvb_blocks{tier=\"s3\"}). Zero on a daemon without the cold tier configured.",
   "fieldConfig": {
    "defaults": {
     "color": {
      "fixedColor": "purple",
      "mode": "fixed"
     },
     "thresholds": {
      "mode": "absolute",
      "steps": [
       {
        "color": "purple",
        "value": null
       }
      ]
     },
     "unit": "short"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 16,
    "y": 44
   },
   "id": 15,
   "options": {
    "colorMode": "value",
    "graphMode": "area",
    "justifyMode": "auto",
    "orientation": "auto",
    "percentChangeColorMode": "standard",
    "reduceOptions": {
     "calcs": [
      "lastNotNull"
     ],
     "fields": "",
     "values": false
    },
    "showPercentChange": false,
    "textMode": "auto",
    "wideLayout": true
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum(kvb_blocks{tier=\"s3\"})",
     "legendFormat": "s3-resident blocks",
     "refId": "A"
    }
   ],
   "title": "S3-resident blocks",
   "type": "stat"
  },
  {
   "collapsed": false,
   "gridPos": {
    "h": 1,
    "w": 24,
    "x": 0,
    "y": 52
   },
   "id": 500,
   "panels": [],
   "title": "Reclaim & demote pressure (NVMe)",
   "type": "row"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Blocks moving between tiers: DRAM->NVMe demotions, NVMe->DRAM promotions, and demotions completed without an SSD write (bytes already resident).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "ops"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 0,
    "y": 53
   },
   "id": 16,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_demotions_total[$__rate_interval])",
     "legendFormat": "demotions",
     "refId": "A"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_promotions_total[$__rate_interval])",
     "legendFormat": "promotions",
     "refId": "B"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_dedup_skips_total[$__rate_interval])",
     "legendFormat": "dedup skips (no SSD write)",
     "refId": "C"
    }
   ],
   "title": "Demote / promote flow",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Pressure refusals: dropped demotions (queue/write/publish-gate), endurance-gate deletions (admit refusals), reader-pool saturation (per-key ERR_BUSY), device reads that failed verification (self-healed, never served), and unexpired blocks DRAM evicted before they reached flash (data lost; lower nvme_demote_watermark_pct if this climbs).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "ops"
    },
    "overrides": [
     {
      "matcher": {
       "id": "byName",
       "options": "demote drops"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "yellow",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "read busy (ERR_BUSY)"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "orange",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "checksum errors"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "red",
         "mode": "fixed"
        }
       }
      ]
     },
     {
      "matcher": {
       "id": "byName",
       "options": "DRAM-only evictions (lost)"
      },
      "properties": [
       {
        "id": "color",
        "value": {
         "fixedColor": "purple",
         "mode": "fixed"
        }
       }
      ]
     }
    ]
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 8,
    "y": 53
   },
   "id": 17,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_demote_drops_total[$__rate_interval])",
     "legendFormat": "demote drops",
     "refId": "A"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_admit_refusals_total[$__rate_interval])",
     "legendFormat": "admit refusals (endurance gate)",
     "refId": "B"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_read_busy_total[$__rate_interval])",
     "legendFormat": "read busy (ERR_BUSY)",
     "refId": "C"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_checksum_errors_total[$__rate_interval])",
     "legendFormat": "checksum errors",
     "refId": "D"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_dram_only_evictions_total[$__rate_interval])",
     "legendFormat": "DRAM-only evictions (lost)",
     "refId": "E"
    }
   ],
   "title": "Pressure refusals & read health",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Whole-segment FIFO reclaims, rounds skipped over protected blocks, and evictions under memory pressure by tier.",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "ops"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 16,
    "y": 53
   },
   "id": 18,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_reclaims_total[$__rate_interval])",
     "legendFormat": "segment reclaims",
     "refId": "A"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "rate(kvb_nvme_reclaim_skips_total[$__rate_interval])",
     "legendFormat": "reclaim skips (protected)",
     "refId": "B"
    },
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "sum by (tier) (rate(kvb_evictions_total[$__rate_interval]))",
     "legendFormat": "evictions ({{tier}})",
     "refId": "C"
    }
   ],
   "title": "Reclaims & evictions",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Fallocated bytes across live NVMe segments vs the configured budget (kvb_nvme_used_bytes / kvb_nvme_max_bytes).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "thresholds"
     },
     "max": 1,
     "min": 0,
     "thresholds": {
      "mode": "absolute",
      "steps": [
       {
        "color": "green",
        "value": null
       },
       {
        "color": "yellow",
        "value": 0.8
       },
       {
        "color": "red",
        "value": 0.95
       }
      ]
     },
     "unit": "percentunit"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 0,
    "y": 61
   },
   "id": 19,
   "options": {
    "minVizHeight": 75,
    "minVizWidth": 75,
    "orientation": "auto",
    "reduceOptions": {
     "calcs": [
      "lastNotNull"
     ],
     "fields": "",
     "values": false
    },
    "showThresholdLabels": false,
    "showThresholdMarkers": true,
    "sizing": "auto"
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "kvb_nvme_used_bytes / kvb_nvme_max_bytes",
     "legendFormat": "NVMe used",
     "refId": "A"
    }
   ],
   "title": "NVMe capacity used",
   "type": "gauge"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "Live NVMe segment files across volumes (kvb_nvme_segments).",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 10,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "short"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 8,
    "y": 61
   },
   "id": 20,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": false
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "kvb_nvme_segments",
     "legendFormat": "live segments",
     "refId": "A"
    }
   ],
   "title": "Live NVMe segments",
   "type": "timeseries"
  },
  {
   "datasource": {
    "type": "prometheus",
    "uid": "${datasource}"
   },
   "description": "DRAM arena bytes by state (total / free / largest_free_region). A shrinking largest-free-region with free bytes to spare = fragmentation pressure.",
   "fieldConfig": {
    "defaults": {
     "color": {
      "mode": "palette-classic"
     },
     "custom": {
      "drawStyle": "line",
      "fillOpacity": 0,
      "lineWidth": 2,
      "pointSize": 5,
      "showPoints": "never",
      "spanNulls": false
     },
     "min": 0,
     "unit": "bytes"
    },
    "overrides": []
   },
   "gridPos": {
    "h": 8,
    "w": 8,
    "x": 16,
    "y": 61
   },
   "id": 21,
   "options": {
    "legend": {
     "displayMode": "list",
     "placement": "bottom",
     "showLegend": true
    },
    "tooltip": {
     "mode": "multi",
     "sort": "desc"
    }
   },
   "targets": [
    {
     "datasource": {
      "type": "prometheus",
      "uid": "${datasource}"
     },
     "expr": "kvb_arena_bytes",
     "legendFormat": "{{state}}",
     "refId": "A"
    }
   ],
   "title": "DRAM arena by state",
   "type": "timeseries"
  }
 ],
 "refresh": "10s",
 "schemaVersion": 39,
 "tags": [
  "kvblockd",
  "kvstash"
 ],
 "templating": {
  "list": [
   {
    "current": {},
    "hide": 0,
    "includeAll": false,
    "label": "Prometheus",
    "multi": false,
    "name": "datasource",
    "options": [],
    "query": "prometheus",
    "refresh": 1,
    "regex": "",
    "type": "datasource"
   },
   {
    "current": {
     "selected": true,
     "text": [
      "All"
     ],
     "value": [
      "$__all"
     ]
    },
    "datasource": {
     "type": "prometheus",
     "uid": "${datasource}"
    },
    "definition": "label_values(kvb_tenant_bytes, namespace)",
    "hide": 0,
    "includeAll": true,
    "label": "namespace",
    "multi": true,
    "name": "namespace",
    "options": [],
    "query": {
     "qryType": 1,
     "query": "label_values(kvb_tenant_bytes, namespace)",
     "refId": "PrometheusVariableQueryEditor-VariableQuery"
    },
    "refresh": 2,
    "regex": "",
    "sort": 1,
    "type": "query"
   }
  ]
 },
 "time": {
  "from": "now-1h",
  "to": "now"
 },
 "timepicker": {},
 "timezone": "",
 "title": "kvblockd",
 "uid": "kvblockd-ops",
 "version": 1,
 "weekStart": ""
}
