{
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.4.3"
    },
    {
      "type": "datasource",
      "id": "grafana-azure-monitor-datasource",
      "name": "Azure Monitor",
      "version": "0.3.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": []
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1622167538209,
  "links": [],
  "panels": [
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": []
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Number of Deadlocks/sec"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Deadlocks/sec"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Data File(s) Size (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Data file size"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Log File(s) Size (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Log file size"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Log File(s) Used Size (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Log file used size"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Free Space in tempdb (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Free space in tempdb"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Memory broker clerk size"
            },
            "properties": [
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": true
        },
        "text": {},
        "textMode": "value_and_name"
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\r\n| where SqlInstance == '$SqlInstance' and (Database == '$db' or '*' == '$db') and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| where Counter in~ ('User connections', 'Active Temp Tables')\r\n| summarize EndValue = max(Val) by Counter\n| extend p = pack(Counter, EndValue)\r\n| summarize bag=make_bag(p)\r\n| evaluate bag_unpack(bag)",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        },
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\r\n| where SqlInstance == '$SqlInstance' and (Database == '$db' or '*' == '$db') and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| where Counter in~ ('Memory Grants Pending', 'Number of deadlocks/sec', 'Processes blocked')\r\n| summarize (T, EndValue) = arg_max(TimeGenerated, Val) by Counter\n| project-away T\n| extend p = pack(Counter, EndValue)\r\n| summarize bag=make_bag(p)\r\n| evaluate bag_unpack(bag)\n",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "B",
          "subscription": "$sub"
        }
      ],
      "title": "Key Stats",
      "transformations": [],
      "transparent": true,
      "type": "stat"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": []
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Number of Deadlocks/sec"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Deadlocks/sec"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Data File(s) Size (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Data file size"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Log File(s) Size (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Log file size"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Log File(s) Used Size (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Log file used size"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Free Space in tempdb (KB)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Free space in tempdb"
              },
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Memory broker clerk size"
            },
            "properties": [
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "id": 9,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": true
        },
        "text": {},
        "textMode": "value_and_name"
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\r\n| where SqlInstance == '$SqlInstance' and (Database == '$db' or '*' == '$db') and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| where tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) =~ 'total' and Counter in~ ('Data File(s) Size (KB)', 'Log File(s) Size (KB)', 'Log File(s) Used Size (KB)')\r\n| summarize (End, EndValue) = arg_max(TimeGenerated, Val) by Counter\n| project-away End\n| extend p = pack(Counter, EndValue)\r\n| summarize bag=make_bag(p)\r\n| evaluate bag_unpack(bag)\n",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "C",
          "subscription": "$sub"
        },
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\r\n| where SqlInstance == '$SqlInstance' and (Database == '$db' or '*' == '$db') and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| where Counter =~ 'Free Space in tempdb (KB)'\r\n| summarize EndValue = min(Val) by Counter\n| extend p = pack(Counter, EndValue)\r\n| summarize bag=make_bag(p)\r\n| evaluate bag_unpack(bag)\n",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "D",
          "subscription": "$sub"
        },
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\r\n| where SqlInstance == '$SqlInstance' and (Database == '$db' or '*' == '$db') and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| where Counter =~ 'Memory broker clerk size' and DbInstance =~ 'Buffer Pool'\r\n| summarize (End, EndValue) = arg_max(TimeGenerated, Val) by Counter\r\n| extend EndValue = EndValue * 8\n| project-away End\n| extend p = pack(Counter, EndValue)\r\n| summarize bag=make_bag(p)\r\n| evaluate bag_unpack(bag)\n",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "E",
          "subscription": "$sub"
        }
      ],
      "title": "",
      "transformations": [],
      "transparent": true,
      "type": "stat"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": []
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 8,
        "x": 0,
        "y": 11
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "\r\n\r\nInsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\r\n| where Instance == '$SqlInstance'\r\n| where Namespace =~ 'sqlserver_azure_db_resource_stats' and Name == 'avg_instance_cpu_percent' and Tags.replica_updateability == iff('primary' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| summarize ['Avg Instance CPU'] = avg(Val) by bin(TimeGenerated, $__interval)",
            "resultFormat": "table",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        },
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\r\n| where Instance == '$SqlInstance'\r\n| where Namespace =~ 'sqlserver_azure_db_resource_stats' and Name == 'avg_cpu_percent' and Tags.replica_updateability == iff('primary' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| summarize ['Avg CPU'] = avg(Val) by bin(TimeGenerated, $__interval)",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "B",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "CPU",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": []
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 8,
        "x": 8,
        "y": 11
      },
      "id": 3,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "\r\n\r\nInsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\r\n| where Instance == '$SqlInstance'\r\n| where Namespace =~ 'sqlserver_azure_db_resource_stats' and Name == 'avg_instance_memory_percent' and Tags.replica_updateability == iff('primary' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| summarize ['Avg Instance Memory'] = avg(Val) by bin(TimeGenerated, $__interval)",
            "resultFormat": "table",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        },
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\r\n| where Instance == '$SqlInstance'\r\n| where Namespace =~ 'sqlserver_azure_db_resource_stats' and Name == 'avg_memory_usage_percent' and Tags.replica_updateability == iff('primary' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| summarize ['Avg Memory'] = avg(Val) by bin(TimeGenerated, $__interval)",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "B",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Memory",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": []
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 8,
        "x": 16,
        "y": 11
      },
      "id": 4,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "\r\n\r\nInsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\r\n| where Instance == '$SqlInstance'\r\n| where Namespace =~ 'sqlserver_azure_db_resource_stats' and Name == 'avg_data_io_percent' and Tags.replica_updateability == iff('primary' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| summarize ['Avg Data I/O'] = avg(Val) by bin(TimeGenerated, $__interval)",
            "resultFormat": "table",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        },
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter()\n\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\r\n| where Instance == '$SqlInstance'\r\n| where Namespace =~ 'sqlserver_azure_db_resource_stats' and Name == 'avg_log_write_percent' and Tags.replica_updateability == iff('primary' == 'secondary', 'READ_ONLY', 'READ_WRITE')\n| summarize ['Avg Log Writes'] = avg(Val) by bin(TimeGenerated, $__interval)",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "hide": false,
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "B",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data I/O",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "hue",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineStyle": {
              "fill": "solid"
            },
            "lineWidth": 1,
            "pointSize": 9,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "^(WaitType.*)"
            },
            "properties": [
              {
                "id": "displayName"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 18
      },
      "id": 8,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics \n| where $__timeFilter()\n| where Namespace in~ ('sqlserver_azuredb_waitstats', 'sqlserver_waitstats') and Name =~ 'wait_time_ms'\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(iff(Tags[\"database_name'\"] == '', Tags[\"database_name\"], Tags[\"database_name'\"])), Instance = tostring(Tags.sql_instance), WaitType = tostring(Tags.wait_type), WaitCategory = tostring(Tags.wait_category)\r\n| where Instance == '$SqlInstance' and (Database == '$db' or '*' == '$db')\r\n| order by Computer asc, Instance asc, Database asc, Namespace asc, Name asc, WaitType asc, TimeGenerated asc\r\n| extend WaitCategory = iff(isempty(WaitCategory), \"Other\", WaitCategory)\r\n| extend Val = iff(Computer == prev(Computer) and Instance == prev(Instance) and Database == prev(Database) and Namespace == prev(Namespace) and Name == prev(Name) and WaitType == prev(WaitType) and Val > prev(Val), Val - prev(Val), real(null))\n| summarize Val = avg(Val) by bin(TimeGenerated, $__interval), WaitCategory\n| extend Val = iff(isnan(Val), real(0), Val)\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "SQL Wait Category Stats",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "WaitCategory"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "datasource": "$ds",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 26
      },
      "id": 11,
      "panels": [],
      "title": "Activities",
      "type": "row"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 27
      },
      "id": 15,
      "maxDataPoints": 20,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Tags = todynamic(Tags)\r\n| extend Name = tostring(Tags.counter), Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| where Instance == '$SqlInstance' and Database == '$db'\r\n| where Name =~ 'Transactions/sec' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') \r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), SeriesName\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum = sum(Val) by bin(TimeGenerated, $__interval), SeriesName\r\n| project-away SeriesName\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Transactions/sec",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 34
      },
      "id": 17,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Tags = todynamic(Tags)\r\n| extend Name = tostring(Tags.counter), Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| where Instance == '$SqlInstance' and Database == '$db'\r\n| where Name =~ 'User connections' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize Sum = sum(Val) by bin(TimeGenerated, $__interval), SeriesName\r\n| project-away SeriesName\r\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "User Connections",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 34
      },
      "id": 18,
      "maxDataPoints": 40,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Tags = todynamic(Tags)\r\n| extend Name = tostring(Tags.counter), Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| where Instance == '$SqlInstance' and Database == '$db'\r\n| where Name =~ 'Batch requests/sec' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), SeriesName\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum = sum(Val) by bin(TimeGenerated, $__interval), SeriesName\n\r\n| project-away SeriesName\r\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "Batch requests/sec",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 34
      },
      "id": 19,
      "maxDataPoints": 40,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Tags = todynamic(Tags)\r\n| extend Name = tostring(Tags.counter), Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| where Instance == '$SqlInstance' and Database == '$db'\r\n| where Name =~ 'SQL compilations/sec' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), SeriesName\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum = sum(Val) by bin(TimeGenerated, $__interval), SeriesName\n\r\n| project-away SeriesName\r\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "SQL compilations/sec",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 42
      },
      "id": 20,
      "maxDataPoints": 40,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Tags = todynamic(Tags)\r\n| extend Name = tostring(Tags.counter), Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| where Instance == '$SqlInstance' and Database == '$db'\r\n| where Name =~ 'SQL re-compilations/sec' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), SeriesName\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum = sum(Val) by bin(TimeGenerated, $__interval), SeriesName\n\r\n| project-away SeriesName\r\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "SQL re-compilations/sec",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 42
      },
      "id": 21,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Tags = todynamic(Tags)\r\n| extend Name = tostring(Tags.counter), Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| where Instance == '$SqlInstance' and Database == '$db'\r\n| where Name =~ 'Processes blocked' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), SeriesName\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum = sum(Val) by bin(TimeGenerated, $__interval), SeriesName\n\r\n| project-away SeriesName\r\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "Processes blocked",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 42
      },
      "id": 22,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace =~ 'sqlserver_performance' \r\n| extend Tags = todynamic(Tags)\r\n| extend Name = tostring(Tags.counter), Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\r\n| where Instance == '$SqlInstance' and Database == '$db'\r\n| where Name =~ 'Number of deadlocks/sec' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), SeriesName\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum = sum(Val) by bin(TimeGenerated, $__interval), SeriesName\n\r\n| project-away SeriesName\r\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "Number of deadlocks/sec",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "datasource": "$ds",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 50
      },
      "id": 24,
      "panels": [],
      "title": "Memory Clerks",
      "type": "row"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 24,
        "x": 0,
        "y": 51
      },
      "id": 26,
      "maxDataPoints": 40,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\r\n| where $__timeFilter()\r\n| where Namespace == 'sqlserver_memory_clerks'\r\n| extend Tags = todynamic(Tags)\r\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance), ClerkType = tostring(Tags.clerk_type)\r\n| where Instance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| extend SeriesName = strcat(Instance, '/', Database)\r\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), SeriesName, ClerkType\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\r\n| summarize Sum=sum(Val) by bin(TimeGenerated, $__interval), ClerkType, SeriesName\n| project-away SeriesName\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "",
      "transformations": [
        {
          "id": "labelsToFields",
          "options": {
            "valueLabel": "ClerkType"
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "datasource": "$ds",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 62
      },
      "id": 30,
      "panels": [],
      "title": "Database Space",
      "type": "row"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "^(.* size)"
            },
            "properties": [
              {
                "id": "unit",
                "value": "deckbytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Percent log used"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 63
      },
      "id": 32,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics \n| where $__timeFilter()\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\r\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| summarize \r\n        ['Data file(s) size']= avgif(Val, Counter == 'Data File(s) Size (KB)'),\r\n        ['Log file(s) size'] = avgif(Val, Counter == 'Log File(s) Size (KB)'),\r\n        ['Log file(s) used size'] = avgif(Val, Counter == 'Log File(s) Used Size (KB)'),\r\n        ['Percent log used'] = avgif(Val, Counter == 'Percent Log Used')\r\n    by SqlInstance, DbInstance",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "aggregation": "",
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "",
      "type": "stat"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": -1,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineStyle": {
              "fill": "solid"
            },
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "deckbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 69
      },
      "id": 34,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Data File(s) Size (KB)'\n| summarize Average = round(avg(Val), 2), Max = round(max(Val), 2), Min = round(min(Val), 2), P99th = round(percentile(Val, 99), 2), P95th = round(percentile(Val, 95), 2) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data File(s) Size (KB)",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "deckbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 69
      },
      "id": 35,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Log File(s) Size (KB)'\n| summarize Average = round(avg(Val), 2), Max = round(max(Val), 2), Min = round(min(Val), 2), P99th = round(percentile(Val, 99), 2), P95th = round(percentile(Val, 95), 2) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log File(s) Size (KB)",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": -1,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineStyle": {
              "fill": "solid"
            },
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "deckbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 78
      },
      "id": 36,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Log File(s) Used Size (KB)'\n| summarize Average = round(avg(Val), 2), Max = round(max(Val), 2), Min = round(min(Val), 2), P99th = round(percentile(Val, 99), 2), P95th = round(percentile(Val, 95), 2) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log File(s) Used Size (KB)",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": -1,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineStyle": {
              "fill": "solid"
            },
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 78
      },
      "id": 37,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "right"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Percent Log Used'\n| summarize Average = round(avg(Val), 2), Max = round(max(Val), 2), Min = round(min(Val), 2), P99th = round(percentile(Val, 99), 2), P95th = round(percentile(Val, 95), 2) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Percentage Log used",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "datasource": "$ds",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 87
      },
      "id": 39,
      "panels": [],
      "title": "Transactions",
      "type": "row"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "^(.*sec)"
            },
            "properties": [
              {
                "id": "unit",
                "value": "cps"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Log Flush Wait Time"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 88
      },
      "id": 40,
      "maxDataPoints": 40,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics \n| where $__timeFilter()\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\r\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| summarize (Start, StartValue) = arg_min(TimeGenerated, Val), (End, EndValue) = arg_max(TimeGenerated, Val) by Counter, Database, SqlInstance, DbInstance, bin(TimeGenerated, $__interval)\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\r\n| summarize \r\n        ['Write Transactions/sec'] = avgif(Val, Counter == 'Write Transactions/sec'),\r\n        ['Log Flushes/sec'] = avgif(Val, Counter == 'Log Flushes/sec'),\r\n        ['Log Bytes Flushed/sec'] = avgif(Val, Counter == 'Log Bytes Flushed/sec'),\r\n        ['Log Flush Wait Time'] = avgif(Val, Counter == 'Log Flush Wait Time')\r\n    by SqlInstance, DbInstance",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "aggregation": "",
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "",
      "type": "stat"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 94
      },
      "id": 42,
      "maxDataPoints": 20,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Write Transactions/sec'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), DbInstance\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum=sum(Val) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Write Transactions/sec",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 94
      },
      "id": 43,
      "maxDataPoints": 20,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Log Flushes/sec'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), DbInstance\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum=sum(Val) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log Flushes/sec",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 102
      },
      "id": 44,
      "maxDataPoints": 20,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Log Bytes Flushed/sec'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), DbInstance\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum=sum(Val) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log Bytes Flushed/sec",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 102
      },
      "id": 45,
      "maxDataPoints": 20,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_performance' and tostring(Tags.object) endswith ':Databases' and tostring(Tags.instance) !~ 'total'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), Counter = tostring(Tags.counter), DbInstance = tostring(Tags.instance)\n| where SqlInstance == '$SqlInstance' and DbInstance == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and Counter == 'Log Flush Wait Time'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), DbInstance\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize Sum=sum(Val) by bin(TimeGenerated, $__interval), DbInstance\n| project-away DbInstance\n| order by TimeGenerated asc",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log Flush Wait Time",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "datasource": "$ds",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 110
      },
      "id": 48,
      "panels": [],
      "title": "Database IO",
      "type": "row"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "LogReadBytes"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bits"
              },
              {
                "id": "displayName",
                "value": "Log read bytes"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "super-light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "LogWriteBytes"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bits"
              },
              {
                "id": "displayName",
                "value": "Log write bytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "LogReadLatency"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              },
              {
                "id": "displayName",
                "value": "Log read latency"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "super-light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "LogWriteLatency"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              },
              {
                "id": "displayName",
                "value": "Log write latency"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "orange",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "DataReadBytes"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bytes"
              },
              {
                "id": "displayName",
                "value": "Data read bytes"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "super-light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "DataWriteBytes"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bytes"
              },
              {
                "id": "displayName",
                "value": "Data write bytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "DataReadLatency"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              },
              {
                "id": "displayName",
                "value": "Data read latency"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "super-light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "DataWriteLatency"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              },
              {
                "id": "displayName",
                "value": "Data write latency"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "orange",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 111
      },
      "id": 46,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics \n| where $__timeFilter()\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\r\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type), FileName = tostring(Tags.logical_filename)\r\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE')\r\n| summarize (Start, StartValue) = arg_min(TimeGenerated, Val), (End, EndValue) = arg_max(TimeGenerated, Val) by Name, Database, SqlInstance, FileType, FileName\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\r\n| summarize\r\n        DataReadBytes = sumif(Val, Name == 'read_bytes' and FileType == 'DATA'),\r\n        DataWriteBytes = sumif(Val, Name == 'write_bytes' and FileType == 'DATA'),\r\n        DataReadLatency = avgif(Val, Name == 'read_latency_ms' and FileType == 'DATA'),\r\n        DataWriteLatency = avgif(Val, Name == 'write_latency_ms' and FileType == 'DATA'),\r\n        LogReadBytes = sumif(Val, Name == 'read_bytes' and FileType == 'LOG'),\r\n        LogWriteBytes = sumif(Val, Name == 'write_bytes' and FileType == 'LOG'),\r\n        LogReadLatency = avgif(Val, Name == 'read_latency_ms' and FileType == 'LOG'),\r\n        LogWriteLatency = avgif(Val, Name == 'write_latency_ms' and FileType == 'LOG')\r\n    by SqlInstance, Database\n    | project-reorder LogReadBytes, LogWriteBytes, LogReadLatency, LogWriteLatency, DataReadBytes, DataWriteBytes, DataReadLatency, DataWriteLatency, Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "aggregation": "",
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "title": "",
      "type": "stat"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 117
      },
      "id": 49,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == 'LOG' and Name == 'reads'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log reads",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 117
      },
      "id": 52,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == 'LOG' and Name == 'writes'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log writes",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 125
      },
      "id": 50,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == 'LOG' and Name == 'read_bytes'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log read bytes",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 125
      },
      "id": 56,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == 'LOG' and Name == 'write_bytes'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log writebytes",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 133
      },
      "id": 51,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == 'LOG' and Name == 'read_latency_ms'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Avg\"]=avg(Val) by bin(TimeGenerated, $__interval), Database\n| extend Avg=iff(isnan(Avg), toreal(0), Avg)\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log read latency",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 133
      },
      "id": 61,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == 'LOG' and Name == 'write_latency_ms'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Avg\"]=avg(Val) by bin(TimeGenerated, $__interval), Database\n| extend Avg=iff(isnan(Avg), toreal(0), Avg)\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Log write latency",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 141
      },
      "id": 55,
      "maxDataPoints": 40,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend FileTypeFilter = iff(tostring(Tags.measurement_db_type) == 'AzureSQLDB', 'DATA', 'ROWS')\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == FileTypeFilter and Name == 'reads'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data reads",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 141
      },
      "id": 58,
      "maxDataPoints": 40,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend FileTypeFilter = iff(tostring(Tags.measurement_db_type) == 'AzureSQLDB', 'DATA', 'ROWS')\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == FileTypeFilter and Name == 'writes'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data writes",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 149
      },
      "id": 57,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend FileTypeFilter = iff(tostring(Tags.measurement_db_type) == 'AzureSQLDB', 'DATA', 'ROWS')\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == FileTypeFilter and Name == 'read_bytes'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data read bytes",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 149
      },
      "id": 59,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend FileTypeFilter = iff(tostring(Tags.measurement_db_type) == 'AzureSQLDB', 'DATA', 'ROWS')\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == FileTypeFilter and Name == 'write_bytes'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Sum\"]=sum(Val) by bin(TimeGenerated, $__interval), Database\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data write bytes",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 157
      },
      "id": 54,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend FileTypeFilter = iff(tostring(Tags.measurement_db_type) == 'AzureSQLDB', 'DATA', 'ROWS')\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == FileTypeFilter and Name == 'read_latency_ms'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Avg\"]=avg(Val) by bin(TimeGenerated, $__interval), Database\n| extend Avg=iff(isnan(Avg), toreal(0), Avg)\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data read latency",
      "type": "timeseries"
    },
    {
      "datasource": "$ds",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 157
      },
      "id": 60,
      "maxDataPoints": 24,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.4.3",
      "targets": [
        {
          "appInsights": {
            "dimension": [],
            "metricName": "select",
            "timeGrain": "auto"
          },
          "azureLogAnalytics": {
            "query": "InsightsMetrics\n| where $__timeFilter(TimeGenerated)\n| extend Tags = todynamic(Tags)\r\n| where Namespace =~ 'sqlserver_database_io'\n| extend FileTypeFilter = iff(tostring(Tags.measurement_db_type) == 'AzureSQLDB', 'DATA', 'ROWS')\n| extend Database = tostring(Tags.database_name), SqlInstance = tostring(Tags.sql_instance), FileType = tostring(Tags.file_type)\n| extend Database = iff(isempty(Database), SqlInstance, Database)\n| where SqlInstance == '$SqlInstance' and Database == '$db' and Tags.replica_updateability == iff('$Replica' == 'secondary', 'READ_ONLY', 'READ_WRITE') and FileType == FileTypeFilter and Name == 'write_latency_ms'\n| summarize (StartTime, StartValue) = arg_min(TimeGenerated, Val), (EndTime, EndValue) = arg_max(TimeGenerated, Val) by bin(TimeGenerated, $__interval), Database\r\n| extend Val = iff(EndValue >= StartValue, EndValue - StartValue, real(null))\n| summarize [\"Avg\"]=avg(Val) by bin(TimeGenerated, $__interval), Database\n| extend Avg=iff(isnan(Avg), toreal(0), Avg)\n| order by TimeGenerated asc\n| project-away Database",
            "resultFormat": "time_series",
            "workspace": "$ws"
          },
          "azureMonitor": {
            "aggOptions": [],
            "dimensionFilter": "*",
            "dimensionFilters": [],
            "metricDefinition": "select",
            "metricName": "select",
            "metricNamespace": "select",
            "resourceGroup": "select",
            "resourceName": "select",
            "timeGrain": "auto",
            "timeGrains": [],
            "top": "10"
          },
          "insightsAnalytics": {
            "query": "",
            "resultFormat": "time_series"
          },
          "queryType": "Azure Log Analytics",
          "refId": "A",
          "subscription": "$sub"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Data write latency",
      "type": "timeseries"
    }
  ],
  "refresh": false,
  "schemaVersion": 27,
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Data Source",
        "multi": false,
        "name": "ds",
        "options": [],
        "query": "grafana-azure-monitor-datasource",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$ds",
        "definition": "subscriptions()",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Subscription",
        "multi": false,
        "name": "sub",
        "options": [],
        "query": "subscriptions()",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$ds",
        "definition": "Workspaces($sub)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Workspace",
        "multi": false,
        "name": "ws",
        "options": [],
        "query": "Workspaces($sub)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$ds",
        "definition": "workspace(\"$ws\").InsightsMetrics | where Namespace contains 'sqlserver_server_properties' and Name == 'engine_edition'\n| extend Tags = todynamic(Tags)\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\n| where Val == 5 | summarize by Instance\n| project value = Instance, label = Instance, selected = true",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Server",
        "multi": false,
        "name": "SqlInstance",
        "options": [],
        "query": "workspace(\"$ws\").InsightsMetrics | where Namespace contains 'sqlserver_server_properties' and Name == 'engine_edition'\n| extend Tags = todynamic(Tags)\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\n| where Val == 5 | summarize by Instance\n| project value = Instance, label = Instance, selected = true",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$ds",
        "definition": "workspace(\"$ws\").InsightsMetrics\n| where Namespace contains 'sqlserver_server_properties' and Name == 'uptime'\n| extend Tags = todynamic(Tags)\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance), Replica = tostring(iff(Tags.replica_updateability == 'READ_WRITE', 'primary', 'secondary'))\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\n| where Instance =~ '$SqlInstance'\n| distinct Database",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Database",
        "multi": false,
        "name": "db",
        "options": [],
        "query": "workspace(\"$ws\").InsightsMetrics\n| where Namespace contains 'sqlserver_server_properties' and Name == 'uptime'\n| extend Tags = todynamic(Tags)\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance), Replica = tostring(iff(Tags.replica_updateability == 'READ_WRITE', 'primary', 'secondary'))\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\n| where Instance =~ '$SqlInstance'\n| distinct Database",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$ds",
        "definition": "workspace(\"$ws\").InsightsMetrics\n| extend Tags = todynamic(Tags)\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\n| where Instance == '$SqlInstance'\n| where Namespace =~ 'sqlserver_azure_db_resource_stats'\n| summarize by value = tostring(iff(Tags.replica_updateability == 'READ_WRITE', 'primary', 'secondary'))\n| project value, label = value, selected = true\n| order by label asc",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "Replica",
        "options": [],
        "query": "workspace(\"$ws\").InsightsMetrics\n| extend Tags = todynamic(Tags)\n| extend Database = tostring(Tags.database_name), Instance = tostring(Tags.sql_instance)\n| extend DatabaseKey = iff(Database == Instance, Database, strcat(Database, ' on ', Instance))\n| where Instance == '$SqlInstance'\n| where Namespace =~ 'sqlserver_azure_db_resource_stats'\n| summarize by value = tostring(iff(Tags.replica_updateability == 'READ_WRITE', 'primary', 'secondary'))\n| project value, label = value, selected = true\n| order by label asc",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-4h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "Azure / Insights / SQL Database",
  "uid": "cIld6iqMk",
  "version": 69
}
