diff --git a/grafana/dashboards/WeeklyReport.json b/grafana/dashboards/WeeklyReport.json deleted file mode 100644 index 61365cc07ee..00000000000 --- a/grafana/dashboards/WeeklyReport.json +++ /dev/null @@ -1,716 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": 4, - "links": [], - "liveNow": false, - "panels": [ - { - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "gridPos": { - "h": 3, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 16, - "options": { - "code": { - "language": "plaintext", - "showLineNumbers": false, - "showMiniMap": false - }, - "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", - "targets": [ - { - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "queryType": "randomWalk", - "refId": "A" - } - ], - "type": "text" - }, - { - "datasource": "mysql", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "green", - "mode": "fixed" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "fillOpacity": 80, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineWidth": 1, - "scaleDistribution": { - "type": "linear" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 1, - "mappings": [ - { - "options": { - "0.00001": { - "color": "red", - "index": 0, - "text": "No deployed PRs in this period" - } - }, - "type": "value" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 3 - }, - "id": 17, - "links": [ - { - "targetBlank": true, - "title": "PR Cycle Time", - "url": "https://devlake.apache.org/docs/Metrics/PRCycleTime" - } - ], - "options": { - "barRadius": 0, - "barWidth": 0.5, - "fullHighlight": false, - "groupWidth": 0.7, - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "orientation": "horizontal", - "showValue": "auto", - "stacking": "none", - "text": { - "valueSize": 12 - }, - "tooltip": { - "maxHeight": 600, - "mode": "single", - "sort": "none" - }, - "xTickLabelRotation": 0, - "xTickLabelSpacing": 0 - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": "mysql", - "editorMode": "code", - "format": "table", - "group": [], - "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'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": [ - [ - { - "params": [ - "id" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "ae_projects", - "timeColumn": "ae_create_time", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "PR Cycle Time", - "type": "barchart" - }, - { - "datasource": "mysql", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "green", - "mode": "fixed" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "fillOpacity": 80, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineWidth": 1, - "scaleDistribution": { - "type": "linear" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ - { - "options": { - "0.00001": { - "color": "red", - "index": 0, - "text": "No deployed PRs in this period" - } - }, - "type": "value" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 3 - }, - "id": 18, - "links": [ - { - "targetBlank": true, - "title": "PR Cycle Time", - "url": "https://devlake.apache.org/docs/Metrics/PRCycleTime" - } - ], - "options": { - "barRadius": 0, - "barWidth": 0.5, - "colorByField": "period", - "fullHighlight": false, - "groupWidth": 0.7, - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "orientation": "horizontal", - "showValue": "always", - "stacking": "none", - "text": { - "valueSize": 12 - }, - "tooltip": { - "maxHeight": 600, - "mode": "single", - "sort": "none" - }, - "xTickLabelRotation": 0, - "xTickLabelSpacing": 0 - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": "mysql", - "editorMode": "code", - "format": "table", - "group": [], - "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'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": [ - [ - { - "params": [ - "id" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "ae_projects", - "timeColumn": "ae_create_time", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "PR Throughput", - "type": "barchart" - }, - { - "datasource": "mysql", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "axisSoftMin": 0, - "fillOpacity": 80, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineWidth": 1, - "scaleDistribution": { - "type": "linear" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ - { - "options": { - "0.00001": { - "color": "red", - "index": 0, - "text": "No production deployments in this period" - } - }, - "type": "value" - } - ], - "noValue": "No production deployments in this period", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 11 - }, - "id": 2, - "links": [ - { - "title": "link", - "url": "/d/Deployment-frequency/dora-drill-down-deployment-frequency?orgId=1&${project:queryparam}&from=${__from}&to=${__to}" - } - ], - "options": { - "barRadius": 0, - "barWidth": 0.5, - "fullHighlight": false, - "groupWidth": 0.7, - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "orientation": "horizontal", - "showValue": "auto", - "stacking": "none", - "text": { - "valueSize": 12 - }, - "tooltip": { - "maxHeight": 600, - "mode": "multi", - "sort": "none" - }, - "xTickLabelRotation": 0, - "xTickLabelSpacing": 0 - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": "mysql", - "editorMode": "code", - "format": "table", - "group": [], - "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'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": [ - [ - { - "params": [ - "id" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "_devlake_blueprints", - "timeColumn": "created_at", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Deployment frequency", - "type": "barchart" - }, - { - "datasource": "mysql", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "green", - "mode": "fixed" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "axisSoftMin": 0, - "fillOpacity": 80, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineWidth": 1, - "scaleDistribution": { - "type": "linear" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ - { - "options": { - "0.00001": { - "color": "red", - "index": 0, - "text": "No production deployments in this period" - } - }, - "type": "value" - } - ], - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 11 - }, - "id": 5, - "links": [ - { - "title": "link", - "url": "/d/Change-failure-rate/dora-drill-down-change-failure-rate?orgId=1&${project:queryparam}&from=${__from}&to=${__to}" - } - ], - "options": { - "barRadius": 0, - "barWidth": 0.5, - "fullHighlight": false, - "groupWidth": 0.7, - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "orientation": "horizontal", - "showValue": "auto", - "stacking": "none", - "text": { - "valueSize": 12 - }, - "tooltip": { - "maxHeight": 600, - "mode": "single", - "sort": "none" - }, - "xField": "period", - "xTickLabelRotation": 0, - "xTickLabelSpacing": 0 - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": "mysql", - "editorMode": "code", - "format": "table", - "group": [], - "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'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": [ - [ - { - "params": [ - "id" - ], - "type": "column" - } - ] - ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "table": "ae_projects", - "timeColumn": "ae_create_time", - "timeColumnType": "timestamp", - "where": [ - { - "name": "$__timeFilter", - "params": [], - "type": "macro" - } - ] - } - ], - "title": "Change Failure Rate", - "type": "barchart" - } - ], - "schemaVersion": 39, - "tags": [], - "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, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "isNone": true, - "selected": false, - "text": "None", - "value": "" - }, - "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}'", - "hide": 2, - "includeAll": false, - "label": "TitleValue", - "multi": false, - "name": "title_value", - "options": [], - "query": "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}'", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-7d", - "to": "now" - }, - "timeRangeUpdatedDuringEditOrView": false, - "timepicker": {}, - "timezone": "", - "title": "Weekly Report", - "uid": "fdpx91qgjm0owb", - "version": 2, - "weekStart": "" -} \ No newline at end of file