Grafana dashboard: Test metrics
Description: Metrics for autotests


{
  "__inputs": [
    {
      "name": "DS_INFLUXDB_V2_FLUX",
      "label": "InfluxDB_v2_Flux",
      "description": "metric storage",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.1.6"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "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"
      }
    ]
  },
  "description": "Metrics for autotests",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 8,
      "panels": [],
      "title": "Documentation",
      "type": "row"
    },
    {
      "description": "",
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 9,
      "options": {
        "content": "# Dashboard for autotests metrics\n\n---\n### Panels:\n1. unstable tests - the panel displays the current number of unstable tests\n2. slowest tests - the panel displays the average time to complete tests\n3. find report - the panel displays artifacts of broken tests",
        "mode": "markdown"
      },
      "pluginVersion": "9.1.6",
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "errorType": {
                "aggregations": []
              },
              "name": {
                "aggregations": [],
                "operation": "groupby"
              },
              "result": {
                "aggregations": [
                  "count"
                ],
                "operation": "aggregate"
              }
            }
          }
        }
      ],
      "type": "text"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 7
      },
      "id": 4,
      "panels": [],
      "title": "Metrics",
      "type": "row"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB_V2_FLUX}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false,
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 4
              },
              {
                "color": "red",
                "value": 5
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "name"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "name"
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "_value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "count"
              },
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 15,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "options": {
        "footer": {
          "enablePagination": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "9.1.6",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB_V2_FLUX}"
          },
          "query": "from(bucket: \"test_metrics\")\n|> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n|> filter(fn: (r) => r._measurement == \"flaky_test\")\n|> filter(fn: (r) => r.status == \"failed\")\n|> drop(columns:[\"report\"])\n|> sum()\n|> group()\n|> sort(columns: [\"_value\"], desc: true)\n|> keep(columns: [\"name\", \"_value\"])",
          "refId": "A"
        }
      ],
      "title": "unstable tests",
      "transformations": [],
      "type": "table"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB_V2_FLUX}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false,
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "name"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "name"
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "_value (mean)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "duration"
              },
              {
                "id": "custom.align",
                "value": "center"
              },
              {
                "id": "unit",
                "value": "s"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 53
                    },
                    {
                      "color": "red",
                      "value": 70
                    }
                  ]
                }
              },
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 24,
        "w": 9,
        "x": 15,
        "y": 8
      },
      "id": 5,
      "options": {
        "footer": {
          "enablePagination": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "9.1.6",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB_V2_FLUX}"
          },
          "query": "from(bucket: \"test_metrics\")\n|> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n|> filter(fn: (r) => r._measurement == \"slowest_test\")\n|> group()\n|> sort(columns: [\"_value\"], desc: true)\n|> keep(columns: [\"name\", \"_value\"])\n|> top(n: 10)",
          "refId": "A"
        }
      ],
      "title": "slowest tests",
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "_value": {
                "aggregations": [
                  "mean"
                ],
                "operation": "aggregate"
              },
              "errorType": {
                "aggregations": []
              },
              "name": {
                "aggregations": [
                  "sum"
                ],
                "operation": "groupby"
              },
              "result": {
                "aggregations": [
                  "count"
                ],
                "operation": "aggregate"
              }
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "_value (mean)"
              }
            ]
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB_V2_FLUX}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "_value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "count"
              },
              {
                "id": "custom.align",
                "value": "auto"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "report"
            },
            "properties": [
              {
                "id": "displayName"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 15,
        "w": 15,
        "x": 0,
        "y": 17
      },
      "id": 6,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 5,
        "showHeader": true
      },
      "pluginVersion": "9.1.6",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB_V2_FLUX}"
          },
          "query": "from(bucket: \"test_metrics\")\n|> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n|> filter(fn: (r) => r._measurement == \"flaky_test\")\n|> filter(fn: (r) => r.status == \"failed\")\n|> sum()\n|> keep(columns: [\"name\", \"report\", \"_value\"])\n|> group(columns: [\"name\"])",
          "refId": "A"
        }
      ],
      "title": "find report",
      "transformations": [],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 37,
  "style": "dark",
  "tags": [
    "QA"
  ],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-2d",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Test metrics",
  "uid": "rcIDXmnVz",
  "version": 2,
  "weekStart": "",
  "gnetId": 17412
}