You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2022/11/03 06:15:50 UTC

[incubator-devlake] branch release-v0.14 updated: fix: jenkins dashboard can not work (#3363)

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

abeizn pushed a commit to branch release-v0.14
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.14 by this push:
     new 7d368e89 fix: jenkins dashboard can not work (#3363)
7d368e89 is described below

commit 7d368e897d951f5374d44fbe373c9d344826eb0a
Author: abeizn <zi...@merico.dev>
AuthorDate: Tue Oct 11 19:16:16 2022 +0800

    fix: jenkins dashboard can not work (#3363)
    
    * fix: jenkins dashboard can not work
    
    * fix: jenkins dashboard can not work
    
    * fix: jenkins dashboard can not work
---
 grafana/dashboards/Jenkins.json | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/grafana/dashboards/Jenkins.json b/grafana/dashboards/Jenkins.json
index 787dac40..8de9c333 100644
--- a/grafana/dashboards/Jenkins.json
+++ b/grafana/dashboards/Jenkins.json
@@ -15,8 +15,8 @@
   "editable": true,
   "gnetId": null,
   "graphTooltip": 0,
-  "id": 7,
-  "iteration": 1660821779393,
+  "id": 12,
+  "iteration": 1665485848500,
   "links": [],
   "panels": [
     {
@@ -89,7 +89,7 @@
           "group": [],
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  now() AS time,\n  count(*)\nFROM \n  builds b\n  join jobs j on b.job_id = j.id \nWHERE\n  $__timeFilter(b.started_date)\n  and j.id in ($job_id)\nORDER BY 1",
+          "rawSql": "SELECT\n  now() AS time,\n  count(*)\nFROM \n  cicd_pipelines p\nWHERE\n  $__timeFilter(p.created_date)\n  and p.id like \"%jenkins%\"\n  and p.name in ($job_id)\nORDER BY 1",
           "refId": "A",
           "select": [
             [
@@ -168,7 +168,7 @@
           "group": [],
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  now() AS time,\n  1.0 * count(case when b.status = 'SUCCESS' then 1 else null end)/count(*)\nFROM builds b\n  join jobs j on b.job_id = j.id \nWHERE\n  $__timeFilter(b.started_date)\n  and j.id in ($job_id)\nORDER BY 1",
+          "rawSql": "SELECT\n  now() AS time,\n  1.0 * count(case when p.result = 'SUCCESS' then 1 else null end)/count(*)\nFROM cicd_pipelines p\nWHERE\n  $__timeFilter(p.created_date)\n  and p.id like \"%jenkins%\"\n  and p.name in ($job_id)\nORDER BY 1",
           "refId": "A",
           "select": [
             [
@@ -286,7 +286,7 @@
           "group": [],
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  now() AS time,\n  status,\n  count(*) as build_count\nFROM builds b\n  join jobs j on b.job_id = j.id \nWHERE\n  $__timeFilter(b.started_date)\n  and j.id in ($job_id)\nGROUP BY 1,2\nORDER BY 1",
+          "rawSql": "SELECT\n  now() AS time,\n  p.result,\n  count(*) as build_count\nFROM cicd_pipelines p\nWHERE\n  $__timeFilter(p.created_date)\n  and p.id like \"%jenkins%\"\n  and p.name in ($job_id)\nGROUP BY 1,2\nORDER BY 1",
           "refId": "A",
           "select": [
             [
@@ -363,7 +363,7 @@
           "group": [],
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  now() AS time,\n  avg(duration_sec/60) as duration_in_minute\nFROM builds b\n  join jobs j on b.job_id = j.id \nWHERE\n  $__timeFilter(b.started_date)\n  and j.id in ($job_id)\nORDER BY 1",
+          "rawSql": "SELECT\n  now() AS time,\n  avg(p.duration_sec/60) as duration_in_minute\nFROM cicd_pipelines p\nWHERE\n  $__timeFilter(p.created_date)\n  and p.id like \"%jenkins%\"\n  and p.name in ($job_id)\nORDER BY 1",
           "refId": "A",
           "select": [
             [
@@ -462,7 +462,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _builds as(\n  SELECT\n    DATE_ADD(date(b.started_date), INTERVAL -DAYOFMONTH(date(b.started_date))+1 DAY) as time,\n    count(*) as build_count\n  FROM builds b\n  join jobs j on b.job_id = j.id \nWHERE\n  $__timeFilter(b.started_date)\n  and j.id in ($job_id)\n  group by 1\n)\n\nSELECT \n  date_format(time,'%M %Y') as month,\n  build_count as \"Build Count\"\nFROM _builds\nORDER BY time\n",
+          "rawSql": "with _builds as(\n  SELECT\n    DATE_ADD(date(p.created_date), INTERVAL -DAYOFMONTH(date(p.created_date))+1 DAY) as time,\n    count(*) as build_count\n  FROM cicd_pipelines p\nWHERE\n  $__timeFilter(p.created_date)\n  and p.id like \"%jenkins%\"\n  and p.name in ($job_id)\n  group by 1\n)\n\nSELECT \n  date_format(time,'%M %Y') as month,\n  build_count as \"Build Count\"\nFROM _builds\nORDER BY time\n",
           "refId": "A",
           "select": [
             [
@@ -578,7 +578,7 @@
           "group": [],
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _build_success_rate as(\r\n  SELECT\r\n    DATE_ADD(date(b.started_date), INTERVAL -DAYOFMONTH(date(b.started_date))+1 DAY) as time,\r\n    b.status\r\n  FROM\r\n    builds b\r\n  join jobs j on b.job_id = j.id \r\nWHERE\r\n  $__timeFilter(b.started_date)\r\n  and j.id in ($job_id)\r\n)\r\n\r\nSELECT \r\n  date_format(time,'%M %Y') as month,\r\n  1.0 * sum(case when status = 'SUCCESS' then 1 else 0 end)/ count(*) as \"Build Success Rate\"\r\nFROM _build_success_ [...]
+          "rawSql": "with _build_success_rate as(\r\n  SELECT\r\n    DATE_ADD(date(p.created_date), INTERVAL -DAYOFMONTH(date(p.created_date))+1 DAY) as time,\r\n    p.result as result\r\n  FROM\r\n    cicd_pipelines p\r\nWHERE\r\n  $__timeFilter(p.created_date)\r\n  and p.id like \"%jenkins%\"\r\n  and p.name in ($job_id)\r\n)\r\n\r\nSELECT \r\n  date_format(time,'%M %Y') as month,\r\n  1.0 * sum(case when result = 'SUCCESS' then 1 else 0 end)/ count(*) as \"Build Success Rate\"\r\nFROM [...]
           "refId": "A",
           "select": [
             [
@@ -718,7 +718,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  DATE_ADD(date(b.started_date), INTERVAL -DAYOFMONTH(date(b.started_date))+1 DAY) as time,\n  count(distinct case when b.status = 'SUCCESS' then b.id else null end) as successful_build_count,\n  count(distinct case when b.status != 'SUCCESS' then b.id else null end) as failed_build_count\nFROM builds b\n  join jobs j on b.job_id = j.id\nWHERE\n  $__timeFilter(b.started_date)\n  and j.id in ($job_id)\ngroup by 1",
+          "rawSql": "SELECT\n  DATE_ADD(date(p.created_date), INTERVAL -DAYOFMONTH(date(p.created_date))+1 DAY) as time,\n  count(distinct case when p.result = 'SUCCESS' then p.id else null end) as successful_build_count,\n  count(distinct case when p.result != 'SUCCESS' then p.id else null end) as failed_build_count\nFROM cicd_pipelines p\nWHERE\n  $__timeFilter(p.created_date)\n  and p.id like \"%jenkins%\"\n  and p.name in ($job_id)\ngroup by 1",
           "refId": "A",
           "select": [
             [
@@ -831,7 +831,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with _builds as(\n  SELECT\n    DATE_ADD(date(started_date), INTERVAL -DAYOFMONTH(date(started_date))+1 DAY) as time,\n    avg(duration_sec) as duration\n  FROM \n    builds b\n    join jobs j on b.job_id = j.id \nWHERE\n  $__timeFilter(b.started_date)\n  and j.id in ($job_id)\n  group by 1\n)\n\nSELECT \n  date_format(time,'%M %Y') as month,\n  duration/60 as duration_in_minute\nFROM _builds\nORDER BY time\n",
+          "rawSql": "with _builds as(\n  SELECT\n    DATE_ADD(date(p.created_date), INTERVAL -DAYOFMONTH(date(p.created_date))+1 DAY) as time,\n    avg(p.duration_sec) as duration\n  FROM \n    cicd_pipelines p\nWHERE\n  $__timeFilter(p.created_date)\n  and p.id like \"%jenkins%\"\n  and p.name in ($job_id)\n  group by 1\n)\n\nSELECT \n  date_format(time,'%M %Y') as month,\n  duration/60 as duration_in_minute\nFROM _builds\nORDER BY time\n",
           "refId": "A",
           "select": [
             [
@@ -881,6 +881,7 @@
       "type": "text"
     }
   ],
+  "refresh": "",
   "schemaVersion": 30,
   "style": "dark",
   "tags": [],
@@ -898,7 +899,7 @@
           ]
         },
         "datasource": "mysql",
-        "definition": "select concat(name, '--', id) as text from jobs ",
+        "definition": "select distinct concat(name, '--', name) as text from cicd_pipelines where id like \"%jenkins%\" ",
         "description": null,
         "error": null,
         "hide": 0,
@@ -907,7 +908,7 @@
         "multi": true,
         "name": "job_id",
         "options": [],
-        "query": "select concat(name, '--', id) as text from jobs ",
+        "query": "select distinct concat(name, '--', name) as text from cicd_pipelines where id like \"%jenkins%\" ",
         "refresh": 1,
         "regex": "/^(?<text>.*)--(?<value>.*)$/",
         "skipUrlSync": false,
@@ -924,5 +925,5 @@
   "timezone": "",
   "title": "Jenkins",
   "uid": "W8AiDFQnk",
-  "version": 3
+  "version": 53
 }
\ No newline at end of file