Grafana dashboard: Google Cloud Spanner - Lock Insights
Description: Lock Insights Dashboard


{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.3.1"
    },
    {
      "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"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": null,
  "iteration": 1644345070099,
  "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": [
        "query-insights"
      ],
      "targetBlank": false,
      "title": "Query 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": 10,
      "panels": [],
      "title": "Total (all locks)",
      "type": "row"
    },
    {
      "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"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 3,
      "interval": "1m",
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "sum by (database) (database_spanner_lock_stats_total_total_lock_wait_seconds{database=~\"${database}\",instance_id=~\"${instance}\",project_id=~\"${project}\"})",
          "format": "time_series",
          "instant": false,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "{{database}}",
          "queryType": "randomWalk",
          "refId": "Total lock wait seconds"
        }
      ],
      "title": "Total lock wait",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 10
      },
      "id": 8,
      "panels": [],
      "title": "Top Locks (per lock)",
      "type": "row"
    },
    {
      "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"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 11
      },
      "id": 4,
      "interval": "1m",
      "options": {
        "legend": {
          "calcs": [
            "mean",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "multi"
        }
      },
      "targets": [
        {
          "exemplar": false,
          "expr": "sum by (row_range_start_key) (database_spanner_lock_stats_top_lock_wait_seconds{database=~\"${database}\",instance_id=~\"${instance}\",project_id=~\"${project}\", row_range_start_key=~\"${lock_topn}\"})",
          "format": "time_series",
          "instant": false,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "{{row_range_start_key}}",
          "queryType": "randomWalk",
          "refId": "Lock wait seconds"
        }
      ],
      "title": "Lock wait",
      "type": "timeseries"
    },
    {
      "datasource": {
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "s"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Sample lock columns"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 1190
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Lock wait (sum)"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 141
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 12,
        "w": 24,
        "x": 0,
        "y": 19
      },
      "id": 6,
      "interval": "1m",
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "Sample lock columns"
          }
        ]
      },
      "pluginVersion": "8.3.1",
      "targets": [
        {
          "exemplar": false,
          "expr": "database_spanner_lock_stats_top_lock_wait_seconds{database=~\"${database}\",instance_id=~\"${instance}\",project_id=~\"${project}\", row_range_start_key=~\"${lock_topn}\"}",
          "format": "table",
          "interval": "",
          "legendFormat": "{{row_range_start_key}}",
          "refId": "Lock wait details"
        }
      ],
      "title": "Top Locks",
      "transformations": [
        {
          "id": "groupBy",
          "options": {
            "fields": {
              "Value": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "Value #Lock wait details": {
                "aggregations": [
                  "sum"
                ],
                "operation": "aggregate"
              },
              "row_range_start_key": {
                "aggregations": [],
                "operation": "groupby"
              },
              "sample_lock_requests": {
                "aggregations": [
                  "allValues"
                ],
                "operation": "aggregate"
              }
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Value #Lock wait details (sum)": "Lock wait (sum)",
              "Value (sum)": "Lock wait (sum)",
              "Value (sum) (sum)": "Lock wait (sum)",
              "row_range_start_key": "Row range start key",
              "sample_lock_requests": "Sample lock columns",
              "sample_lock_requests (allValues)": "Sample lock requests"
            }
          }
        },
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {
                "destinationType": "string",
                "targetField": "sample_lock_requests (allValues)"
              }
            ],
            "fields": {}
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 33,
  "style": "dark",
  "tags": [
    "lock-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": {
          "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": {
          "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": {
          "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": {
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "query_result(topk(10, avg_over_time(database_spanner_lock_stats_top_lock_wait_seconds[${__range_s}s])))",
        "hide": 0,
        "includeAll": true,
        "label": "Top 10 locks",
        "multi": true,
        "name": "lock_topn",
        "options": [],
        "query": {
          "query": "query_result(topk(10, avg_over_time(database_spanner_lock_stats_top_lock_wait_seconds[${__range_s}s])))",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "/row_range_start_key=\"(?<text>[^\"]+)|row_range_start_key=\"(?<value>[^\"]+)/g",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Google Cloud Spanner - Lock Insights",
  "uid": "Z3mSctD7z",
  "version": 2,
  "weekStart": "",
  "gnetId": 15717,
  "description": "Lock Insights Dashboard"
}