Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve DORA drilldown dashboards #7279

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions grafana/dashboards/DORADetails-ChangeFailureRate.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 40,
"id": 15,
"links": [
{
"asDropdown": false,
Expand All @@ -30,7 +30,7 @@
"title": "Go Back",
"tooltip": "",
"type": "link",
"url": "/d/qNo8_0M4z2/dora2?orgId=1"
"url": "/d/qNo8_0M4z/dora?orgId=1"
}
],
"liveNow": false,
Expand Down Expand Up @@ -547,7 +547,7 @@
},
{
"datasource": "mysql",
"description": "",
"description": "",
"fieldConfig": {
"defaults": {
"color": {
Expand Down Expand Up @@ -627,7 +627,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "with _deployments as(\n select distinct \n d.cicd_deployment_id as deployment_id,\n d.result,\n d.environment,\n d.finished_date,\n d.cicd_scope_id,\n pm.project_name\n from \n cicd_deployment_commits d\n join project_mapping pm on d.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n where \n -- only result needs to specified, not envioronment\n d.result = 'SUCCESS'\n -- choose your project_name\n and pm.project_name in ($project)\n and $__timeFilter(d.finished_date)\n),\n\n_incidents as(\n select distinct \n i.id as issue_id,\n i.type,\n i.created_date,\n pm.project_name\n from \n issues i\n join board_issues bi on i.id = bi.issue_id\n join project_mapping pm on bi.board_id = pm.row_id \n where \n i.type = 'INCIDENT'\n -- choose your project_name\n and pm.project_name in ($project)\n and $__timeFilter(i.created_date)\n)\n\nselect finished_date as time, deployment_id as id, 'DEPLOYMENT' as type from _deployments\nunion\nselect created_date as time, issue_id as id, 'INCIDENT' as type from _incidents\norder by time",
"rawSql": "with _deployments as(\n select distinct \n d.cicd_deployment_id as deployment_id,\n d.result,\n d.environment,\n d.finished_date,\n d.cicd_scope_id,\n pm.project_name\n from \n cicd_deployment_commits d\n join project_mapping pm on d.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n where \n -- only result needs to specified, not envioronment\n d.result = 'SUCCESS'\n -- choose your project_name\n and pm.project_name in ($project)\n and $__timeFilter(d.finished_date)\n),\n\n_incidents as(\n select distinct \n i.id as issue_id,\n i.type,\n i.created_date,\n pm.project_name\n from \n issues i\n join board_issues bi on i.id = bi.issue_id\n join project_mapping pm on bi.board_id = pm.row_id \n where \n i.type = 'INCIDENT'\n -- choose your project_name\n and pm.project_name in ($project)\n and $__timeFilter(i.created_date)\n)\n\nselect finished_date as 'Time (Ascending)', deployment_id as 'Entity ID', 'DEPLOYMENT' as 'Entity Type (Deployment/Incident)' from _deployments\nunion\nselect created_date as 'Time (Ascending)', issue_id as 'Entity ID', 'INCIDENT' as 'Entity Type (Deployment/Incident)' from _incidents\norder by 1",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -668,7 +668,7 @@
]
}
],
"title": "3. How incidents are associated with deployments",
"title": "3. Deployment and incidents timeline",
"type": "table"
}
],
Expand All @@ -687,7 +687,7 @@
"value": "$__all"
},
"datasource": "mysql",
"definition": "select distinct name from projects",
"definition": "select distinct name from projects",
"hide": 0,
"includeAll": true,
"label": "Project",
Expand All @@ -708,7 +708,7 @@
"value": "2023"
},
"datasource": "mysql",
"definition": "select dora_report from dora_benchmarks",
"definition": "select dora_report from dora_benchmarks",
"hide": 0,
"includeAll": false,
"label": "DORA Report",
Expand All @@ -729,7 +729,7 @@
"value": "Failed Deployment Recovery Time"
},
"datasource": "mysql",
"definition": "SELECT \n CASE \n WHEN dora_report = '2023' THEN \"Failed Deployment Recovery Time\"\n WHEN dora_report = '2021' THEN \"Median Time to Restore Service\"\n ELSE NULL \n END AS title_value\nFROM dora_benchmarks\nWHERE dora_report = '${dora_report:raw}'",
"definition": "SELECT \n CASE \n WHEN dora_report = '2023' THEN \"Failed Deployment Recovery Time\"\n WHEN dora_report = '2021' THEN \"Median Time to Restore Service\"\n ELSE NULL \n END AS title_value\nFROM dora_benchmarks\nWHERE dora_report = '${dora_report:raw}'",
"hide": 2,
"includeAll": false,
"label": "TitleValue",
Expand All @@ -753,6 +753,6 @@
"timezone": "",
"title": "DORA Details - Change Failure Rate",
"uid": "Change-failure-rate",
"version": 16,
"version": 3,
"weekStart": ""
}
33 changes: 19 additions & 14 deletions grafana/dashboards/DORADetails-DeploymentFrequency.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 41,
"id": 16,
"links": [
{
"asDropdown": false,
Expand All @@ -30,7 +30,7 @@
"title": "Go Back",
"tooltip": "",
"type": "link",
"url": "/d/qNo8_0M4z2/dora2?orgId=1"
"url": "/d/qNo8_0M4z/dora?orgId=1"
}
],
"liveNow": false,
Expand Down Expand Up @@ -86,7 +86,7 @@
"type": "color-background"
},
"filterable": true,
"inspect": false
"inspect": true
},
"mappings": [
{
Expand Down Expand Up @@ -257,7 +257,7 @@
},
{
"datasource": "mysql",
"fieldConfig": {
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
Expand Down Expand Up @@ -330,7 +330,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "-- Metric 1: Deployment Frequency\nWITH last_few_calendar_days AS (\n -- Construct the last few calendar days within the selected time period in the top-right corner\n SELECT CAST(($__timeTo() - INTERVAL (H + T + U) DAY) AS date) AS day\n FROM (\n SELECT 0 H\n UNION ALL SELECT 100 UNION ALL SELECT 200 UNION ALL SELECT 300\n ) H\n CROSS JOIN (\n SELECT 0 T\n UNION ALL SELECT 10 UNION ALL SELECT 20 UNION ALL SELECT 30\n UNION ALL SELECT 40 UNION ALL SELECT 50 UNION ALL SELECT 60\n UNION ALL SELECT 70 UNION ALL SELECT 80 UNION ALL SELECT 90\n ) T\n CROSS JOIN (\n SELECT 0 U\n UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3\n UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6\n UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9\n ) U\n WHERE ($__timeTo() - INTERVAL (H + T + U) DAY) > $__timeFrom()\n),\n\n_deployment_commit_rank as(\n SELECT\n \tpm.project_name,\n \tIF(cdc._raw_data_table != '', cdc._raw_data_table, cdc.cicd_scope_id) as _raw_data_table,\n \tcdc.id,\n \tcdc.cicd_deployment_id,\n \tcdc.cicd_scope_id,\n \tresult,\n \tenvironment,\n finished_date,\n row_number() over(partition by cdc.cicd_deployment_id order by finished_date desc) as _deployment_commit_rank\n FROM cicd_deployment_commits cdc\n left join project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n WHERE\n pm.project_name in ($project)\n \tand result = 'SUCCESS'\n \tand environment = 'PRODUCTION'\n),\n\n_deployments as (\n SELECT \n project_name, \n cicd_deployment_id as deployment_id,\n -- a deployment may have multiple deployment_commits\n id as deployment_commit_id, \n result,\n environment,\n finished_date\n FROM _deployment_commit_rank\n WHERE \n _deployment_commit_rank = 1\n and $__timeFilter(finished_date)\n)\n\nSELECT\n\tdate_format(last_few_calendar_days.day, '%Y-%m-%d') AS day,\n\tCOALESCE(COUNT(d.finished_date), 0) AS deployment_count,\n CASE \n WHEN count(d.finished_date) > 0 THEN 1\n ELSE 0\n END as is_deployment\nFROM last_few_calendar_days\nLEFT JOIN _deployments d ON last_few_calendar_days.day = DATE(d.finished_date)\n-- FROM _deployments\nGROUP BY 1\nORDER BY 1 DESC",
"rawSql": "-- Metric 1: Deployment Frequency\nWITH last_few_calendar_days AS (\n -- Construct the last few calendar days within the selected time period in the top-right corner\n SELECT CAST(($__timeTo() - INTERVAL (H + T + U) DAY) AS date) AS day\n FROM (\n SELECT 0 H\n UNION ALL SELECT 100 UNION ALL SELECT 200 UNION ALL SELECT 300\n ) H\n CROSS JOIN (\n SELECT 0 T\n UNION ALL SELECT 10 UNION ALL SELECT 20 UNION ALL SELECT 30\n UNION ALL SELECT 40 UNION ALL SELECT 50 UNION ALL SELECT 60\n UNION ALL SELECT 70 UNION ALL SELECT 80 UNION ALL SELECT 90\n ) T\n CROSS JOIN (\n SELECT 0 U\n UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3\n UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6\n UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9\n ) U\n WHERE ($__timeTo() - INTERVAL (H + T + U) DAY) > $__timeFrom()\n),\n\n_deployment_commit_rank as(\n SELECT\n \tpm.project_name,\n \tIF(cdc._raw_data_table != '', cdc._raw_data_table, cdc.cicd_scope_id) as _raw_data_table,\n \tcdc.id,\n \tcdc.cicd_deployment_id,\n \tcdc.cicd_scope_id,\n \tresult,\n \tenvironment,\n finished_date,\n row_number() over(partition by cdc.cicd_deployment_id order by finished_date desc) as _deployment_commit_rank\n FROM cicd_deployment_commits cdc\n left join project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n WHERE\n pm.project_name in ($project)\n \tand result = 'SUCCESS'\n \tand environment = 'PRODUCTION'\n),\n\n_deployments as (\n SELECT \n project_name, \n cicd_deployment_id as deployment_id,\n -- a deployment may have multiple deployment_commits\n id as deployment_commit_id, \n result,\n environment,\n finished_date\n FROM _deployment_commit_rank\n WHERE \n _deployment_commit_rank = 1\n and $__timeFilter(finished_date)\n)\n\nSELECT\n\tdate_format(last_few_calendar_days.day, '%Y-%m-%d') AS day,\n\tCOALESCE(COUNT(d.finished_date), 0) AS deployment_count\n -- CASE \n -- WHEN count(d.finished_date) > 0 THEN 1\n -- ELSE 0 END\n -- as is_deployment\nFROM last_few_calendar_days\nLEFT JOIN _deployments d ON last_few_calendar_days.day = DATE(d.finished_date)\n-- FROM _deployments\nGROUP BY 1\nORDER BY 1 DESC",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -534,7 +534,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
},
{
"color": "red",
Expand Down Expand Up @@ -662,7 +663,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
},
{
"color": "#EAB839",
Expand Down Expand Up @@ -835,7 +837,8 @@
"mode": "absolute",
"steps": [
{
"color": "#a6a6a6"
"color": "#a6a6a6",
"value": null
}
]
},
Expand Down Expand Up @@ -971,7 +974,8 @@
"mode": "absolute",
"steps": [
{
"color": "#a6a6a6"
"color": "#a6a6a6",
"value": null
}
]
},
Expand Down Expand Up @@ -1107,7 +1111,8 @@
"mode": "absolute",
"steps": [
{
"color": "#a6a6a6"
"color": "#a6a6a6",
"value": null
}
]
},
Expand Down Expand Up @@ -1205,7 +1210,7 @@
"value": "$__all"
},
"datasource": "mysql",
"definition": "select distinct name from projects",
"definition": "select distinct name from projects",
"hide": 0,
"includeAll": true,
"label": "Project",
Expand All @@ -1226,7 +1231,7 @@
"value": "2023"
},
"datasource": "mysql",
"definition": "select dora_report from dora_benchmarks",
"definition": "select dora_report from dora_benchmarks",
"hide": 0,
"includeAll": false,
"label": "DORA Report",
Expand All @@ -1247,7 +1252,7 @@
"value": "Failed Deployment Recovery Time"
},
"datasource": "mysql",
"definition": "SELECT \n CASE \n WHEN dora_report = '2023' THEN \"Failed Deployment Recovery Time\"\n WHEN dora_report = '2021' THEN \"Median Time to Restore Service\"\n ELSE NULL \n END AS title_value\nFROM dora_benchmarks\nWHERE dora_report = '${dora_report:raw}'",
"definition": "SELECT \n CASE \n WHEN dora_report = '2023' THEN \"Failed Deployment Recovery Time\"\n WHEN dora_report = '2021' THEN \"Median Time to Restore Service\"\n ELSE NULL \n END AS title_value\nFROM dora_benchmarks\nWHERE dora_report = '${dora_report:raw}'",
"hide": 2,
"includeAll": false,
"label": "TitleValue",
Expand All @@ -1271,6 +1276,6 @@
"timezone": "",
"title": "DORA Details - Deployment Frequency",
"uid": "Deployment-frequency",
"version": 11,
"version": 6,
"weekStart": ""
}
36 changes: 7 additions & 29 deletions grafana/dashboards/DORADetails-FailedDeploymentRecoveryTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 42,
"id": 17,
"links": [
{
"asDropdown": false,
Expand All @@ -30,7 +30,7 @@
"title": "Go Back ",
"tooltip": "",
"type": "link",
"url": "/d/qNo8_0M4z2/dora2?orgId=1"
"url": "/d/qNo8_0M4z/dora?orgId=1"
}
],
"liveNow": false,
Expand Down Expand Up @@ -147,7 +147,7 @@
},
{
"datasource": "mysql",
"fieldConfig": {
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "rgba(255, 255, 255, 1)",
Expand All @@ -159,7 +159,7 @@
"type": "auto"
},
"filterable": true,
"inspect": false
"inspect": true
},
"mappings": [
{
Expand Down Expand Up @@ -262,28 +262,6 @@
}
]
},
{
"matcher": {
"id": "byName",
"options": "url"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "${__data.fields[\"metric_hidden\"]}"
}
]
},
{
"id": "custom.width",
"value": 228
}
]
},
{
"matcher": {
"id": "byName",
Expand Down Expand Up @@ -337,7 +315,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "-- ***** 2023 report ***** --\n-- Metric 4: Failed deployment recovery time\nwith _deployments as (\n SELECT\n cdc.cicd_deployment_id as deployment_id,\n max(cdc.finished_date) as deployment_finished_date\n FROM \n cicd_deployment_commits cdc\n JOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n WHERE\n pm.project_name in ($project)\n and cdc.result = 'SUCCESS'\n and cdc.environment = 'PRODUCTION'\n GROUP BY 1\n HAVING $__timeFilter(max(cdc.finished_date))\n),\n\n_incidents_for_deployments as (\n SELECT\n\t\tfd.deployment_id as \"deployment_id\",\n fd.deployment_finished_date,\n -- date_format(fd.deployment_finished_date,'%y/%m') as deployment_finished_month,\n i.id as incident_id,\n i.title,\n i.url,\n i.url as \"metric_hidden\",\n -- i.created_date as incident_create_date,\n i.resolution_date as incident_resolution_date,\n\t\tTIMESTAMPDIFF(HOUR, fd.deployment_finished_date, i.resolution_date) as \"failed_deployment_recovery_time\"\n FROM\n issues i\n left join project_issue_metrics pim on i.id = pim.id\n join _deployments fd on pim.deployment_id = fd.deployment_id\n WHERE\n i.type = 'INCIDENT'\n and $__timeFilter(i.resolution_date)\n)\n\nselect \n * \nFROM \n _incidents_for_deployments\nwhere incident_resolution_date IS NOT NULL",
"rawSql": "-- ***** 2023 report ***** --\n-- Metric 4: Failed deployment recovery time\nwith _deployments as (\n SELECT\n cdc.cicd_deployment_id as deployment_id,\n max(cdc.finished_date) as deployment_finished_date\n FROM \n cicd_deployment_commits cdc\n JOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n WHERE\n pm.project_name in ($project)\n and cdc.result = 'SUCCESS'\n and cdc.environment = 'PRODUCTION'\n GROUP BY 1\n HAVING $__timeFilter(max(cdc.finished_date))\n),\n\n_incidents_for_deployments as (\n SELECT\n\t\tfd.deployment_id as \"deployment_id\",\n fd.deployment_finished_date,\n -- date_format(fd.deployment_finished_date,'%y/%m') as deployment_finished_month,\n i.id as incident_caused_by_deployment,\n i.title as incident_title,\n i.url as incident_url,\n i.url as \"metric_hidden\",\n -- i.created_date as incident_create_date,\n i.resolution_date as incident_resolution_date,\n\t\tTIMESTAMPDIFF(HOUR, fd.deployment_finished_date, i.resolution_date) as \"failed_deployment_recovery_time\"\n FROM\n issues i\n left join project_issue_metrics pim on i.id = pim.id\n join _deployments fd on pim.deployment_id = fd.deployment_id\n WHERE\n i.type = 'INCIDENT'\n and $__timeFilter(i.resolution_date)\n)\n\nselect \n * \nFROM \n _incidents_for_deployments\nwhere incident_resolution_date IS NOT NULL",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -471,7 +449,7 @@
"value": "$__all"
},
"datasource": "mysql",
"definition": "select distinct name from projects",
"definition": "select distinct name from projects",
"hide": 0,
"includeAll": true,
"label": "Project",
Expand All @@ -495,6 +473,6 @@
"timezone": "",
"title": "DORA Details - Failed Deployment Recovery Time",
"uid": "Failed-deployment-recovery-time",
"version": 18,
"version": 3,
"weekStart": ""
}
Loading
Loading