{
  "annotations": { "list": [] },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "title": "Extraction Requests (Loki logs)",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
      "targets": [
        {
          "datasource": { "type": "loki", "uid": "loki" },
          "expr": "count_over_time({container=\"extraction-service\"} |= \"extraction complete\" [5m])",
          "legendFormat": "Extractions / 5m"
        }
      ]
    },
    {
      "title": "Cache Hits vs Misses",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 },
      "targets": [
        {
          "datasource": { "type": "loki", "uid": "loki" },
          "expr": "count_over_time({container=\"extraction-service\"} |= \"cache hit\" [5m])",
          "legendFormat": "Cache Hits / 5m"
        },
        {
          "datasource": { "type": "loki", "uid": "loki" },
          "expr": "count_over_time({container=\"extraction-service\"} |= \"extraction complete\" |= \"cacheHit\":false [5m])",
          "legendFormat": "Cache Misses / 5m"
        }
      ]
    },
    {
      "title": "Errors",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 },
      "targets": [
        {
          "datasource": { "type": "loki", "uid": "loki" },
          "expr": "count_over_time({container=\"extraction-service\"} |= \"error\" [5m])",
          "legendFormat": "Errors / 5m"
        }
      ]
    },
    {
      "title": "Quota Exceeded (429s)",
      "type": "stat",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 },
      "targets": [
        {
          "datasource": { "type": "loki", "uid": "loki" },
          "expr": "count_over_time({container=\"extraction-service\"} |= \"quota exceeded\" [24h])",
          "legendFormat": "429s Today"
        }
      ]
    },
    {
      "title": "Python Sidecar Health",
      "type": "stat",
      "gridPos": { "h": 4, "w": 6, "x": 0, "y": 16 },
      "targets": [
        {
          "datasource": { "type": "loki", "uid": "loki" },
          "expr": "count_over_time({container=\"extraction-service\"} |= \"Sidecar unavailable\" [1h])",
          "legendFormat": "Sidecar Errors (1h)"
        }
      ]
    },
    {
      "title": "Extraction Logs",
      "type": "logs",
      "gridPos": { "h": 10, "w": 24, "x": 0, "y": 20 },
      "targets": [
        {
          "datasource": { "type": "loki", "uid": "loki" },
          "expr": "{container=\"extraction-service\"}"
        }
      ]
    }
  ],
  "schemaVersion": 39,
  "tags": ["extraction", "lysnrai"],
  "templating": { "list": [] },
  "time": { "from": "now-6h", "to": "now" },
  "timepicker": {},
  "timezone": "",
  "title": "Extraction Service",
  "uid": "extraction-service",
  "version": 1
}
