This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch feat/kiro-credits-dora-dashboard
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 40538d512ff2d7ba377df56b5186954b46738836
Author: warren <[email protected]>
AuthorDate: Sun Mar 22 21:12:35 2026 +0800

    feat(q-dev): add Kiro Credits + DORA Correlation dashboard
    
    Add a new Grafana dashboard that correlates Kiro AI usage (credits,
    messages, active users) with DORA metrics at weekly aggregate level.
    
    Panels include:
    - Pearson's r correlation between weekly credits and PR cycle time
    - High AI Usage vs Low AI Usage cycle time comparison
    - Weekly credits vs deployment frequency trend
    - Weekly credits vs change failure rate trend
    
    Data is joined by week_start between _tool_q_dev_user_report and
    project_pr_metrics / cicd_deployment_commits.
---
 grafana/dashboards/KiroCreditsDORA.json | 426 ++++++++++++++++++++++++++++++++
 1 file changed, 426 insertions(+)

diff --git a/grafana/dashboards/KiroCreditsDORA.json 
b/grafana/dashboards/KiroCreditsDORA.json
new file mode 100644
index 000000000..d8195d8be
--- /dev/null
+++ b/grafana/dashboards/KiroCreditsDORA.json
@@ -0,0 +1,426 @@
+{
+  "annotations": {
+    "list": [
+      {
+        "builtIn": 1,
+        "datasource": "-- Grafana --",
+        "enable": true,
+        "hide": true,
+        "iconColor": "rgba(0, 211, 255, 1)",
+        "name": "Annotations & Alerts",
+        "type": "dashboard"
+      }
+    ]
+  },
+  "editable": true,
+  "fiscalYearStartMonth": 0,
+  "graphTooltip": 1,
+  "id": null,
+  "links": [
+    {
+      "asDropdown": false,
+      "icon": "external link",
+      "includeVars": true,
+      "keepTime": true,
+      "tags": [],
+      "targetBlank": true,
+      "title": "DORA Dashboard",
+      "type": "link",
+      "url": "/d/qNo8_0M4z/dora"
+    },
+    {
+      "asDropdown": false,
+      "icon": "external link",
+      "includeVars": true,
+      "keepTime": true,
+      "tags": [],
+      "targetBlank": true,
+      "title": "Kiro Usage Dashboard",
+      "type": "link",
+      "url": "/d/qdev_user_report"
+    }
+  ],
+  "panels": [
+    {
+      "datasource": {
+        "type": "datasource",
+        "uid": "grafana"
+      },
+      "gridPos": { "h": 3, "w": 24, "x": 0, "y": 0 },
+      "id": 1,
+      "options": {
+        "code": { "language": "plaintext", "showLineNumbers": false, 
"showMiniMap": false },
+        "content": "## Kiro Credits + DORA Correlation\nThis dashboard 
correlates **Kiro AI usage (credits and messages)** with **DORA** performance 
indicators at a weekly aggregate level.\n\n- **Pearson's r** measures linear 
correlation: negative r suggests higher AI usage may correlate with shorter 
cycle times.\n- Data is aggregated by **week** and joined on `week_start`.",
+        "mode": "markdown"
+      },
+      "title": "Dashboard Introduction",
+      "type": "text"
+    },
+    {
+      "collapsed": false,
+      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 3 },
+      "id": 2,
+      "panels": [],
+      "title": "Overview",
+      "type": "row"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Pearson correlation coefficient between weekly Kiro 
credits and PR cycle time",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "thresholds" },
+          "mappings": [{ "options": { "match": "null", "result": { "text": 
"Need more data" } }, "type": "special" }],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              { "color": "green", "value": null },
+              { "color": "yellow", "value": -0.3 },
+              { "color": "orange", "value": 0.3 }
+            ]
+          }
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 6, "w": 8, "x": 0, "y": 4 },
+      "id": 3,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "none",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": 
false },
+        "showPercentChange": false,
+        "textMode": "auto"
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "editorMode": "code",
+          "format": "table",
+          "rawQuery": true,
+          "rawSql": "WITH _kiro_weekly AS (\n  SELECT\n    
DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY) AS week_start,\n    
SUM(credits_used) AS weekly_credits\n  FROM _tool_q_dev_user_report\n  WHERE 
$__timeFilter(date)\n  GROUP BY DATE_SUB(DATE(date), INTERVAL 
WEEKDAY(DATE(date)) DAY)\n),\n_pr_weekly AS (\n  SELECT\n    
DATE_SUB(DATE(pr_merged_date), INTERVAL WEEKDAY(DATE(pr_merged_date)) DAY) AS 
week_start,\n    AVG(pr_cycle_time) / 60.0 AS avg_cycle_hours\n  FROM 
project_pr [...]
+          "refId": "A"
+        }
+      ],
+      "title": "Credits vs Cycle Time (r)",
+      "type": "stat"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Total Kiro credits consumed in period",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "thresholds" },
+          "mappings": [],
+          "thresholds": { "mode": "absolute", "steps": [{ "color": "blue", 
"value": null }] }
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 6, "w": 4, "x": 8, "y": 4 },
+      "id": 4,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "area",
+        "reduceOptions": { "calcs": ["sum"], "fields": "", "values": false },
+        "textMode": "auto"
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "table",
+          "rawQuery": true,
+          "rawSql": "SELECT SUM(credits_used) AS 'Credits Used'\nFROM 
_tool_q_dev_user_report\nWHERE $__timeFilter(date)",
+          "refId": "A"
+        }
+      ],
+      "title": "Total Credits",
+      "type": "stat"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Median PR cycle time in hours",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "thresholds" },
+          "mappings": [],
+          "thresholds": { "mode": "absolute", "steps": [{ "color": "green", 
"value": null }] },
+          "unit": "h"
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 6, "w": 4, "x": 12, "y": 4 },
+      "id": 5,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "area",
+        "reduceOptions": { "calcs": ["sum"], "fields": "", "values": false },
+        "textMode": "auto"
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "table",
+          "rawQuery": true,
+          "rawSql": "WITH _ranked AS (\n  SELECT pr_cycle_time / 60.0 AS ct,\n 
   PERCENT_RANK() OVER (ORDER BY pr_cycle_time) AS prank\n  FROM 
