Grafana dashboard: Pinba
Description: Base dashboard for pinba from clickhouse

[https://github.com/pinba-server/pinba-server](https://github.com/pinba-server/pinba-server)

{
  "__inputs": [
    {
      "name": "DS_CLICKHOUSE",
      "label": "clickhouse",
      "description": "",
      "type": "datasource",
      "pluginId": "vertamedia-clickhouse-datasource",
      "pluginName": "ClickHouse"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.4.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "vertamedia-clickhouse-datasource",
      "name": "ClickHouse",
      "version": "1.8.1"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "limit": 100,
        "name": "Annotations & Alerts",
        "showIn": 0,
        "tags": [
          "deployment"
        ],
        "type": "tags"
      }
    ]
  },
  "description": "Base dashboard for pinba from clickhouse",
  "editable": true,
  "gnetId": 10011,
  "graphTooltip": 1,
  "id": null,
  "iteration": 1554728145622,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 0
      },
      "id": 14,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    SUM(req_count) * 60 / scale as req_count,\n    script_name || ':' || toString(status) as script_name\nFROM $table\nWHERE\n    $timeFilter\n    AND CASE WHEN $schema <> 'all' THEN schema = $schema ELSE 1 END\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $server_name <> 'all' THEN server_name = $server_name ELSE 1 END\nGROUP BY script_name, t\nORDER BY t, req_count desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     SUM(req_count) * 60 / scale as req_count,     script_name || ':' || toString(status) as script_name FROM pinba.report_by_all WHERE     timestamp >= toDateTime(1554555181)     AND CASE WHEN 'web' <> 'all' THEN schema = 'web' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN server_name = 'all' ELSE 1 END GROUP BY script_name, t ORDER BY t, req_count desc",
          "refId": "A",
          "round": "1m",
          "table": "report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "req_count",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 0
      },
      "id": 12,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "interval": "",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    sum(req_time_sum) * 60 / scale as req_time_max,\n    script_name || ':' || toString(status) as script_name\nFROM $table\nWHERE\n    $timeFilter\n    AND CASE WHEN $schema <> 'all' THEN schema = $schema ELSE 1 END\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $server_name <> 'all' THEN server_name = $server_name ELSE 1 END\nGROUP BY script_name, t\nORDER BY t, req_time_max desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     sum(req_time_sum) * 60 / scale as req_time_max,     script_name || ':' || toString(status) as script_name FROM pinba.report_by_all WHERE     timestamp >= toDateTime(1554555181)     AND CASE WHEN 'web' <> 'all' THEN schema = 'web' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN server_name = 'all' ELSE 1 END GROUP BY script_name, t ORDER BY t, req_time_max desc",
          "refId": "A",
          "round": "1m",
          "table": "report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "time",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 0
      },
      "id": 13,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    SUM(req_count) * 60 / scale as req_count,\n    script_name || ':' || toString(status) as script_name\nFROM $table\nWHERE\n    $timeFilter\n    AND status > 200\n    AND CASE WHEN $schema <> 'all' THEN schema = $schema ELSE 1 END\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $server_name <> 'all' THEN server_name = $server_name ELSE 1 END\nGROUP BY script_name, t\nORDER BY t, req_count desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     SUM(req_count) * 60 / scale as req_count,     script_name || ':' || toString(status) as script_name FROM pinba.report_by_all WHERE     timestamp >= toDateTime(1554555181)     AND status > 200     AND CASE WHEN 'web' <> 'all' THEN schema = 'web' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN server_name = 'all' ELSE 1 END GROUP BY script_name, t ORDER BY t, req_count desc",
          "refId": "A",
          "round": "1m",
          "table": "report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "status > 200",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 8
      },
      "id": 11,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    sum(ru_utime_sum) * 60 / scale as ru_utime_sum,\n    script_name || ':' || toString(status) as script_name\nFROM $table\nWHERE\n    $timeFilter\n    AND CASE WHEN $schema <> 'all' THEN schema = $schema ELSE 1 END\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $server_name <> 'all' THEN server_name = $server_name ELSE 1 END\nGROUP BY script_name, t\nORDER BY t, ru_utime_sum desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     sum(ru_utime_sum) * 60 / scale as ru_utime_sum,     script_name || ':' || toString(status) as script_name FROM pinba.report_by_all WHERE     timestamp >= toDateTime(1554555181)     AND CASE WHEN 'web' <> 'all' THEN schema = 'web' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN server_name = 'all' ELSE 1 END GROUP BY script_name, t ORDER BY t, ru_utime_sum desc",
          "refId": "A",
          "round": "1m",
          "table": "report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "cpu",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 8
      },
      "id": 16,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "connected",
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    sum(memory_footprint_max)*sum(req_count) * 60 / scale as memory_footprint_max,\n    script_name || ':' || toString(status) as script_name\nFROM $table\nWHERE\n    $timeFilter\n    AND CASE WHEN $schema <> 'all' THEN schema = $schema ELSE 1 END\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $server_name <> 'all' THEN server_name = $server_name ELSE 1 END\nGROUP BY script_name, t\nORDER BY t, memory_footprint_max desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     sum(memory_footprint_max)*sum(req_count) * 60 / scale as memory_footprint_max,     script_name || ':' || toString(status) as script_name FROM pinba.report_by_all WHERE     timestamp >= toDateTime(1554555181)     AND CASE WHEN 'web' <> 'all' THEN schema = 'web' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN server_name = 'all' ELSE 1 END GROUP BY script_name, t ORDER BY t, memory_footprint_max desc",
          "refId": "A",
          "round": "1m",
          "table": "report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "memory",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "decbits",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "decbits",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_CLICKHOUSE}",
      "fill": 1,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 8
      },
      "id": 15,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": false,
        "show": true,
        "sort": "max",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "paceLength": 10,
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 10,
          "query": "WITH (\n    CASE \n        WHEN ($interval % 60) = 0 THEN $interval\n    ELSE 60 END\n) AS scale\nSELECT\n    intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,\n    SUM(doc_size_sum) * 60 / scale as doc_size_sum,\n    script_name || ':' || toString(status) as script_name\nFROM $table\nWHERE\n    $timeFilter\n    AND CASE WHEN $schema <> 'all' THEN schema = $schema ELSE 1 END\n    AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END\n    AND CASE WHEN $server_name <> 'all' THEN server_name = $server_name ELSE 1 END\nGROUP BY script_name, t\nORDER BY t, doc_size_sum desc",
          "rawQuery": "WITH (     CASE          WHEN (3000 % 60) = 0 THEN 3000     ELSE 60 END ) AS scale SELECT     intDiv(toUInt32(timestamp), scale) * scale * 1000 AS t,     SUM(doc_size_sum) * 60 / scale as doc_size_sum,     script_name || ':' || toString(status) as script_name FROM pinba.report_by_all WHERE     timestamp >= toDateTime(1554555181)     AND CASE WHEN 'web' <> 'all' THEN schema = 'web' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END     AND CASE WHEN 'all' <> 'all' THEN server_name = 'all' ELSE 1 END GROUP BY script_name, t ORDER BY t, doc_size_sum desc",
          "refId": "A",
          "round": "1m",
          "table": "report_by_all",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "doc_size",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "decbits",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "decbits",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE}",
      "fontSize": "100%",
      "gridPos": {
        "h": 4,
        "w": 24,
        "x": 0,
        "y": 16
      },
      "id": 10,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Stime",
          "thresholds": [],
          "type": "number",
          "unit": "s"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Utime",
          "thresholds": [],
          "type": "number",
          "unit": "s"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "RequestTime(.*?)",
          "thresholds": [],
          "type": "number",
          "unit": "s"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Traffic",
          "thresholds": [],
          "type": "number",
          "unit": "Bps"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Memory",
          "thresholds": [],
          "type": "number",
          "unit": "decbytes"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "decimals": 2,
          "pattern": "/.*/",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "pinba",
          "dateLoading": false,
          "dateTimeColDataType": "timestamp",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "expr": "",
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "WITH ($to - $from) AS seconds \nSELECT\n    script_name\n    , req_time_max / req_count AS req_time_avg\n    , max(req_time_max) AS req_time_max\n    , sum(req_time_sum) AS req_time_sum_sum\n    , sum(req_count) AS req_count\n    \nFROM $table\nWHERE $timeFilter\n  AND CASE WHEN $schema <> 'all' THEN schema = $schema ELSE 1 END \n  AND CASE WHEN $hostname <> 'all' THEN hostname = $hostname ELSE 1 END \n  AND CASE WHEN $server_name <> 'all' THEN server_name = $server_name ELSE 1 END\nGROUP BY script_name\nORDER BY req_time_avg DESC \nLIMIT 20",
          "rawQuery": "WITH (1554728174 - 1554555316) AS seconds  SELECT     script_name     , req_time_max / req_count AS req_time_avg     , max(req_time_max) AS req_time_max     , sum(req_time_sum) AS req_time_sum_sum     , sum(req_count) AS req_count      FROM pinba.report_by_all WHERE timestamp >= toDateTime(1554555316)   AND CASE WHEN 'web' <> 'all' THEN schema = 'web' ELSE 1 END    AND CASE WHEN 'all' <> 'all' THEN hostname = 'all' ELSE 1 END    AND CASE WHEN 'all' <> 'all' THEN server_name = 'all' ELSE 1 END GROUP BY script_name ORDER BY req_time_avg DESC  LIMIT 20",
          "refId": "A",
          "round": "15s",
          "table": "report_by_all",
          "tableLoading": false
        }
      ],
      "title": "TOP 10 slow scripts",
      "transform": "table",
      "type": "table"
    }
  ],
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "php",
    "performance"
  ],
  "templating": {
    "list": [
      {
        "allValue": "'all'",
        "current": {},
        "datasource": "${DS_CLICKHOUSE}",
        "definition": "SELECT DISTINCT schema FROM pinba.report_by_all WHERE timestamp >= toStartOfDay(now())",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": false,
        "name": "schema",
        "options": [],
        "query": "SELECT DISTINCT schema FROM pinba.report_by_all WHERE timestamp >= toStartOfDay(now())",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": "'all'",
        "current": {},
        "datasource": "${DS_CLICKHOUSE}",
        "definition": "SELECT DISTINCT server_name FROM pinba.report_by_all WHERE timestamp >= toStartOfDay(now())",
        "hide": 0,
        "includeAll": true,
        "label": "server name",
        "multi": false,
        "name": "server_name",
        "options": [],
        "query": "SELECT DISTINCT server_name FROM pinba.report_by_all WHERE timestamp >= toStartOfDay(now())",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": "'all'",
        "current": {},
        "datasource": "${DS_CLICKHOUSE}",
        "definition": "SELECT DISTINCT hostname FROM pinba.report_by_all WHERE timestamp >= toStartOfDay(now())",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": false,
        "name": "hostname",
        "options": [],
        "query": "SELECT DISTINCT hostname FROM pinba.report_by_all WHERE timestamp >= toStartOfDay(now())",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-2d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "browser",
  "title": "Pinba",
  "uid": "4hcaISQiz",
  "version": 18
}