{
  "__inputs": [
    {
      "name": "DS_INFINITY",
      "label": "Infinity",
      "description": "Infinity datasource pointed at https://api.exlogare.net with a Bearer Authorization header (your exl_… token, scope=read).",
      "type": "datasource",
      "pluginId": "yesoreyeram-infinity-datasource",
      "pluginName": "Infinity"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "10.0.0"
    },
    {
      "type": "datasource",
      "id": "yesoreyeram-infinity-datasource",
      "name": "Infinity",
      "version": "2.0.0"
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": []
  },
  "description": "Exlogare RCA dashboard — failures/day, severity split, top projects, top root causes, p50/p90 time-to-RCA. Backed by /api/v1/stats/* under scope=read.",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [
    {
      "title": "Read API docs",
      "url": "https://exlogare.net/en/docs/api-read",
      "type": "link",
      "icon": "external link",
      "targetBlank": true
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "id": 1,
      "title": "Failures detected (window)",
      "type": "stat",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 4, "w": 6, "x": 0, "y": 0},
      "options": {
        "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false},
        "orientation": "auto",
        "textMode": "auto",
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "center"
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/overview?days=$days",
          "url_options": {"method": "GET"},
          "format": "table",
          "root_selector": "",
          "columns": [
            {"selector": "failures_detected", "text": "value", "type": "number"}
          ]
        }
      ]
    },
    {
      "id": 2,
      "title": "Analyses completed (window)",
      "type": "stat",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 4, "w": 6, "x": 6, "y": 0},
      "options": {
        "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false},
        "textMode": "auto",
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "center"
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/overview?days=$days",
          "url_options": {"method": "GET"},
          "format": "table",
          "columns": [
            {"selector": "analyses_completed", "text": "value", "type": "number"}
          ]
        }
      ]
    },
    {
      "id": 3,
      "title": "p50 time-to-RCA (s)",
      "type": "stat",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 4, "w": 6, "x": 12, "y": 0},
      "options": {
        "reduceOptions": {"calcs": ["lastNotNull"]},
        "textMode": "auto",
        "colorMode": "value"
      },
      "fieldConfig": {
        "defaults": {"unit": "s", "decimals": 1},
        "overrides": []
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/overview?days=$days",
          "url_options": {"method": "GET"},
          "format": "table",
          "columns": [
            {"selector": "p50_time_to_rca_seconds", "text": "value", "type": "number"}
          ]
        }
      ]
    },
    {
      "id": 4,
      "title": "p90 time-to-RCA (s)",
      "type": "stat",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 4, "w": 6, "x": 18, "y": 0},
      "options": {
        "reduceOptions": {"calcs": ["lastNotNull"]},
        "textMode": "auto",
        "colorMode": "value"
      },
      "fieldConfig": {
        "defaults": {"unit": "s", "decimals": 1},
        "overrides": []
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/overview?days=$days",
          "url_options": {"method": "GET"},
          "format": "table",
          "columns": [
            {"selector": "p90_time_to_rca_seconds", "text": "value", "type": "number"}
          ]
        }
      ]
    },
    {
      "id": 5,
      "title": "Failures per day",
      "type": "timeseries",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 9, "w": 12, "x": 0, "y": 4},
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "bars",
            "fillOpacity": 70,
            "lineWidth": 1,
            "axisLabel": "",
            "axisPlacement": "auto",
            "showPoints": "never"
          },
          "color": {"mode": "palette-classic"},
          "unit": "short"
        },
        "overrides": []
      },
      "options": {
        "legend": {"showLegend": false, "displayMode": "list"},
        "tooltip": {"mode": "single", "sort": "none"}
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/timeseries?days=$days",
          "url_options": {"method": "GET"},
          "format": "timeseries",
          "columns": [
            {"selector": "date", "text": "time", "type": "timestamp"},
            {"selector": "failures", "text": "failures", "type": "number"}
          ]
        }
      ]
    },
    {
      "id": 6,
      "title": "Severity split",
      "type": "stat",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 9, "w": 12, "x": 12, "y": 4},
      "options": {
        "reduceOptions": {"calcs": ["lastNotNull"], "values": true, "fields": ""},
        "orientation": "horizontal",
        "textMode": "auto",
        "colorMode": "value",
        "justifyMode": "center"
      },
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {"color": "green", "value": null},
              {"color": "orange", "value": 1},
              {"color": "red", "value": 5}
            ]
          }
        },
        "overrides": []
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/overview?days=$days",
          "url_options": {"method": "GET"},
          "format": "table",
          "columns": [
            {"selector": "severity_counts.low", "text": "low", "type": "number"},
            {"selector": "severity_counts.medium", "text": "medium", "type": "number"},
            {"selector": "severity_counts.high", "text": "high", "type": "number"}
          ]
        }
      ]
    },
    {
      "id": 7,
      "title": "Top projects by failures",
      "type": "table",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 9, "w": 12, "x": 0, "y": 13},
      "options": {
        "showHeader": true,
        "footer": {"show": false}
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/top-projects?days=$days&limit=10",
          "url_options": {"method": "GET"},
          "format": "table",
          "root_selector": "",
          "columns": [
            {"selector": "project_path", "text": "project", "type": "string"},
            {"selector": "failures", "text": "failures", "type": "number"},
            {"selector": "analyses", "text": "analyses", "type": "number"}
          ]
        }
      ]
    },
    {
      "id": 8,
      "title": "Top root causes",
      "type": "table",
      "datasource": {
        "type": "yesoreyeram-infinity-datasource",
        "uid": "${DS_INFINITY}"
      },
      "gridPos": {"h": 9, "w": 12, "x": 12, "y": 13},
      "options": {
        "showHeader": true
      },
      "targets": [
        {
          "refId": "A",
          "type": "json",
          "source": "url",
          "url": "/api/v1/stats/top-root-causes?days=$days&limit=10",
          "url_options": {"method": "GET"},
          "format": "table",
          "columns": [
            {"selector": "root_cause", "text": "root cause", "type": "string"},
            {"selector": "severity", "text": "severity", "type": "string"},
            {"selector": "count", "text": "count", "type": "number"}
          ]
        }
      ]
    }
  ],
  "refresh": "5m",
  "schemaVersion": 39,
  "tags": ["exlogare", "rca", "ci-cd"],
  "templating": {
    "list": [
      {
        "name": "days",
        "type": "custom",
        "label": "Window (days)",
        "query": "1,7,14,30,60,90,180",
        "current": {"text": "30", "value": "30"},
        "options": [
          {"text": "1", "value": "1", "selected": false},
          {"text": "7", "value": "7", "selected": false},
          {"text": "14", "value": "14", "selected": false},
          {"text": "30", "value": "30", "selected": true},
          {"text": "60", "value": "60", "selected": false},
          {"text": "90", "value": "90", "selected": false},
          {"text": "180", "value": "180", "selected": false}
        ]
      }
    ]
  },
  "time": {"from": "now-30d", "to": "now"},
  "timepicker": {},
  "timezone": "",
  "title": "Exlogare RCA",
  "uid": "exlogare-rca",
  "version": 1,
  "weekStart": ""
}
