Grafana dashboard: Explore Data

Hydrolix Dashboard to visualize and drill down into Akamai Datastream logs

{
  "__inputs": [
    {
      "name": "DS_HYDRO",
      "label": "Hydrolix Cluster",
      "description": "",
      "type": "datasource",
      "pluginId": "grafana-clickhouse-datasource",
      "pluginName": "ClickHouse"
    },
    {
      "name": "VAR_TABLE",
      "type": "constant",
      "label": "table",
      "value": "",
      "description": ""
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.5.1"
    },
    {
      "type": "datasource",
      "id": "grafana-clickhouse-datasource",
      "name": "ClickHouse",
      "version": "3.0.1-beta"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_HYDRO}"
      },
      "description": "Total logs, click to view if number is lower than 1000",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byValue",
              "options": {
                "op": "lte",
                "reducer": "last",
                "value": 1000
              }
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "title": "View Logs",
                    "url": "/d/b7e96d21-449f-453e-b0c3-37346e3224a9/raw-logs?${__all_variables}&${__url_time_range}"
                  }
                ]
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "from": 0,
                      "result": {
                        "index": 0,
                        "text": "View Logs"
                      },
                      "to": 1000
                    },
                    "type": "range"
                  }
                ]
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 7,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.5.1",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_HYDRO}"
          },
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT count()\nFROM ${table}\nWHERE $__timeFilter(reqTimeSec)\nAND if (${filter:singlequote} = 'none', true, ${filter})",
          "refId": "A"
        }
      ],
      "title": "Total Count",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_HYDRO}"
      },
      "gridPos": {
        "h": 2,
        "w": 21,
        "x": 3,
        "y": 0
      },
      "id": 6,
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "${filter}",
        "mode": "markdown"
      },
      "pluginVersion": "9.5.1",
      "title": "Current Filter",
      "type": "text"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_HYDRO}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 2
      },
      "id": 4,
      "options": {
        "legend": {
          "calcs": [
            "sum",
            "mean"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true,
          "sortBy": "Total",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "builderOptions": {
            "database": "elkjop",
            "fields": [],
            "filters": [
              {
                "condition": "AND",
                "filterType": "custom",
                "key": "reqTimeSec",
                "operator": "WITH IN DASHBOARD TIME RANGE",
                "restrictToFields": [
                  {
                    "label": "reqTimeSec",
                    "name": "reqTimeSec",
                    "picklistValues": [],
                    "type": "DateTime"
                  }
                ],
                "type": "datetime"
              }
            ],
            "metrics": [],
            "mode": "trend",
            "orderBy": [],
            "table": "logs",
            "timeField": "reqTimeSec",
            "timeFieldType": "DateTime"
          },
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_HYDRO}"
          },
          "format": 0,
          "meta": {
            "builderOptions": {
              "database": "elkjop",
              "fields": [],
              "filters": [
                {
                  "condition": "AND",
                  "filterType": "custom",
                  "key": "reqTimeSec",
                  "operator": "WITH IN DASHBOARD TIME RANGE",
                  "restrictToFields": [
                    {
                      "label": "reqTimeSec",
                      "name": "reqTimeSec",
                      "picklistValues": [],
                      "type": "DateTime"
                    }
                  ],
                  "type": "datetime"
                }
              ],
              "metrics": [],
              "mode": "trend",
              "orderBy": [],
              "table": "logs",
              "timeField": "reqTimeSec",
              "timeFieldType": "DateTime"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT $__timeInterval(reqTimeSec) as time, count()\nFROM ${table}\nWHERE $__timeFilter(reqTimeSec)\nAND if (${filter:singlequote} = 'none', true, ${filter})\nGROUP BY time\nORDER BY time ASC, count()",
          "refId": "A",
          "selectedFormat": 0
        }
      ],
      "title": "Log Count",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 10
      },
      "id": 1,
      "panels": [],
      "title": "Schema",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_HYDRO}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true,
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "name"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 280
              },
              {
                "id": "links",
                "value": [
                  {
                    "title": "Filter",
                    "url": "/d/ceae11c9-c359-4189-98f0-70fc34a6880c/explore-data?&var-sql=${__value.text}&${filter:queryparam}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "default_type"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "default_expression"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "comment"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "codec_expression"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "ttl_expression"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 14,
        "w": 9,
        "x": 0,
        "y": 11
      },
      "id": 2,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.5.1",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_HYDRO}"
          },
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "DESCRIBE ${table}",
          "refId": "A"
        }
      ],
      "title": "Table",
      "type": "table"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_HYDRO}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "inspect": false
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "count()"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 126
              },
              {
                "id": "links"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "include"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "title": "Include",
                    "url": "/d/ceae11c9-c359-4189-98f0-70fc34a6880c/explore-data?${filter:queryparam} AND ${sql}='${__data.fields[1]}'&${sql:queryparam}"
                  }
                ]
              },
              {
                "id": "custom.width",
                "value": 70
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "exclude"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "title": "Exclude",
                    "url": "/d/ceae11c9-c359-4189-98f0-70fc34a6880c/explore-data?${filter:queryparam} AND ${sql}!='${__data.fields[1]}'&${sql:queryparam}&${__url_time_range}"
                  }
                ]
              },
              {
                "id": "custom.width",
                "value": 70
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "statusCode"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 582
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 14,
        "w": 15,
        "x": 9,
        "y": 11
      },
      "id": 3,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "latency"
          }
        ]
      },
      "pluginVersion": "9.5.1",
      "targets": [
        {
          "builderOptions": {
            "database": "elkjop",
            "fields": [],
            "filters": [
              {
                "condition": "AND",
                "filterType": "custom",
                "key": "reqTimeSec",
                "operator": "WITH IN DASHBOARD TIME RANGE",
                "restrictToFields": [
                  {
                    "label": "reqTimeSec",
                    "name": "reqTimeSec",
                    "picklistValues": [],
                    "type": "DateTime"
                  }
                ],
                "type": "datetime"
              }
            ],
            "metrics": [],
            "mode": "trend",
            "orderBy": [],
            "table": "logs",
            "timeField": "reqTimeSec",
            "timeFieldType": "DateTime"
          },
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_HYDRO}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "database": "elkjop",
              "fields": [],
              "filters": [
                {
                  "condition": "AND",
                  "filterType": "custom",
                  "key": "reqTimeSec",
                  "operator": "WITH IN DASHBOARD TIME RANGE",
                  "restrictToFields": [
                    {
                      "label": "reqTimeSec",
                      "name": "reqTimeSec",
                      "picklistValues": [],
                      "type": "DateTime"
                    }
                  ],
                  "type": "datetime"
                }
              ],
              "metrics": [],
              "mode": "trend",
              "orderBy": [],
              "table": "logs",
              "timeField": "reqTimeSec",
              "timeFieldType": "DateTime"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT count(), ${sql}, '+' as include, '-' as exclude\nFROM ${table}\nWHERE $__timeFilter(reqTimeSec)\nAND if (${filter:singlequote} = 'none', true, ${filter})\nGROUP BY ${sql}\nORDER BY count() DESC\nLIMIT 100\n",
          "refId": "A",
          "selectedFormat": 1
        }
      ],
      "title": "View Top 100 value for Column ${sql}",
      "transformations": [],
      "type": "table"
    }
  ],
  "refresh": "",
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "statusCode",
          "value": "statusCode"
        },
        "hide": 2,
        "label": "SQL Editor",
        "name": "sql",
        "options": [
          {
            "selected": true,
            "text": "reqMethod",
            "value": "reqMethod"
          }
        ],
        "query": "reqMethod",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {
          "selected": false,
          "text": "1=1",
          "value": "1=1"
        },
        "hide": 0,
        "label": "filter",
        "name": "filter",
        "options": [
          {
            "selected": true,
            "text": "1=1",
            "value": "1=1"
          }
        ],
        "query": "1=1",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "hide": 2,
        "name": "table",
        "query": "${VAR_TABLE}",
        "skipUrlSync": false,
        "type": "constant",
        "current": {
          "value": "${VAR_TABLE}",
          "text": "${VAR_TABLE}",
          "selected": false
        },
        "options": [
          {
            "value": "${VAR_TABLE}",
            "text": "${VAR_TABLE}",
            "selected": false
          }
        ]
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Explore Data",
  "uid": "ceae11c9-c359-4189-98f0-70fc34a6880c",
  "version": 2,
  "weekStart": "",
  "gnetId": 18820
}