{ "__inputs": [ { "name": "DS_POSTGRESQL", "label": "PostgreSQL", "description": "", "type": "datasource", "pluginId": "postgres", "pluginName": "PostgreSQL" } ], "__elements": {}, "__requires": [ { "type": "panel", "id": "bargauge", "name": "Bar gauge", "version": "" }, { "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}" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "left", "displayMode": "auto", "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "duration" }, "properties": [ { "id": "unit", "value": "s" } ] }, { "matcher": { "id": "byName", "options": "package" }, "properties": [ { "id": "custom.width", "value": 253 } ] }, { "matcher": { "id": "byName", "options": "id" }, "properties": [ { "id": "custom.width", "value": 80 } ] } ] }, "gridPos": { "h": 3, "w": 24, "x": 0, "y": 0 }, "id": 4, "options": { "footer": { "fields": "", "reducer": [ "sum" ], "show": false }, "showHeader": true, "sortBy": [] }, "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 DISTINCT tt.id,\n tt.package_fullname AS package,\n tt.revision,\n enum.value AS \"status\",\n tt.started_at * 1000 AS \"started at\",\n tf.finished_at * 1000 AS \"finished at\", \n tf.finished_at - tt.started_at AS duration\nFROM test_tasks AS tt\nINNER JOIN test_steps_stats AS tss\n ON tt.id = tss.test_task_id\nINNER JOIN test_tasks_status_enum AS enum\n ON tt.status_id = enum.id\nINNER JOIN \n (SELECT \n tss.test_task_id, \n MAX(tss.finish_ts) AS finished_at \n FROM test_steps_stats AS tss\n INNER JOIN test_tasks AS tt\n ON tss.test_task_id = tt.id\n WHERE tt.id = $id\n GROUP BY tss.test_task_id) AS tf\n ON tf.test_task_id = tt.id\nWHERE tt.id = $id;", "refId": "A", "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "urlPath": "" } ], "title": "Task info", "transformations": [ { "id": "convertFieldType", "options": { "conversions": [ { "destinationType": "time", "targetField": "started at" }, { "destinationType": "time", "targetField": "finished at" } ], "fields": {} } } ], "type": "table" }, { "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" }, "fieldConfig": { "defaults": { "color": { "fixedColor": "blue", "mode": "fixed" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "s" }, "overrides": [] }, "gridPos": { "h": 8, "w": 24, "x": 0, "y": 3 }, "id": 8, "options": { "displayMode": "basic", "minVizHeight": 10, "minVizWidth": 0, "orientation": "vertical", "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 \n enum.value AS \"step name\",\n SUM(tss.finish_ts - tss.start_ts) AS duration\nFROM test_tasks AS tt\nINNER JOIN test_steps_stats AS tss\n ON tt.id = tss.test_task_id\nINNER JOIN test_steps_enum AS enum\n ON tss.stat_name_id = enum.id\nWHERE tt.id = $id\nGROUP BY (enum.value); ", "refId": "A", "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "urlPath": "" } ], "title": "Test duration (group by test step)", "transformations": [ { "id": "rowsToFields", "options": {} } ], "type": "bargauge" }, { "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "left", "displayMode": "auto", "filterable": true, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "test task id" }, "properties": [ { "id": "custom.width", "value": 159 }, { "id": "links", "value": [ { "title": "", "url": "/d/8nFXlkB4z/test-task-details?orgId=1&var-id=${__value.raw}" } ] } ] }, { "matcher": { "id": "byName", "options": "duration" }, "properties": [ { "id": "unit", "value": "s" } ] }, { "matcher": { "id": "byName", "options": "package name" }, "properties": [ { "id": "custom.width", "value": 408 } ] } ] }, "gridPos": { "h": 6, "w": 24, "x": 0, "y": 11 }, "id": 6, "options": { "footer": { "fields": "", "reducer": [ "sum" ], "show": false }, "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 \n tt.package_fullname AS \"package name\",\n tss.test_task_id AS \"test task id\", \n enum.value AS \"step name\",\n tss.start_ts * 1000 AS started,\n tss.finish_ts * 1000 AS finished,\n tss.finish_ts - tss.start_ts AS duration\nFROM test_tasks AS tt\nINNER JOIN test_steps_stats AS tss\n ON tt.id = tss.test_task_id\nINNER JOIN test_steps_enum AS enum\n ON tss.stat_name_id = enum.id\nWHERE tt.id = $id", "refId": "A", "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "urlPath": "" } ], "title": "Test steps", "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 test_tasks\nORDER BY id DESC", "hide": 0, "includeAll": false, "label": "Test task id", "multi": false, "name": "id", "options": [], "query": "SELECT id\nFROM test_tasks\nORDER BY id DESC", "refresh": 1, "regex": "", "skipUrlSync": false, "sort": 0, "type": "query" } ] }, "time": { "from": "now-6h", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Test task details", "uid": "8nFXlkB4z", "version": 8, "weekStart": "" }