project_pr_metrics\n  WHERE pr_merged_date IS NOT NULL AND pr_cycle_time IS NOT 
NULL\n    AND $__timeFilter(pr_merged_date)\n)\nSELECT ROUND(MAX(ct), 1) AS 
'Median Cycle Time'\nFROM _ranked WHERE prank <= 0.5",
+          "refId": "A"
+        }
+      ],
+      "title": "Median Cycle Time",
+      "type": "stat"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Cycle time comparison: weeks with above-median vs 
below-median AI credits usage",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "palette-classic" },
+          "mappings": [],
+          "thresholds": { "mode": "absolute", "steps": [{ "color": "green", 
"value": null }] },
+          "unit": "h"
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 6, "w": 8, "x": 16, "y": 4 },
+      "id": 6,
+      "options": {
+        "barRadius": 0.1,
+        "barWidth": 0.6,
+        "orientation": "horizontal",
+        "showValue": "auto",
+        "stacking": "none",
+        "tooltip": { "mode": "single" }
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "table",
+          "rawQuery": true,
+          "rawSql": "WITH _kiro_weekly AS (\n  SELECT DATE_SUB(DATE(date), 
INTERVAL WEEKDAY(DATE(date)) DAY) AS week_start,\n    SUM(credits_used) AS 
weekly_credits\n  FROM _tool_q_dev_user_report WHERE $__timeFilter(date)\n  
GROUP BY DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY)\n),\n_pr_weekly 
AS (\n  SELECT DATE_SUB(DATE(pr_merged_date), INTERVAL 
WEEKDAY(DATE(pr_merged_date)) DAY) AS week_start,\n    AVG(pr_cycle_time) / 
60.0 AS avg_ct\n  FROM project_pr_metrics\n  WHERE pr_m [...]
+          "refId": "A"
+        }
+      ],
+      "title": "Cycle Time: High vs Low AI Usage",
+      "type": "bargauge"
+    },
+    {
+      "collapsed": false,
+      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 10 },
+      "id": 10,
+      "panels": [],
+      "title": "Weekly Trends",
+      "type": "row"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Weekly Kiro credits consumed",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "palette-classic" },
+          "custom": {
+            "axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
+            "drawStyle": "line", "fillOpacity": 10, "lineInterpolation": 
"smooth", "lineWidth": 2,
+            "pointSize": 5, "showPoints": "never", "spanNulls": true,
+            "stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" 
}
+          },
+          "unit": "short"
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 11 },
+      "id": 11,
+      "options": {
+        "legend": { "calcs": ["mean", "sum"], "displayMode": "table", 
"placement": "right", "showLegend": true },
+        "tooltip": { "mode": "multi" }
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "time_series",
+          "rawQuery": true,
+          "rawSql": "SELECT\n  DATE_SUB(DATE(date), INTERVAL 
WEEKDAY(DATE(date)) DAY) AS time,\n  SUM(credits_used) AS 'Credits Used',\n  
COUNT(DISTINCT user_id) AS 'Active Users'\nFROM _tool_q_dev_user_report\nWHERE 
$__timeFilter(date)\nGROUP BY DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) 
DAY)\nORDER BY time",
+          "refId": "A"
+        }
+      ],
+      "title": "Weekly Kiro Credits & Active Users",
+      "type": "timeseries"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Weekly average PR cycle time in hours",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "palette-classic" },
+          "custom": {
+            "axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
+            "drawStyle": "line", "fillOpacity": 10, "lineInterpolation": 
"smooth", "lineWidth": 2,
+            "pointSize": 5, "showPoints": "never", "spanNulls": true,
+            "stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" 
}
+          },
+          "unit": "h"
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 11 },
+      "id": 12,
+      "options": {
+        "legend": { "calcs": ["mean", "max"], "displayMode": "table", 
"placement": "right", "showLegend": true },
+        "tooltip": { "mode": "multi" }
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "time_series",
+          "rawQuery": true,
+          "rawSql": "SELECT\n  DATE_SUB(DATE(pr_merged_date), INTERVAL 
WEEKDAY(DATE(pr_merged_date)) DAY) AS time,\n  ROUND(AVG(pr_cycle_time) / 60.0, 
1) AS 'Avg Cycle Time (hrs)',\n  COUNT(*) AS 'PRs Merged'\nFROM 
project_pr_metrics\nWHERE pr_merged_date IS NOT NULL AND pr_cycle_time IS NOT 
NULL\n  AND $__timeFilter(pr_merged_date)\nGROUP BY 
DATE_SUB(DATE(pr_merged_date), INTERVAL WEEKDAY(DATE(pr_merged_date)) 
DAY)\nORDER BY time",
+          "refId": "A"
+        }
+      ],
+      "title": "Weekly PR Cycle Time & Volume",
+      "type": "timeseries"
+    },
+    {
+      "collapsed": false,
+      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 19 },
+      "id": 20,
+      "panels": [],
+      "title": "Deployment Frequency",
+      "type": "row"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Pearson correlation between weekly credits and 
deployment count",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "thresholds" },
+          "mappings": [{ "options": { "match": "null", "result": { "text": 
"Need more data" } }, "type": "special" }],
+          "thresholds": { "mode": "absolute", "steps": [{ "color": "green", 
"value": null }] }
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 6, "w": 6, "x": 0, "y": 20 },
+      "id": 21,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "none",
+        "reduceOptions": { "calcs": ["lastNotNull"], "fields": "", "values": 
false },
+        "textMode": "auto"
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "table",
+          "rawQuery": true,
+          "rawSql": "WITH _kiro_weekly AS (\n  SELECT DATE_SUB(DATE(date), 
INTERVAL WEEKDAY(DATE(date)) DAY) AS week_start,\n    SUM(credits_used) AS 
weekly_credits\n  FROM _tool_q_dev_user_report WHERE $__timeFilter(date)\n  
GROUP BY DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) 
DAY)\n),\n_deploy_weekly AS (\n  SELECT DATE_SUB(DATE(cdc.finished_date), 
INTERVAL WEEKDAY(DATE(cdc.finished_date)) DAY) AS week_start,\n    
COUNT(DISTINCT cdc.cicd_deployment_id) AS deploys\n  FROM cicd_dep [...]
+          "refId": "A"
+        }
+      ],
+      "title": "Credits vs Deploy Freq (r)",
+      "type": "stat"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Weekly credits overlaid with deployment count",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "palette-classic" },
+          "custom": {
+            "axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
+            "drawStyle": "line", "fillOpacity": 10, "lineInterpolation": 
"smooth", "lineWidth": 2,
+            "pointSize": 5, "showPoints": "never", "spanNulls": true,
+            "stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" 
}
+          },
+          "unit": "short"
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 8, "w": 18, "x": 6, "y": 20 },
+      "id": 22,
+      "options": {
+        "legend": { "calcs": ["mean", "sum"], "displayMode": "table", 
"placement": "right", "showLegend": true },
+        "tooltip": { "mode": "multi" }
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "time_series",
+          "rawQuery": true,
+          "rawSql": "SELECT time, SUM(credits) AS 'Credits Used', SUM(deploys) 
AS 'Deployments'\nFROM (\n  SELECT DATE_SUB(DATE(date), INTERVAL 
WEEKDAY(DATE(date)) DAY) AS time,\n    SUM(credits_used) AS credits, 0 AS 
deploys\n  FROM _tool_q_dev_user_report WHERE $__timeFilter(date)\n  GROUP BY 
DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY)\n  UNION ALL\n  SELECT 
DATE_SUB(DATE(cdc.finished_date), INTERVAL WEEKDAY(DATE(cdc.finished_date)) 
DAY) AS time,\n    0 AS credits, COUNT(DIS [...]
+          "refId": "A"
+        }
+      ],
+      "title": "Weekly Credits vs Deployments",
+      "type": "timeseries"
+    },
+    {
+      "collapsed": false,
+      "gridPos": { "h": 1, "w": 24, "x": 0, "y": 28 },
+      "id": 30,
+      "panels": [],
+      "title": "Change Failure Rate",
+      "type": "row"
+    },
+    {
+      "datasource": "mysql",
+      "description": "Change failure rate: % of deployments that caused 
incidents",
+      "fieldConfig": {
+        "defaults": {
+          "color": { "mode": "palette-classic" },
+          "custom": {
+            "axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
+            "drawStyle": "line", "fillOpacity": 10, "lineInterpolation": 
"smooth", "lineWidth": 2,
+            "pointSize": 5, "showPoints": "never", "spanNulls": true,
+            "stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" 
}
+          },
+          "unit": "short"
+        },
+        "overrides": []
+      },
+      "gridPos": { "h": 8, "w": 24, "x": 0, "y": 29 },
+      "id": 31,
+      "options": {
+        "legend": { "calcs": ["mean", "sum"], "displayMode": "table", 
"placement": "right", "showLegend": true },
+        "tooltip": { "mode": "multi" }
+      },
+      "targets": [
+        {
+          "datasource": "mysql",
+          "format": "time_series",
+          "rawQuery": true,
+          "rawSql": "SELECT time, SUM(credits) AS 'Credits Used', SUM(cfr) AS 
'Change Failure Rate'\nFROM (\n  SELECT DATE_SUB(DATE(date), INTERVAL 
WEEKDAY(DATE(date)) DAY) AS time,\n    SUM(credits_used) AS credits, 0 AS cfr\n 
 FROM _tool_q_dev_user_report WHERE $__timeFilter(date)\n  GROUP BY 
DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY)\n  UNION ALL\n  SELECT 
DATE_SUB(DATE(d.deployment_finished_date), INTERVAL 
WEEKDAY(DATE(d.deployment_finished_date)) DAY) AS time,\n    0 AS  [...]
+          "refId": "A"
+        }
+      ],
+      "title": "Weekly Credits vs Change Failure Rate",
+      "type": "timeseries"
+    }
+  ],
+  "preload": false,
+  "refresh": "5m",
+  "schemaVersion": 41,
+  "tags": ["q_dev", "dora", "kiro", "correlation"],
+  "templating": {
+    "list": [
+      {
+        "current": { "selected": true, "text": ["All"], "value": ["$__all"] },
+        "datasource": "mysql",
+        "definition": "SELECT DISTINCT name FROM projects",
+        "hide": 0,
+        "includeAll": true,
+        "label": "Project",
+        "multi": true,
+        "name": "project",
+        "options": [],
+        "query": "SELECT DISTINCT name FROM projects",
+        "refresh": 1,
+        "type": "query"
+      }
+    ]
+  },
+  "time": { "from": "now-90d", "to": "now" },
+  "timepicker": {},
+  "timezone": "utc",
+  "title": "Kiro Credits + DORA Correlation",
+  "uid": "kiro_credits_dora",
+  "version": 1
+}

Reply via email to