You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/07/31 10:38:14 UTC

(incubator-devlake) branch release-v1.0 updated: feat(dashboard): use incident tables in dashboards (#7798) (#7804)

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

lynwee pushed a commit to branch release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v1.0 by this push:
     new a72d90e2f feat(dashboard): use incident tables in dashboards (#7798) (#7804)
a72d90e2f is described below

commit a72d90e2f8108f47bd8d87123cdea52aa97f813f
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Wed Jul 31 18:38:10 2024 +0800

    feat(dashboard): use incident tables in dashboards (#7798) (#7804)
    
    * feat(dashboard): use incident tables in dora-detail:change failure rate
    
    * fix(dashboard): fix sql errors
    
    * feat(dashboard): use incident tables in dora-detail:failed deployment recovery time
    
    * fix(dashboard): dora detail supports table: incidents
    
    Co-authored-by: Lynwee <15...@qq.com>
---
 grafana/dashboards/DORADetails-ChangeFailureRate.json      | 14 +++++++-------
 .../DORADetails-FailedDeploymentRecoveryTime.json          | 10 +++++-----
 grafana/dashboards/DORADetails-TimetoRestoreService.json   |  8 ++++----
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/grafana/dashboards/DORADetails-ChangeFailureRate.json b/grafana/dashboards/DORADetails-ChangeFailureRate.json
index e9d165ce7..de3fe69dc 100644
--- a/grafana/dashboards/DORADetails-ChangeFailureRate.json
+++ b/grafana/dashboards/DORADetails-ChangeFailureRate.json
@@ -164,7 +164,7 @@
           "metricColumn": "none",
           "queryType": "randomWalk",
           "rawQuery": true,
-          "rawSql": "-- Metric 3: change failure rate\nwith _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 proje [...]
+          "rawSql": "-- Metric 3: change failure rate\nwith _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  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 proj [...]
           "refId": "A",
           "select": [
             [
@@ -502,7 +502,7 @@
           "metricColumn": "none",
           "queryType": "randomWalk",
           "rawQuery": true,
-          "rawSql": "-- Metric 3: change failure rate\nwith _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 proje [...]
+          "rawSql": "-- Metric 3: change failure rate\nwith _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  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 proj [...]
           "refId": "A",
           "select": [
             [
@@ -547,7 +547,7 @@
     },
     {
       "datasource": "mysql",
-        "description": "",
+      "description": "",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -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        -- cho [...]
+          "rawSql": "with _deployments as(\n  select\n    distinct 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\n    and pm.`table` = 'cicd_scopes'\n  where\n    -- only result needs to specified, not envioronment\n    d.result = 'SUCCESS' -- choose your project_name\n    and pm.project_name in ($p [...]
           "refId": "A",
           "select": [
             [
@@ -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",
@@ -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",
@@ -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",
diff --git a/grafana/dashboards/DORADetails-FailedDeploymentRecoveryTime.json b/grafana/dashboards/DORADetails-FailedDeploymentRecoveryTime.json
index edc06606d..ad5331e4d 100644
--- a/grafana/dashboards/DORADetails-FailedDeploymentRecoveryTime.json
+++ b/grafana/dashboards/DORADetails-FailedDeploymentRecoveryTime.json
@@ -121,7 +121,7 @@
           "format": "table",
           "hide": false,
           "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 [...]
+          "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\n    and pm.`table` = 'cicd_scopes'\n  WHERE\n    pm.project_name in ($project)\n    and cdc.result = 'SUCCESS'\n    and cdc.environment = 'PRODUCTION'\n  [...]
           "refId": "D",
           "sql": {
             "columns": [
@@ -147,7 +147,7 @@
     },
     {
       "datasource": "mysql",
-              "fieldConfig": {
+      "fieldConfig": {
         "defaults": {
           "color": {
             "fixedColor": "rgba(255, 255, 255, 1)",
@@ -315,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 [...]
+          "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\n    and pm.`table` = 'cicd_scopes'\n  WHERE\n    pm.project_name in ($project)\n    and cdc.result = 'SUCCESS'\n    and cdc.environment = 'PRODUCTION'\n  [...]
           "refId": "A",
           "select": [
             [
@@ -409,7 +409,7 @@
           "format": "table",
           "hide": false,
           "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 [...]
+          "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\n    and pm.`table` = 'cicd_scopes'\n  WHERE\n    pm.project_name in ($project)\n    and cdc.result = 'SUCCESS'\n    and cdc.environment = 'PRODUCTION'\n  [...]
           "refId": "D",
           "sql": {
             "columns": [
@@ -449,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",
diff --git a/grafana/dashboards/DORADetails-TimetoRestoreService.json b/grafana/dashboards/DORADetails-TimetoRestoreService.json
index c6a1358c7..652874e45 100644
--- a/grafana/dashboards/DORADetails-TimetoRestoreService.json
+++ b/grafana/dashboards/DORADetails-TimetoRestoreService.json
@@ -121,7 +121,7 @@
           "format": "table",
           "hide": false,
           "rawQuery": true,
-          "rawSql": "--  ***** 2021 report ***** --\n-- Metric 4: Median time to restore service \n\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 cd [...]
+          "rawSql": "--  ***** 2021 report ***** --\n-- Metric 4: Median time to restore service \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\n    and pm.`table` = 'cicd_scopes'\n  WHERE\n    pm.project_name in ($project)\n    and cdc.result = 'SUCCESS'\n    and cdc.environment = 'PRODUCTION'\n   [...]
           "refId": "D",
           "sql": {
             "columns": [
@@ -301,7 +301,7 @@
           "metricColumn": "none",
           "queryType": "randomWalk",
           "rawQuery": true,
-          "rawSql": "--  ***** 2021 report ***** --\n-- Metric 4: Median time to restore service \nwith _incidents as (\n-- get the incidents created within the selected time period in the top-right corner\n\tSELECT\n\t  distinct i.id as \"incident_id\",\n\t\ti.title,\n\t\ti.url,\n\t\ti.url as \"metric_hidden\",\n\t\t-- i.created_date,\n    i.resolution_date,\n\t  cast(lead_time_minutes/60 as signed) as time_to_restore_service\n\tFROM\n\t\tissues i\n\t  join board_issues bi on i.id = bi. [...]
+          "rawSql": "--  ***** 2021 report ***** --\n-- Metric 4: Median time to restore service \nwith _incidents as (\n-- get the incidents created within the selected time period in the top-right corner\n  SELECT\n    distinct i.id as \"incident_id\",\n    i.title,\n    i.url,\n    i.url as \"metric_hidden\",\n    -- i.created_date,\n    i.resolution_date,\n    cast(lead_time_minutes/60 as signed) as time_to_restore_service\n  FROM\n    incidents i    \n    join project_mapping pm on  [...]
           "refId": "A",
           "select": [
             [
@@ -396,7 +396,7 @@
           "format": "table",
           "hide": false,
           "rawQuery": true,
-          "rawSql": "--  ***** 2021 report ***** --\n-- Metric 4: Median time to restore service \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. [...]
+          "rawSql": "--  ***** 2021 report ***** --\n-- Metric 4: Median time to restore service \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. [...]
           "refId": "D",
           "sql": {
             "columns": [
@@ -436,7 +436,7 @@
           "value": "$__all"
         },
         "datasource": "mysql",
-                  "definition": "select distinct name from projects",
+        "definition": "select distinct name from projects",
         "hide": 0,
         "includeAll": true,
         "label": "Project",