Grafana dashboard: Query Insights


{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.3.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- 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": "",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": null,
  "iteration": 1672412375731,
  "links": [
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "cloud-monitoring-instance"
      ],
      "targetBlank": false,
      "title": "Instance",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    },
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "cloud-monitoring-database"
      ],
      "targetBlank": false,
      "title": "Database",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    },
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "lock-insights"
      ],
      "targetBlank": false,
      "title": "Lock Insights",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    },
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "transaction-insights"
      ],
      "targetBlank": false,
      "title": "Transaction Insights",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    },
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "active-queries-summary"
      ],
      "targetBlank": false,
      "title": "Active Queries Summary",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    },
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "read-insights"
      ],
      "targetBlank": false,
      "title": "Read Insights",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 27,
      "panels": [],
      "title": "Total (all queries)",
      "type": "row"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 1
      },
      "id": 28,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_avg_cpu_seconds{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "A"
        }
      ],
      "title": "Average CPU usage",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 1
      },
      "id": 43,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_avg_bytes{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "B"
        }
      ],
      "title": "Average bytes",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 10
      },
      "id": 31,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_avg_latency_seconds{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "A"
        }
      ],
      "title": "Average execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 10
      },
      "id": 46,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_ninety_nine_percentile_latency{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "A"
        }
      ],
      "title": "p99 execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 19
      },
      "id": 47,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_ninety_five_percentile_latency{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "A"
        }
      ],
      "title": "p95 execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 19
      },
      "id": 45,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_fifty_percentile_latency{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "A"
        }
      ],
      "title": "p50 execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 28
      },
      "id": 29,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_execution_count{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "A"
        }
      ],
      "title": "Execution count",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMin": 5,
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 28
      },
      "id": 36,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_all_failed_avg_latency_seconds{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "A"
        }
      ],
      "title": "Average execution failed latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 37
      },
      "id": 30,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_timed_out_execution_count{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "B"
        }
      ],
      "title": "Timed out execution count ",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 37
      },
      "id": 33,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_all_failed_execution_count{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "B"
        }
      ],
      "title": "Failed execution count ",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 46
      },
      "id": 34,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_avg_rows{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "B"
        }
      ],
      "title": "Average rows returned",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 46
      },
      "id": 32,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_cancelled_or_disconnected_execution_count{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "B"
        }
      ],
      "title": "Cancelled or Disconnected execution count ",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 55
      },
      "id": 35,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_total_avg_rows_scanned{project_id=~\"$project\",instance_id=~\"$instance\",database=~\"$database\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "{{database}}",
          "refId": "B"
        }
      ],
      "title": "Average rows scanned",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 64
      },
      "id": 25,
      "panels": [],
      "title": "Top Queries (per query)",
      "type": "row"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 65
      },
      "id": 12,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_avg_cpu_seconds{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Average CPU usage",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 65
      },
      "id": 38,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_avg_bytes{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\",project_id=~\"$project\",project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Average bytes",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 74
      },
      "id": 23,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_avg_latency_seconds{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Average execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 74
      },
      "id": 50,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_ninety_nine_percentile_latency{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "p99 execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 83
      },
      "id": 49,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_ninety_five_percentile_latency{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "p95 execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 83
      },
      "id": 48,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_fifty_percentile_latency{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "p50 execution latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 92
      },
      "id": 21,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "sum by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_execution_count{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Execution count",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 92
      },
      "id": 42,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_all_failed_avg_latency_seconds{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Average failed execution  latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 100
      },
      "id": 41,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "sum by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_timed_out_execution_count{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Timed out execution count",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 101
      },
      "id": 39,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "sum by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_all_failed_execution_count{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Failed execution count",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 108
      },
      "id": 37,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_avg_rows{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\",project_id=~\"$project\",project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Average rows returned",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 109
      },
      "id": 40,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "sum by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_cancelled_or_disconnected_execution_count{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text}}",
          "refId": "A"
        }
      ],
      "title": "Cancelled or disconnected execution count",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [
            {
              "title": "View Query details",
              "url": "/d/cRMUiFvny/query-details?var-project=${__field.labels.project_id}&var-instance=${__field.labels.instance_id}&var-database=${__field.labels.database}&var-query_topn=${__field.labels.query_text}&${__url_time_range}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 117
      },
      "id": 22,
      "interval": "60s",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "avg by (project_id,instance_id,database,query_text)(database_spanner_query_stats_top_avg_rows_scanned{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\",project_id=~\"$project\",project_id=~\"$project\"})",
          "hide": false,
          "interval": "",
          "legendFormat": "{{query_text_fingerprint}}",
          "refId": "A"
        }
      ],
      "title": "Average rows scanned",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Query"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 445
              },
              {
                "id": "links",
                "value": [
                  {
                    "title": "View Query details",
                    "url": "/d/cRMUiFvny/query-details?var-project=${__data.fields.Project}﻿&var-instance=﻿${__data.fields.Instance}﻿&var-database=﻿${__data.fields.Database}﻿&﻿${__url_time_range}&var-query_topn=${__data.fields.Fingerprint}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Total CPU Usage"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              },
              {
                "id": "custom.width",
                "value": 124
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average CPU Usage"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 161
              },
              {
                "id": "unit",
                "value": "s"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Project"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 63
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Instance"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 78
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Database"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 85
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Fingerprint"
            },
            "properties": [
              {
                "id": "unit",
                "value": "string"
              },
              {
                "id": "custom.width",
                "value": 179
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average Latency"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              },
              {
                "id": "custom.width",
                "value": 123
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Total Latency"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              },
              {
                "id": "custom.width",
                "value": 110
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Average Latency"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Total Execution count"
            },
            "properties": [
              {
                "id": "custom.width"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 125
      },
      "id": 44,
      "interval": "60s",
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Query fingerprint"
          }
        ]
      },
      "pluginVersion": "8.3.0",
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_top_avg_latency_seconds{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"}",
          "format": "table",
          "instant": false,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "A"
        },
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_top_avg_rows_scanned{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\",project_id=~\"$project\"}",
          "format": "table",
          "hide": false,
          "instant": false,
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        },
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_top_execution_count{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"}",
          "format": "table",
          "hide": false,
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        },
        {
          "exemplar": false,
          "expr": "database_spanner_query_stats_top_avg_cpu_seconds{query_text_fingerprint=~\"$query_topn\", database=~\"$database\", instance_id=~\"$instance\", project_id=~\"$project\"}",
          "format": "table",
          "hide": false,
          "instant": false,
          "interval": "",
          "legendFormat": "",
          "queryType": "randomWalk",
          "refId": "D"
        }
      ],
      "title": "Top Queries",
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Time",
                "database",
                "instance_id",
                "project_id",
                "query_text",
                "query_text_fingerprint",
                "query_text_truncated",
                "Value #A",
                "Value #B",
                "Value #C",
                "Value #D",
                "request_tag"
              ]
            }
          }
        },
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": false,
              "database": false,
              "instance": true,
              "instance_id": false,
              "job": true,
              "project": true,
              "project_id": false,
              "query_text_fingerprint": false,
              "query_text_truncated": true
            },
            "indexByName": {
              "Time": 0,
              "Value #A": 8,
              "Value #B": 9,
              "Value #C": 10,
              "Value #D": 7,
              "database": 3,
              "instance_id": 2,
              "project_id": 1,
              "query_text": 6,
              "query_text_fingerprint": 4,
              "request_tag": 5
            },
            "renameByName": {
              "Time": "Time",
              "Value #A": "Latency",
              "Value #B": "Rows scanned",
              "Value #C": "Execution count",
              "Value #D": "CPU Usage",
              "database": "Database",
              "instance": "",
              "instance_id": "Instance",
              "project_id": "Project",
              "query_text": "Query",
              "query_text_fingerprint": "Fingerprint",
              "request_tag": "Tag"
            }
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "CPU Usage": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "Database": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Execution count": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "Fingerprint": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Instance": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Latency": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "Project": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Query": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Query fingerprint": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Rows scanned": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "Tag": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Time": {
                "aggregations": [],
                "operation": "groupby"
              }
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Total Latency",
            "binary": {
              "left": "Latency (last)",
              "operator": "*",
              "reducer": "sum",
              "right": "Execution count (last)"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Total CPU Usage",
            "binary": {
              "left": "CPU Usage (last)",
              "operator": "*",
              "reducer": "sum",
              "right": "Execution count (last)"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Total Rows scanned",
            "binary": {
              "left": "Rows scanned (last)",
              "operator": "*",
              "reducer": "sum",
              "right": "Execution count (last)"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Database": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Execution count (last)": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "Fingerprint": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Instance": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Latency (mean)": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "Project": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Query": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Rows scanned (last)": {
                "aggregations": [
                  "mean"
                ]
              },
              "Rows scanned (mean)": {
                "aggregations": [
                  "last"
                ],
                "operation": "aggregate"
              },
              "Tag": {
                "aggregations": [],
                "operation": "groupby"
              },
              "Total CPU Usage": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "Total Latency": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "Total Rows scanned": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              }
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Average CPU Usage",
            "binary": {
              "left": "Total CPU Usage (sum)",
              "operator": "/",
              "reducer": "sum",
              "right": "Execution count (last) (sum)"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Average Latency",
            "binary": {
              "left": "Total Latency (sum)",
              "operator": "/",
              "reducer": "sum",
              "right": "Execution count (last) (sum)"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Average Rows scanned",
            "binary": {
              "left": "Total Rows scanned (sum)",
              "operator": "/",
              "reducer": "sum",
              "right": "Execution count (last) (sum)"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Total Rows scanned (sum)": true
            },
            "indexByName": {
              "Average CPU Usage": 7,
              "Average Latency": 9,
              "Database": 2,
              "Execution count (last) (sum)": 10,
              "Fingerprint": 3,
              "Instance": 1,
              "Project": 0,
              "Query": 4,
              "Rows scanned (last) (mean)": 11,
              "Tag": 5,
              "Total CPU Usage (sum)": 6,
              "Total Latency (sum)": 8
            },
            "renameByName": {
              "Average CPU Usage": "",
              "Average Latency": "",
              "Execution count (last) (sum)": "Total Execution count",
              "Latency (mean) (last)": "Average Latency",
              "Rows scanned (last) (mean)": "Average Rows scanned",
              "Rows scanned (last) (sum)": "Rowas scanned",
              "Rows scanned (mean) (last)": "Average Rows scanned",
              "Tag": "",
              "Total CPU Usage (sum)": "Total CPU Usage",
              "Total Latency (sum)": "Total Latency"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 33,
  "style": "dark",
  "tags": [
    "query-insights"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "description": "Prometheus data source",
        "hide": 0,
        "includeAll": false,
        "label": "Prometheus",
        "multi": false,
        "name": "pds",
        "options": [],
        "query": "prometheus",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(project_id)",
        "hide": 0,
        "includeAll": false,
        "label": "Project",
        "multi": true,
        "name": "project",
        "options": [],
        "query": {
          "query": "label_values(project_id)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(instance_id)",
        "hide": 0,
        "includeAll": false,
        "label": "Instance",
        "multi": false,
        "name": "instance",
        "options": [],
        "query": {
          "query": "label_values(instance_id)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(database)",
        "hide": 0,
        "includeAll": true,
        "label": "Database",
        "multi": false,
        "name": "database",
        "options": [],
        "query": {
          "query": "label_values(database)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "query_result(topk(10, avg_over_time(database_spanner_query_stats_top_avg_cpu_seconds[${__range_s}s])))",
        "hide": 0,
        "includeAll": true,
        "label": "Top 10 Queries",
        "multi": true,
        "name": "query_topn",
        "options": [],
        "query": {
          "query": "query_result(topk(10, avg_over_time(database_spanner_query_stats_top_avg_cpu_seconds[${__range_s}s])))",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "/query_text=\"(?<text>[^\"]+)|query_text_fingerprint=\"(?<value>[^\"]+)/g",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "2022-12-22T07:03:16.683Z",
    "to": "2022-12-22T07:32:25.798Z"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Query Insights",
  "uid": "cRMUiFvnz",
  "version": 3,
  "weekStart": "",
  "gnetId": 15721
}