{
  "title": "Crop AI System - Production Overview",
  "uid": "crop-ai-overview",
  "timezone": "browser",
  "refresh": "30s",
  "panels": [
    {
      "id": 1,
      "title": "Request rate (req/s)",
      "type": "timeseries",
      "gridPos": {"x": 0, "y": 0, "w": 12, "h": 8},
      "targets": [
        {"expr": "sum(rate(http_requests_total[1m])) by (path)", "legendFormat": "{{path}}"}
      ]
    },
    {
      "id": 2,
      "title": "Error rate (5xx per minute)",
      "type": "timeseries",
      "gridPos": {"x": 12, "y": 0, "w": 12, "h": 8},
      "targets": [
        {"expr": "sum(rate(http_requests_total{status_code=~\"5..\"}[1m]))", "legendFormat": "5xx errors"}
      ]
    },
    {
      "id": 3,
      "title": "Request latency p50/p95/p99 (seconds)",
      "type": "timeseries",
      "gridPos": {"x": 0, "y": 8, "w": 12, "h": 8},
      "targets": [
        {"expr": "histogram_quantile(0.50, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", "legendFormat": "p50"},
        {"expr": "histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", "legendFormat": "p95"},
        {"expr": "histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))", "legendFormat": "p99"}
      ]
    },
    {
      "id": 4,
      "title": "Crop analysis requests queued",
      "type": "timeseries",
      "gridPos": {"x": 12, "y": 8, "w": 12, "h": 8},
      "targets": [
        {"expr": "sum(rate(crop_analysis_queued_total[5m])) by (crop)", "legendFormat": "{{crop}}"}
      ]
    },
    {
      "id": 5,
      "title": "Cache hit rate",
      "type": "timeseries",
      "gridPos": {"x": 0, "y": 16, "w": 12, "h": 8},
      "targets": [
        {"expr": "sum(rate(crop_analysis_cache_hits_total[5m])) / sum(rate(crop_analysis_queued_total[5m]))", "legendFormat": "cache hit ratio"}
      ]
    },
    {
      "id": 6,
      "title": "Model degradation events",
      "type": "timeseries",
      "gridPos": {"x": 12, "y": 16, "w": 12, "h": 8},
      "targets": [
        {"expr": "sum(rate(model_degraded_total[5m])) by (model_name)", "legendFormat": "{{model_name}}"}
      ]
    }
  ]
}
