From 76be50ca9cd5b36221866a842c0ac3d5d36c924e Mon Sep 17 00:00:00 2001 From: Kirill Zhukov Date: Wed, 8 Mar 2023 00:02:25 +0100 Subject: [PATCH] Grafana: Added new dashboards, improved old ones --- grafana-dashbords/Build analytics.json | 556 ++++++++++++-------- grafana-dashbords/Build details.json | 244 +++++++++ grafana-dashbords/Build task details.json | 584 +++++++++++++--------- 3 files changed, 951 insertions(+), 433 deletions(-) create mode 100644 grafana-dashbords/Build details.json diff --git a/grafana-dashbords/Build analytics.json b/grafana-dashbords/Build analytics.json index c0748d8..7de3172 100644 --- a/grafana-dashbords/Build analytics.json +++ b/grafana-dashbords/Build analytics.json @@ -1,8 +1,8 @@ { "__inputs": [ { - "name": "DS_ALBS_ANALYTICS", - "label": "albs_analytics", + "name": "DS_POSTGRESQL", + "label": "PostgreSQL", "description": "", "type": "datasource", "pluginId": "postgres", @@ -11,11 +11,17 @@ ], "__elements": {}, "__requires": [ + { + "type": "panel", + "id": "bargauge", + "name": "Bar gauge", + "version": "" + }, { "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "9.3.6" + "version": "9.3.2" }, { "type": "panel", @@ -64,7 +70,7 @@ } ] }, - "editable": false, + "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, "id": null, @@ -87,7 +93,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "fieldConfig": { "defaults": { @@ -171,7 +177,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -200,7 +206,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -233,7 +239,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "description": "", "fieldConfig": { @@ -363,7 +369,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -392,7 +398,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -421,7 +427,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -450,7 +456,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -479,7 +485,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -512,7 +518,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "description": "", "fieldConfig": { @@ -702,7 +708,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -731,7 +737,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -760,7 +766,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -789,7 +795,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -818,7 +824,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "format": "table", @@ -851,7 +857,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "fieldConfig": { "defaults": { @@ -894,13 +900,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.6", + "pluginVersion": "9.3.2", "targets": [ { "cacheDurationSeconds": 300, "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "fields": [ @@ -913,7 +919,7 @@ "queryParams": "", "rawQuery": true, "rawSql": "SELECT MAX(finished_at - created_at) AS MAX\nFROM builds\nWHERE $__unixEpochFilter(created_at) AND finished_at IS NOT NULL;", - "refId": "MAX", + "refId": "max", "sql": { "columns": [ { @@ -937,7 +943,7 @@ "cacheDurationSeconds": 300, "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "fields": [ @@ -951,7 +957,7 @@ "queryParams": "", "rawQuery": true, "rawSql": "SELECT MIN(finished_at - created_at) AS MIN\nFROM builds\nWHERE $__unixEpochFilter(created_at) AND finished_at IS NOT NULL;", - "refId": "MIN", + "refId": "min", "sql": { "columns": [ { @@ -972,24 +978,16 @@ "urlPath": "" }, { - "cacheDurationSeconds": 300, "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", - "fields": [ - { - "jsonPath": "" - } - ], "format": "table", "hide": false, - "method": "GET", - "queryParams": "", "rawQuery": true, - "rawSql": "SELECT AVG(finished_at - created_at) AS AVG\nFROM builds\nWHERE $__unixEpochFilter(created_at) AND finished_at IS NOT NULL;", - "refId": "AVG", + "rawSql": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY durations.duration) as median FROM \n(SELECT (finished_at - created_at) AS duration \n FROM builds\n WHERE $__unixEpochFilter(created_at) AND finished_at IS NOT NULL) as durations\n", + "refId": "meidan", "sql": { "columns": [ { @@ -1006,8 +1004,7 @@ } ], "limit": 50 - }, - "urlPath": "" + } } ], "title": "Build duration", @@ -1016,7 +1013,7 @@ { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "description": "", "fieldConfig": { @@ -1060,13 +1057,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.3.6", + "pluginVersion": "9.3.2", "targets": [ { "cacheDurationSeconds": 300, "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "fields": [ @@ -1079,7 +1076,7 @@ "queryParams": "", "rawQuery": true, "rawSql": "SELECT MAX(finished_at - started_at) AS MAX\nFROM build_tasks\nWHERE $__unixEpochFilter(started_at) AND finished_at IS NOT NULL AND status_id <> 4", - "refId": "MAX", + "refId": "max", "sql": { "columns": [ { @@ -1103,7 +1100,7 @@ "cacheDurationSeconds": 300, "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "fields": [ @@ -1117,7 +1114,7 @@ "queryParams": "", "rawQuery": true, "rawSql": "SELECT MIN(finished_at - started_at) AS MIN\nFROM build_tasks\nWHERE $__unixEpochFilter(started_at) AND finished_at IS NOT NULL AND status_id <> 4", - "refId": "MIN", + "refId": "min", "sql": { "columns": [ { @@ -1141,7 +1138,7 @@ "cacheDurationSeconds": 300, "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "fields": [ @@ -1154,8 +1151,8 @@ "method": "GET", "queryParams": "", "rawQuery": true, - "rawSql": "SELECT AVG(finished_at - started_at) AS AVG\nFROM build_tasks\nWHERE $__unixEpochFilter(started_at) AND finished_at IS NOT NULL AND status_id <> 4", - "refId": "AVG", + "rawSql": "SELECT PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY durations.duration) as median FROM \n(SELECT (finished_at - started_at) AS duration\nFROM build_tasks\nWHERE $__unixEpochFilter(started_at) AND finished_at IS NOT NULL AND status_id <> 4) as durations\n\n\n", + "refId": "median", "sql": { "columns": [ { @@ -1180,22 +1177,308 @@ "type": "stat" }, { - "collapsed": false, + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "#61a69d", + "mode": "fixed" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, "gridPos": { - "h": 1, + "h": 8, "w": 24, "x": 0, "y": 15 }, - "id": 5, - "panels": [], - "title": "Build details", - "type": "row" + "id": 20, + "options": { + "displayMode": "gradient", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": false + }, + "pluginVersion": "9.3.2", + "targets": [ + { + "cacheDurationSeconds": 300, + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "fields": [ + { + "jsonPath": "" + } + ], + "format": "table", + "method": "GET", + "queryParams": "", + "rawQuery": true, + "rawSql": "SELECT SUM(end_ts - start_ts) as upload\nFROM build_node_stats \nWHERE stat_name_id = 0 AND $__unixEpochFilter(start_ts);", + "refId": "upload", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "start_ts", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "build_node_stats", + "urlPath": "" + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT SUM(end_ts - start_ts) as build_srpm\nFROM build_node_stats \nWHERE stat_name_id = 2 AND $__unixEpochFilter(start_ts);", + "refId": "build_srpm", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT SUM(end_ts - start_ts) as git_checkout\nFROM build_node_stats \nWHERE stat_name_id = 3 AND $__unixEpochFilter(start_ts);", + "refId": "git_checkout", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT end_ts - start_ts as build_binaries\nFROM build_node_stats \nWHERE stat_name_id = 4 AND $__unixEpochFilter(start_ts);", + "refId": "build_binaries", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT end_ts - start_ts as notarize_artifacts\nFROM build_node_stats \nWHERE stat_name_id = 7 AND $__unixEpochFilter(start_ts)", + "refId": "cas_notarize_artifacts", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT SUM(end_ts - start_ts) as source_authenticate\nFROM build_node_stats \nWHERE stat_name_id = 8 AND $__unixEpochFilter(start_ts);", + "refId": "cas_source_authenticate", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT SUM(end_ts - start_ts) as logs_processing\nFROM web_node_stats \nWHERE stat_name_id = 1 AND $__unixEpochFilter(start_ts);", + "refId": "logs_processing", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT SUM(end_ts - start_ts) as packages_processing\nFROM web_node_stats \nWHERE stat_name_id = 2 AND $__unixEpochFilter(start_ts);", + "refId": "B", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Build task steps duration (SUM)", + "type": "bargauge" }, { "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "description": "", "fieldConfig": { @@ -1260,6 +1543,23 @@ "value": 107 } ] + }, + { + "matcher": { + "id": "byName", + "options": "id" + }, + "properties": [ + { + "id": "links", + "value": [ + { + "title": "", + "url": "/d/dmVtrz-4k/build-details?orgId=1&var-build_id=${__value.raw}" + } + ] + } + ] } ] }, @@ -1267,7 +1567,7 @@ "h": 15, "w": 24, "x": 0, - "y": 16 + "y": 23 }, "id": 2, "options": { @@ -1286,13 +1586,13 @@ } ] }, - "pluginVersion": "9.3.6", + "pluginVersion": "9.3.2", "targets": [ { "cacheDurationSeconds": 300, "datasource": { "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" + "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", "fields": [ @@ -1347,146 +1647,6 @@ } ], "type": "table" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 31 - }, - "id": 7, - "panels": [], - "title": "Build tasks details", - "type": "row" - }, - { - "datasource": { - "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "center", - "displayMode": "auto", - "filterable": true, - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "duration" - }, - "properties": [ - { - "id": "unit", - "value": "s" - } - ] - } - ] - }, - "gridPos": { - "h": 12, - "w": 24, - "x": 0, - "y": 32 - }, - "id": 15, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [ - { - "desc": false, - "displayName": "duration" - } - ] - }, - "pluginVersion": "9.3.6", - "targets": [ - { - "cacheDurationSeconds": 300, - "datasource": { - "type": "postgres", - "uid": "${DS_ALBS_ANALYTICS}" - }, - "editorMode": "code", - "fields": [ - { - "jsonPath": "" - } - ], - "format": "table", - "method": "GET", - "queryParams": "", - "rawQuery": true, - "rawSql": "SELECT\n bt.id,\n bt.name,\n bt.build_id,\n arch_enum.value AS arch,\n status_enum.value AS status,\n bt.started_at * 1000 AS started,\n bt.finished_at * 1000 AS finished,\n bt.finished_at - bt.started_at AS duration \nFROM build_tasks AS bt\nJOIN build_task_status_enum AS status_enum ON bt.status_id = status_enum.id\nJOIN arch_enum on bt.arch_id = arch_enum.id\nWHERE $__unixEpochFilter(started_at) AND status_id >= 2;", - "refId": "A", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, - "urlPath": "" - } - ], - "title": "Finished buld tasks", - "transformations": [ - { - "id": "convertFieldType", - "options": { - "conversions": [ - { - "destinationType": "time", - "targetField": "started" - }, - { - "destinationType": "time", - "targetField": "finished" - } - ], - "fields": {} - } - } - ], - "type": "table" } ], "refresh": "1m", @@ -1504,6 +1664,6 @@ "timezone": "", "title": "Build analytics", "uid": "02mg4oxVk", - "version": 3, + "version": 21, "weekStart": "" } \ No newline at end of file diff --git a/grafana-dashbords/Build details.json b/grafana-dashbords/Build details.json new file mode 100644 index 0000000..d39e49a --- /dev/null +++ b/grafana-dashbords/Build details.json @@ -0,0 +1,244 @@ +{ + "__inputs": [ + { + "name": "DS_POSTGRESQL", + "label": "PostgreSQL", + "description": "", + "type": "datasource", + "pluginId": "postgres", + "pluginName": "PostgreSQL" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "9.3.2" + }, + { + "type": "datasource", + "id": "postgres", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": false, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "displayMode": "auto", + "filterable": true, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "id" + }, + "properties": [ + { + "id": "links", + "value": [ + { + "targetBlank": false, + "title": "", + "url": "/d/vtQClqxVk/build-task-details?orgId=1&var-build_task=${__value.raw}" + } + ] + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "duration" + }, + "properties": [ + { + "id": "unit", + "value": "s" + } + ] + } + ] + }, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": true, + "displayName": "build_id" + } + ] + }, + "pluginVersion": "9.3.2", + "targets": [ + { + "cacheDurationSeconds": 300, + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "fields": [ + { + "jsonPath": "" + } + ], + "format": "table", + "method": "GET", + "queryParams": "", + "rawQuery": true, + "rawSql": "SELECT\n bt.id,\n bt.name,\n arch_enum.value AS arch,\n status_enum.value AS status,\n bt.started_at * 1000 AS started,\n bt.finished_at * 1000 AS finished,\n bt.finished_at - bt.started_at AS duration \nFROM build_tasks AS bt\nJOIN build_task_status_enum AS status_enum ON bt.status_id = status_enum.id\nJOIN arch_enum on bt.arch_id = arch_enum.id\nWHERE bt.build_id = $build_id AND status_id >= 2;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "urlPath": "" + } + ], + "title": "Finished buld tasks", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "time", + "targetField": "started" + }, + { + "destinationType": "time", + "targetField": "finished" + } + ], + "fields": {} + } + } + ], + "type": "table" + } + ], + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": {}, + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "definition": "SELECT id\nFROM builds\nORDER BY id DESC", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "build_id", + "options": [], + "query": "SELECT id\nFROM builds\nORDER BY id DESC", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Build details", + "uid": "dmVtrz-4k", + "version": 5, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana-dashbords/Build task details.json b/grafana-dashbords/Build task details.json index 0223564..3edd794 100644 --- a/grafana-dashbords/Build task details.json +++ b/grafana-dashbords/Build task details.json @@ -7,10 +7,22 @@ "type": "datasource", "pluginId": "postgres", "pluginName": "PostgreSQL" + }, + { + "name": "DS_EXPRESSION", + "label": "Expression", + "description": "", + "type": "datasource", + "pluginId": "__expr__" } ], "__elements": {}, "__requires": [ + { + "type": "datasource", + "id": "__expr__", + "version": "1.0.0" + }, { "type": "panel", "id": "bargauge", @@ -23,18 +35,18 @@ "name": "Grafana", "version": "9.3.2" }, - { - "type": "panel", - "id": "piechart", - "name": "Pie chart", - "version": "" - }, { "type": "datasource", "id": "postgres", "name": "PostgreSQL", "version": "1.0.0" }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, { "type": "panel", "id": "table", @@ -64,7 +76,7 @@ } ] }, - "editable": true, + "editable": false, "fiscalYearStartMonth": 0, "graphTooltip": 0, "id": null, @@ -194,19 +206,6 @@ ], "type": "table" }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 3 - }, - "id": 10, - "panels": [], - "title": "Tasks duration", - "type": "row" - }, { "datasource": { "type": "postgres", @@ -233,10 +232,10 @@ "overrides": [] }, "gridPos": { - "h": 8, - "w": 16, + "h": 9, + "w": 24, "x": 0, - "y": 4 + "y": 3 }, "id": 12, "options": { @@ -298,35 +297,6 @@ "table": "build_node_stats", "urlPath": "" }, - { - "datasource": { - "type": "postgres", - "uid": "${DS_POSTGRESQL}" - }, - "editorMode": "code", - "format": "table", - "hide": true, - "rawQuery": true, - "rawSql": "SELECT end_ts - start_ts as build_all\nFROM build_node_stats \nWHERE build_task_id = $build_task and stat_name_id = 1", - "refId": "build_all", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - } - }, { "datasource": { "type": "postgres", @@ -414,64 +384,6 @@ "limit": 50 } }, - { - "datasource": { - "type": "postgres", - "uid": "${DS_POSTGRESQL}" - }, - "editorMode": "code", - "format": "table", - "hide": true, - "rawQuery": true, - "rawSql": "SELECT end_ts - start_ts as build_packages\nFROM build_node_stats \nWHERE build_task_id = $build_task and stat_name_id = 5", - "refId": "build_packages", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - } - }, - { - "datasource": { - "type": "postgres", - "uid": "${DS_POSTGRESQL}" - }, - "editorMode": "code", - "format": "table", - "hide": true, - "rawQuery": true, - "rawSql": "SELECT end_ts - start_ts as build_node_task\nFROM build_node_stats \nWHERE build_task_id = $build_task and stat_name_id = 6", - "refId": "build_node_task", - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - } - }, { "datasource": { "type": "postgres", @@ -529,111 +441,15 @@ ], "limit": 50 } - } - ], - "title": "Build node", - "type": "bargauge" - }, - { - "datasource": { - "type": "postgres", - "uid": "${DS_POSTGRESQL}" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - } - }, - "mappings": [], - "unit": "s" }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "packages_processing" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "yellow", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "logs_processing" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "orange", - "mode": "fixed" - } - } - ] - } - ] - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 4 - }, - "id": 14, - "options": { - "legend": { - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "values": [ - "value" - ] - }, - "pieType": "pie", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "9.3.2", - "targets": [ { - "cacheDurationSeconds": 300, "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" }, "editorMode": "code", - "fields": [ - { - "jsonPath": "" - } - ], "format": "table", - "method": "GET", - "queryParams": "", + "hide": false, "rawQuery": true, "rawSql": "SELECT end_ts - start_ts as logs_processing\nFROM web_node_stats \nWHERE build_task_id = $build_task and stat_name_id = 1", "refId": "logs_processing", @@ -653,8 +469,7 @@ } ], "limit": 50 - }, - "urlPath": "" + } }, { "datasource": { @@ -686,8 +501,8 @@ } } ], - "title": "Web node", - "type": "piechart" + "title": "Task duration", + "type": "bargauge" }, { "collapsed": false, @@ -746,6 +561,30 @@ "value": "s" } ] + }, + { + "matcher": { + "id": "byName", + "options": "finished" + }, + "properties": [ + { + "id": "custom.width", + "value": 235 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "started" + }, + "properties": [ + { + "id": "custom.width", + "value": 205 + } + ] } ] }, @@ -765,7 +604,8 @@ "show": false }, "frameIndex": 1, - "showHeader": true + "showHeader": true, + "sortBy": [] }, "pluginVersion": "9.3.2", "targets": [ @@ -872,6 +712,18 @@ "value": "s" } ] + }, + { + "matcher": { + "id": "byName", + "options": "started" + }, + "properties": [ + { + "id": "custom.width", + "value": 200 + } + ] } ] }, @@ -895,7 +747,7 @@ "sortBy": [ { "desc": true, - "displayName": "started" + "displayName": "duration" } ] }, @@ -959,6 +811,287 @@ } ], "type": "table" + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": true, + "inspect": true + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "duration" + }, + "properties": [ + { + "id": "unit", + "value": "s" + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 29 + }, + "id": 6, + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "frameIndex": 1, + "showHeader": true, + "sortBy": [ + { + "desc": true, + "displayName": "finished" + } + ] + }, + "pluginVersion": "9.3.2", + "targets": [ + { + "cacheDurationSeconds": 300, + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "fields": [ + { + "jsonPath": "" + } + ], + "format": "table", + "method": "GET", + "queryParams": "", + "rawQuery": true, + "rawSql": "SELECT enum.value,\n stats.start_ts * 1000 AS started,\n stats.end_ts * 1000 AS finished,\n stats.end_ts - stats.start_ts AS duration\nFROM build_node_stats AS stats\nINNER JOIN build_node_stats_enum AS enum\n ON stats.stat_name_id = enum.id\nWHERE build_task_id = $build_task", + "refId": "web node stats", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "urlPath": "" + } + ], + "title": "Build node stats", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "time", + "targetField": "started" + }, + { + "destinationType": "time", + "targetField": "finished" + } + ], + "fields": {} + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "fixed" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 17, + "x": 3, + "y": 40 + }, + "id": 14, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.3.2", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n bt.finished_at - bt.started_at AS task_duration \nFROM build_tasks AS bt\nWHERE bt.id = $build_task;", + "refId": "task_duration", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT \n stats.end_ts - stats.start_ts AS web_node_duration\nFROM web_node_stats AS stats\nWHERE build_task_id = $build_task and stat_name_id=0;", + "refId": "web_node_duration", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "postgres", + "uid": "${DS_POSTGRESQL}" + }, + "editorMode": "code", + "format": "table", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT \n stats.end_ts - stats.start_ts AS build_node_duration\nFROM build_node_stats AS stats\nWHERE build_task_id = $build_task AND stat_name_id=6", + "refId": "build_node_duration", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + }, + { + "datasource": { + "type": "__expr__", + "uid": "${DS_EXPRESSION}" + }, + "expression": "$task_duration - ($web_node_duration + $build_node_duration)", + "hide": false, + "refId": "Not accounted duration", + "type": "math" + } + ], + "title": "Diff", + "type": "stat" } ], "schemaVersion": 37, @@ -972,32 +1105,13 @@ "type": "postgres", "uid": "${DS_POSTGRESQL}" }, - "definition": "SELECT id \nFROM builds\nORDER BY id DESC;", - "hide": 0, - "includeAll": false, - "multi": false, - "name": "build", - "options": [], - "query": "SELECT id \nFROM builds\nORDER BY id DESC;", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": {}, - "datasource": { - "type": "postgres", - "uid": "${DS_POSTGRESQL}" - }, - "definition": "SELECT id from build_tasks where build_id = $build", + "definition": "SELECT id from build_tasks ORDER BY id", "hide": 0, "includeAll": false, "multi": false, "name": "build_task", "options": [], - "query": "SELECT id from build_tasks where build_id = $build", + "query": "SELECT id from build_tasks ORDER BY id", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -1014,6 +1128,6 @@ "timezone": "", "title": "Build task details", "uid": "vtQClqxVk", - "version": 19, + "version": 27, "weekStart": "" } \ No newline at end of file