Grafana dashboard: Usage Insights - 2 - Data sources
Description: Dashboard surfacing details on datasource usage in Grafana Cloud. Uses provisioned Loki and Prometheus datasources.


{
  "__inputs": [
    {
      "description": "Provisioned Loki log stream for usage insights in Grafana Cloud.",
      "label": "loki-datasource",
      "name": "DS_LOKI",
      "pluginId": "loki",
      "pluginName": "Loki",
      "type": "datasource"
    },
    {
      "description": "Provisioned Prometheus metrics on general usage in Grafana Cloud.",
      "label": "prometheus",
      "name": "DS_PROMETHEUS",
      "pluginId": "prometheus",
      "pluginName": "Prometheus",
      "type": "datasource"
    }
  ],
  "description": "Dashboard surfacing details on datasource usage in Grafana Cloud. Uses provisioned Loki and Prometheus datasources.",
  "editable": false,
  "fiscalYearStartMonth": 0,
  "gnetId": 15088,
  "graphTooltip": 0,
  "links": [
    {
      "icon": "bolt",
      "title": "Clear Selection",
      "type": "link",
      "url": "/d/AEbrOO2Mz"
    },
    {
      "icon": "dashboard",
      "title": "Usage Insights Overview",
      "type": "link",
      "url": "/d/XU8HAD5Gk"
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "links": [
            {
              "title": "Data source details",
              "url": "/d/AEbrOO2Mz?var-datasource_id=${__data.fields.ID}&var-datasource_name=${__data.fields.Name:percentencode}&${__url_time_range}"
            }
          ]
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Queries"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "ID"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 60
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 190
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "options": {
        "frameIndex": 1,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Queries"
          }
        ]
      },
      "targets": [
        {
          "expr": "sum by (datasourceId, datasourceName) (sum_over_time({instance_type=\"grafana\"} | logfmt | eventName=\"data-request\" | datasourceName != \"-- Grafana --\" | datasourceName != \"-- Mixed --\" | unwrap totalQueries [$__range]))",
          "queryType": "range",
          "refId": "requests"
        }
      ],
      "title": "By query volume",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": true,
            "reducers": [
              "last"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true,
              "Time": true
            },
            "renameByName": {
              "Last": "Queries",
              "Value #requests": "Queries",
              "datasourceId": "ID",
              "datasourceName": "Name"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "Max error rate for the selected time period, may be different from the average error rate shown below.",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "links": [
            {
              "title": "Data source details",
              "url": "/d/AEbrOO2Mz?var-datasource_id=${__data.fields.ID}&var-datasource_name=${__data.fields.Name:percentencode}&${__url_time_range}"
            }
          ],
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Error Rate"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-GrYlRd"
                }
              },
              {
                "id": "unit",
                "value": "percent"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "ID"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 60
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 223
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "options": {
        "frameIndex": 1,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Error Rate"
          }
        ]
      },
      "targets": [
        {
          "expr": "sum by (datasourceId, datasourceName) (count_over_time({instance_type=\"grafana\"} | logfmt | eventName=\"data-request\" | datasourceName != \"-- Grafana --\" | datasourceName != \"-- Mixed --\" | error!=\"\" [$__range]))/sum by (datasourceId, datasourceName) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceName != \"-- Grafana --\" | datasourceName != \"-- Mixed --\" | eventName=\"data-request\" [$__range])) * 100",
          "hide": false,
          "queryType": "range",
          "refId": "errors"
        }
      ],
      "title": "By error rate",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": true,
            "reducers": [
              "max"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true,
              "Time": true
            },
            "indexByName": {
              "Value #errors": 2,
              "datasourceId": 0,
              "datasourceName": 1
            },
            "renameByName": {
              "Last": "Error Rate",
              "Max": "Error Rate",
              "Value #errors": "Error Rate",
              "datasourceId": "ID",
              "datasourceName": "Name"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Mixed --"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "purple",
            "mode": "fixed"
          },
          "noValue": "Pick a datasource above!",
          "unit": "string"
        }
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 9
      },
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "/^datasourceName$/",
          "values": true
        },
        "textMode": "value"
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_LOKI}"
          },
          "expr": "sum by (datasourceName) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" [$__range]))",
          "queryType": "instant",
          "refId": "host"
        }
      ],
      "title": "Name",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "This datasource ID is used in the underlying queries for this dashbaord. If you only have one stack, your datasource names will be unique. But, if you have more than one stack, you may have multiple datasources with the same name and must use this ID to query their metrics accurately.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "purple",
            "mode": "fixed"
          },
          "unit": "string"
        }
      },
      "gridPos": {
        "h": 5,
        "w": 3,
        "x": 6,
        "y": 9
      },
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "/.*/",
          "values": true
        },
        "textMode": "value"
      },
      "targets": [
        {
          "expr": "sum by (datasourceId) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" [$__range]))",
          "queryType": "instant",
          "refId": "host"
        }
      ],
      "title": "ID",
      "transformations": [
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greater",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #host"
              }
            ],
            "match": "all",
            "type": "include"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Time 1": true,
              "Time 2": true,
              "Value": true,
              "Value #host": true,
              "id": true,
              "instance_id": true
            },
            "indexByName": {
              "Time 1": 2,
              "Time 2": 4,
              "Value": 6,
              "Value #host": 3,
              "id": 5,
              "instance_id": 1,
              "slug": 0
            },
            "renameByName": {
              "Value #A": "isHost",
              "Value #hostId": "isHost"
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Mixed --"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "purple",
            "mode": "fixed"
          },
          "unit": "string"
        }
      },
      "gridPos": {
        "h": 5,
        "w": 3,
        "x": 9,
        "y": 9
      },
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "/.*/",
          "values": true
        },
        "textMode": "value"
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_LOKI}"
          },
          "expr": "sum by (instance_id) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" [$__range]))",
          "queryType": "instant",
          "refId": "host"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "exemplar": false,
          "expr": "label_replace(sum(grafanacloud_grafana_instance_info{}) by (id, slug), \"instance_id\", \"$1\", \"id\", \"(.*)\")",
          "format": "table",
          "hide": false,
          "instant": true,
          "range": false,
          "refId": "instanceNames"
        }
      ],
      "title": "Host Stack Name",
      "transformations": [
        {
          "id": "seriesToColumns",
          "options": {
            "byField": "instance_id"
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "greater",
                  "options": {
                    "value": 0
                  }
                },
                "fieldName": "Value #host"
              }
            ],
            "match": "all",
            "type": "include"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Time 1": true,
              "Time 2": true,
              "Value": true,
              "Value #host": true,
              "id": true,
              "instance_id": true
            },
            "indexByName": {
              "Time 1": 2,
              "Time 2": 4,
              "Value": 6,
              "Value #host": 3,
              "id": 5,
              "instance_id": 1,
              "slug": 0
            },
            "renameByName": {
              "Value #A": "isHost",
              "Value #hostId": "isHost"
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "Dashboards and users querying this data source, total queries, cache rate, and error rate.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "purple"
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Error Rate"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green"
                    },
                    {
                      "color": "#EAB839",
                      "value": 5
                    },
                    {
                      "color": "red",
                      "value": 10
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Cache Rate"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "percentage",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 5
                    },
                    {
                      "value": 10,
                      "color": "#EAB839"
                    },
                    {
                      "value": 20,
                      "color": "green"
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 12,
        "x": 12,
        "y": 9
      },
      "maxDataPoints": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "max"
          ],
          "fields": "",
          "values": true
        },
        "textMode": "value_and_name"
      },
      "targets": [
        {
          "expr": "count(sum by (dashboardId) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" [$__range])))",
          "queryType": "instant",
          "refId": "Dashboards"
        },
        {
          "expr": "count(sum by (username) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" [$__range])))",
          "hide": false,
          "queryType": "instant",
          "refId": "Users"
        },
        {
          "expr": "sum(sum_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | unwrap totalQueries [$__range]))",
          "hide": false,
          "queryType": "instant",
          "refId": "Queries"
        },
        {
          "expr": "100 * sum(sum_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | unwrap cachedQueries [$__range])) / sum(sum_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | unwrap totalQueries [$__range]))",
          "hide": false,
          "queryType": "instant",
          "refId": "Cache Rate"
        },
        {
          "expr": "100 * sum(count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | error!=\"\" [$__range])) / sum(count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" [$__range]))",
          "hide": false,
          "queryType": "instant",
          "refId": "Errors"
        }
      ],
      "title": "Usage",
      "transformations": [
        {
          "id": "seriesToColumns",
          "options": {
            "byField": "Time"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "datasourceId": true
            },
            "indexByName": {
              "Value #Cache Rate": 3,
              "Value #Dashboards": 1,
              "Value #Errors": 4,
              "Value #Queries": 2,
              "Value #Users": 0
            },
            "renameByName": {
              "Value #Cache Rate": "Cache Rate",
              "Value #Dashboards": "Dashboard Views",
              "Value #Errors": "Error Rate",
              "Value #Queries": "Total Queries",
              "Value #Users": "Users Seen",
              "datasourceId": ""
            }
          }
        }
      ],
      "type": "stat"
    },
    {
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "unit": "short"
        }
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 14
      },
      "hiddenSeries": false,
      "interval": "5m",
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:182",
          "alias": "Data Requests",
          "color": "#56A64B"
        },
        {
          "$$hashKey": "object:190",
          "alias": "Errors",
          "color": "#F2CC0C"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum by(host) (sum_over_time({instance_type=\"grafana\"} | logfmt | eventName=\"data-request\" | datasourceId=\"${datasource_id}\" | error = \"\" | unwrap totalQueries [$__interval]))",
          "legendFormat": "Data Requests",
          "queryType": "range",
          "refId": "queries"
        },
        {
          "expr": "sum by(host) (count_over_time({instance_type=\"grafana\"} | logfmt | eventName=\"data-request\" | datasourceId=\"${datasource_id}\" | error != \"\" [$__interval]))",
          "legendFormat": "Errors",
          "queryType": "range",
          "refId": "errors"
        }
      ],
      "title": "Data source requests over time",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true
      },
      "yaxes": [
        {
          "$$hashKey": "object:234",
          "decimals": 0,
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:235",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {
        "95th percentile": "blue",
        "max latency": "super-light-blue"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "unit": "ms"
        }
      },
      "fill": 5,
      "fillGradient": 9,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 14
      },
      "hiddenSeries": false,
      "interval": "30",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:232",
          "alias": "max latency",
          "dashes": true,
          "fillGradient": 3
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "quantile_over_time(0.95,{instance_type=\"grafana\"} | logfmt | eventName=\"data-request\" | error=\"\" | datasourceId=\"${datasource_id}\" | unwrap duration | __error__=\"\" [$__interval]) by (host)",
          "legendFormat": "95th percentile",
          "refId": "C"
        },
        {
          "expr": "max(max_over_time({instance_type=\"grafana\"} | logfmt | eventName=\"data-request\" | error=\"\" | datasourceId=\"${datasource_id}\" | unwrap duration | __error__=\"\" [$__interval])) by (host)",
          "legendFormat": "max latency",
          "refId": "D"
        }
      ],
      "title": "95th percentile of request time",
      "tooltip": {
        "shared": false,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true
      },
      "yaxes": [
        {
          "$$hashKey": "object:178",
          "format": "ms",
          "logBase": 1,
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:179",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": true
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Count"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-YlRd"
                }
              },
              {
                "id": "unit",
                "value": "none"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 14
      },
      "options": {
        "frameIndex": 1,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Count"
          }
        ]
      },
      "targets": [
        {
          "expr": "sum by (error) (count_over_time({instance_type=\"grafana\"} | logfmt | error!=\"\" | datasourceId=\"${datasource_id}\" [$__range]))",
          "hide": false,
          "queryType": "range",
          "refId": "errors"
        }
      ],
      "title": "Top error types",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": true,
            "reducers": [
              "last"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true
            },
            "indexByName": {
              "Field": 0,
              "Last": 2,
              "error": 1
            },
            "renameByName": {
              "Last": "Count",
              "error": "Error"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false,
            "inspect": false
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Query Count"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 22
      },
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Query Count"
          }
        ]
      },
      "targets": [
        {
          "expr": "sum by (username) (sum_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | datasourceName != \"-- Grafana --\" | datasourceName != \"-- Mixed --\" | unwrap totalQueries [$__interval]))",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "Users by queries",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": true,
            "reducers": [
              "total"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true,
              "Time": true
            },
            "renameByName": {
              "Total": "Query Count",
              "Value #A": "Query Count",
              "username": "Username"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false,
            "inspect": false
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Query Count"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-BlPu"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Folder"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 109
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 22
      },
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Query Count"
          }
        ]
      },
      "targets": [
        {
          "expr": "sum by (folderName, dashboardName,dashboardId) (sum_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | dashboardName != \"\" | unwrap totalQueries [$__interval]))",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "Dashboards by queries",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": true,
            "reducers": [
              "total"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true,
              "Time": true,
              "dashboardId": true
            },
            "indexByName": {
              "Field": 0,
              "Total": 4,
              "dashboardId": 1,
              "dashboardName": 3,
              "folderName": 2
            },
            "renameByName": {
              "Total": "Query Count",
              "Value #A": "Query Count",
              "dashboardName": "Name",
              "folderName": "Folder",
              "username": "Username"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false,
            "inspect": false
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Error Count"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-YlRd"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 30
      },
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Error Count"
          }
        ]
      },
      "targets": [
        {
          "expr": "sum by (username) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | error!=\"\" [$__interval]))",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "Users with errors",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": true,
            "reducers": [
              "total"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true,
              "Time": true
            },
            "renameByName": {
              "Total": "Error Count",
              "Value #A": "Error Count",
              "username": "Username"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_LOKI}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false,
            "inspect": false
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Error Count"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-YlRd"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Folder"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 109
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 30
      },
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Error Count"
          }
        ]
      },
      "targets": [
        {
          "expr": "sum by (folderName, dashboardName,dashboardId) (count_over_time({instance_type=\"grafana\"} | logfmt | datasourceId=\"${datasource_id}\" | eventName=\"data-request\" | dashboardName != \"\" | error != \"\" [$__interval]))",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "title": "Dashboards with errors",
      "transformations": [
        {
          "id": "reduce",
          "options": {
            "labelsToFields": true,
            "reducers": [
              "total"
            ]
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Field": true,
              "Time": true,
              "dashboardId": true
            },
            "indexByName": {
              "Field": 0,
              "Total": 4,
              "dashboardId": 1,
              "dashboardName": 3,
              "folderName": 2
            },
            "renameByName": {
              "Total": "Error Count",
              "Value #A": "Query Count",
              "dashboardName": "Name",
              "folderName": "Folder",
              "username": "Username"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 37,
  "style": "dark",
  "tags": [
    "grafanacloud"
  ],
  "templating": {
    "list": [
      {
        "hide": 2,
        "label": "",
        "name": "datasource_name",
        "query": "None",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "description": "If you know your datasource ID, enter it here.",
        "hide": 0,
        "label": "Data source ID",
        "name": "datasource_id",
        "query": "None",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timezone": "",
  "title": "Usage Insights - 2 - Data sources",
  "uid": "AEbrOO2Mz",
  "version": 8,
  "weekStart": ""
}