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

(cherrypick to v1.0) fix: update the wording of the weekly report dashboard (#7682) #7683

Merged
merged 1 commit into from
Jun 28, 2024
Merged
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
19 changes: 8 additions & 11 deletions grafana/dashboards/WeeklyReport.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 21,
"id": 4,
"links": [],
"liveNow": false,
"panels": [
Expand All @@ -40,7 +40,7 @@
"showLineNumbers": false,
"showMiniMap": false
},
"content": "- This dashboard shows all the key metrics in the weekly report.",
"content": "**Data display conventions for each panel:**\n\n- **First Series:** This series displays data for the most recent N days. For N equal to 7, the label will be 'Last Week'.\n- **'Past 3 Months' Series:** This series displays data for the three months preceding the data in the first series.",
"mode": "markdown"
},
"pluginVersion": "11.0.0",
Expand All @@ -54,7 +54,6 @@
"refId": "A"
}
],
"title": "Dashboard Introduction",
"type": "text"
},
{
Expand Down Expand Up @@ -108,8 +107,7 @@
"value": null
}
]
},
"unit": "d"
}
},
"overrides": []
},
Expand Down Expand Up @@ -162,7 +160,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "with _deployed_prs as(\n SELECT\n pr.id,\n cdc.finished_date as pr_deployed_date,\n -- convert null to 0 if a PR has no cycle_time\n\t prm.pr_cycle_time\n FROM pull_requests pr\n left join project_pr_metrics prm on pr.id = prm.id\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n join cicd_deployment_commits cdc on prm.deployment_commit_id = cdc.id\n WHERE\n -- filter the deployed PRs\n cdc.finished_date is not NULL\n and prm.pr_cycle_time is not null \n and cdc.result = 'SUCCESS' \n and cdc.environment = 'PRODUCTION' \n and pm.project_name in (${project})\n GROUP BY 1,2,3\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n\tIFNULL(round(avg(pr_cycle_time)/1440,1),0.00001) as avg_cycle_time_in_days\nFROM \n\t_deployed_prs\nWHERE \n\tpr_deployed_date >= $__timeFrom()\n\tand pr_deployed_date < $__timeTo()\n\nunion\n\nSELECT \n\t'3 months before the above period' as period,\n\tIFNULL(round(avg(pr_cycle_time)/1440,1), 0.00001) as avg_cycle_time_in_days\nFROM \n\t_deployed_prs\nWHERE \n pr_deployed_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand pr_deployed_date < $__timeFrom()\n",
"rawSql": "with _deployed_prs as(\n SELECT\n pr.id,\n cdc.finished_date as pr_deployed_date,\n -- convert null to 0 if a PR has no cycle_time\n\t prm.pr_cycle_time\n FROM pull_requests pr\n left join project_pr_metrics prm on pr.id = prm.id\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n join cicd_deployment_commits cdc on prm.deployment_commit_id = cdc.id\n WHERE\n -- filter the deployed PRs\n cdc.finished_date is not NULL\n and prm.pr_cycle_time is not null \n and cdc.result = 'SUCCESS' \n and cdc.environment = 'PRODUCTION' \n and pm.project_name in (${project})\n GROUP BY 1,2,3\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n\tIFNULL(round(avg(pr_cycle_time)/1440,1),0.00001) as avg_cycle_time_in_days\nFROM \n\t_deployed_prs\nWHERE \n\tpr_deployed_date >= $__timeFrom()\n\tand pr_deployed_date < $__timeTo()\n\nunion\n\nSELECT \n\t'Past 3 months' as period,\n\tIFNULL(round(avg(pr_cycle_time)/1440,1), 0.00001) as avg_cycle_time_in_days\nFROM \n\t_deployed_prs\nWHERE \n pr_deployed_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand pr_deployed_date < $__timeFrom()\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -311,7 +309,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "with _deployed_prs as(\n SELECT\n pr.id,\n cdc.finished_date as pr_deployed_date,\n -- convert null to 0 if a PR has no cycle_time to make sure cycle_time equals the sum of the four metrics below\n\t\tcoalesce(prm.pr_cycle_time/60,0) as cycle_time\n FROM pull_requests pr\n left join project_pr_metrics prm on pr.id = prm.id\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n join cicd_deployment_commits cdc on prm.deployment_commit_id = cdc.id\n WHERE\n -- filter the deployed PRs\n cdc.finished_date is not NULL\n and prm.pr_cycle_time is not null \n and cdc.result = 'SUCCESS' \n and cdc.environment = 'PRODUCTION' \n and pm.project_name in (${project})\n GROUP BY 1,2,3\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n case when count(distinct id) = 0 then 0.00001 else round(count(id)/DATEDIFF($__timeTo(), $__timeFrom())*7, 1) end as avg_deployed_pr_per_week\nFROM \n\t_deployed_prs\nWHERE \n\tpr_deployed_date >= $__timeFrom()\n\tand pr_deployed_date < $__timeTo()\n\nunion\n\nSELECT \n\t'3 months before the above period' as period,\n case when count(distinct id) = 0 then 0.00001 else round(count(id)/DATEDIFF($__timeFrom(), $__timeFrom() - INTERVAL 3 MONTH)*7, 1) end as avg_deployed_pr_per_week\nFROM \n\t_deployed_prs\nWHERE \n\tpr_deployed_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand pr_deployed_date < $__timeFrom()\n",
"rawSql": "with _deployed_prs as(\n SELECT\n pr.id,\n cdc.finished_date as pr_deployed_date,\n -- convert null to 0 if a PR has no cycle_time to make sure cycle_time equals the sum of the four metrics below\n\t\tcoalesce(prm.pr_cycle_time/60,0) as cycle_time\n FROM pull_requests pr\n left join project_pr_metrics prm on pr.id = prm.id\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n join cicd_deployment_commits cdc on prm.deployment_commit_id = cdc.id\n WHERE\n -- filter the deployed PRs\n cdc.finished_date is not NULL\n and prm.pr_cycle_time is not null \n and cdc.result = 'SUCCESS' \n and cdc.environment = 'PRODUCTION' \n and pm.project_name in (${project})\n GROUP BY 1,2,3\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n case when count(distinct id) = 0 then 0.00001 else round(count(id)/DATEDIFF($__timeTo(), $__timeFrom())*7, 1) end as avg_deployed_pr_per_week\nFROM \n\t_deployed_prs\nWHERE \n\tpr_deployed_date >= $__timeFrom()\n\tand pr_deployed_date < $__timeTo()\n\nunion\n\nSELECT \n\t'Past 3 months' as period,\n case when count(distinct id) = 0 then 0.00001 else round(count(id)/DATEDIFF($__timeFrom(), $__timeFrom() - INTERVAL 3 MONTH)*7, 1) end as avg_deployed_pr_per_week\nFROM \n\t_deployed_prs\nWHERE \n\tpr_deployed_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand pr_deployed_date < $__timeFrom()\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -457,7 +455,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "with _deployments as(\n-- When deploying multiple commits in one pipeline, GitLab and BitBucket may generate more than one deployment. However, DevLake consider these deployments as ONE production deployment and use the last one's finished_date as the finished date.\n\t\tSELECT\n\t\t\tcdc.cicd_deployment_id,\n\t\t\tmax(cdc.finished_date) as deployment_finished_date\n\t\tFROM cicd_deployment_commits cdc\n\t\tJOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n\t\tWHERE\n\t\t\tpm.project_name in (${project})\n\t\t\tand cdc.result = 'SUCCESS'\n\t\t\tand cdc.environment = 'PRODUCTION'\n\t\tGROUP BY 1\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n\tcase when count(cicd_deployment_id) = 0 then 0.00001 else round(count(cicd_deployment_id)/DATEDIFF($__timeTo(), $__timeFrom())*7, 1) end as avg_deployments_per_week\nFROM \n\t_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom()\n\tand deployment_finished_date < $__timeTo()\n\nunion\n\nSELECT \n\t'3 months before the above period' as period,\n\tcase when count(cicd_deployment_id) = 0 then 0.00001 else round(count(cicd_deployment_id)/DATEDIFF($__timeFrom(), $__timeFrom() - INTERVAL 3 MONTH)*7, 1) end as avg_deployments_per_week\nFROM \n\t_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand deployment_finished_date < $__timeFrom()\n",
"rawSql": "with _deployments as(\n-- When deploying multiple commits in one pipeline, GitLab and BitBucket may generate more than one deployment. However, DevLake consider these deployments as ONE production deployment and use the last one's finished_date as the finished date.\n\t\tSELECT\n\t\t\tcdc.cicd_deployment_id,\n\t\t\tmax(cdc.finished_date) as deployment_finished_date\n\t\tFROM cicd_deployment_commits cdc\n\t\tJOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n\t\tWHERE\n\t\t\tpm.project_name in (${project})\n\t\t\tand cdc.result = 'SUCCESS'\n\t\t\tand cdc.environment = 'PRODUCTION'\n\t\tGROUP BY 1\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n\tcase when count(cicd_deployment_id) = 0 then 0.00001 else round(count(cicd_deployment_id)/DATEDIFF($__timeTo(), $__timeFrom())*7, 1) end as avg_deployments_per_week\nFROM \n\t_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom()\n\tand deployment_finished_date < $__timeTo()\n\nunion\n\nSELECT \n\t'Past 3 months' as period,\n\tcase when count(cicd_deployment_id) = 0 then 0.00001 else round(count(cicd_deployment_id)/DATEDIFF($__timeFrom(), $__timeFrom() - INTERVAL 3 MONTH)*7, 1) end as avg_deployments_per_week\nFROM \n\t_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand deployment_finished_date < $__timeFrom()\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -606,7 +604,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "with _deployments as (\n-- When deploying multiple commits in one pipeline, GitLab and BitBucket may generate more than one deployment. However, DevLake consider these deployments as ONE production deployment and use the last one's finished_date as the finished date.\n\tSELECT\n\t\tcdc.cicd_deployment_id as deployment_id,\n\t\tmax(cdc.finished_date) as deployment_finished_date\n\tFROM \n\t\tcicd_deployment_commits cdc\n\t\tJOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n\tWHERE\n\t\tpm.project_name in (${project})\n\t\tand cdc.result = 'SUCCESS'\n\t\tand cdc.environment = 'PRODUCTION'\n\tGROUP BY 1\n),\n\n_failure_caused_by_deployments as (\n-- calculate the number of incidents caused by each deployment\n\tSELECT\n\t\td.deployment_id,\n\t\td.deployment_finished_date,\n\t\tcount(distinct case when i.type = 'INCIDENT' then d.deployment_id else null end) as has_incident\n\tFROM\n\t\t_deployments d\n\t\tleft join project_issue_metrics pim on d.deployment_id = pim.deployment_id\n\t\tleft join issues i on pim.id = i.id\n\tGROUP BY 1,2\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n\tIFNULL(sum(has_incident)/count(deployment_id), 0.00001) as change_failure_rate\nFROM _failure_caused_by_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom()\n\tand deployment_finished_date < $__timeTo()\n\nunion\n\nSELECT \n\t'3 months before the above period' as period,\n\tIFNULL(sum(has_incident)/count(deployment_id), 0) as change_failure_rate\nFROM _failure_caused_by_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand deployment_finished_date < $__timeFrom()\n",
"rawSql": "with _deployments as (\n-- When deploying multiple commits in one pipeline, GitLab and BitBucket may generate more than one deployment. However, DevLake consider these deployments as ONE production deployment and use the last one's finished_date as the finished date.\n\tSELECT\n\t\tcdc.cicd_deployment_id as deployment_id,\n\t\tmax(cdc.finished_date) as deployment_finished_date\n\tFROM \n\t\tcicd_deployment_commits cdc\n\t\tJOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'\n\tWHERE\n\t\tpm.project_name in (${project})\n\t\tand cdc.result = 'SUCCESS'\n\t\tand cdc.environment = 'PRODUCTION'\n\tGROUP BY 1\n),\n\n_failure_caused_by_deployments as (\n-- calculate the number of incidents caused by each deployment\n\tSELECT\n\t\td.deployment_id,\n\t\td.deployment_finished_date,\n\t\tcount(distinct case when i.type = 'INCIDENT' then d.deployment_id else null end) as has_incident\n\tFROM\n\t\t_deployments d\n\t\tleft join project_issue_metrics pim on d.deployment_id = pim.deployment_id\n\t\tleft join issues i on pim.id = i.id\n\tGROUP BY 1,2\n)\n\nSELECT\n\tcase when DATEDIFF($__timeTo(), $__timeFrom()) = 7 then 'Last week' else concat('Last ', DATEDIFF($__timeTo(), $__timeFrom()), ' days') end as period,\n\tIFNULL(sum(has_incident)/count(deployment_id), 0.00001) as change_failure_rate\nFROM _failure_caused_by_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom()\n\tand deployment_finished_date < $__timeTo()\n\nunion\n\nSELECT \n\t'Past 3 months' as period,\n\tIFNULL(sum(has_incident)/count(deployment_id), 0) as change_failure_rate\nFROM _failure_caused_by_deployments\nWHERE \n\tdeployment_finished_date >= $__timeFrom() - INTERVAL 3 MONTH \n\tand deployment_finished_date < $__timeFrom()\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -651,7 +649,6 @@
"type": "barchart"
}
],
"refresh": "",
"schemaVersion": 39,
"tags": [],
"templating": {
Expand Down Expand Up @@ -714,6 +711,6 @@
"timezone": "",
"title": "Weekly Report",
"uid": "fdpx91qgjm0owb",
"version": 11,
"version": 2,
"weekStart": ""
}
Loading