Grafana dashboard: Kafka Topic Metrics
Description: Kafka Topic Metrics for Redpanda

A dashboard focused on topic metrics, with the following charts:
- topic summary
- records received per topic
- write throughput per topic
- read throughput per topic

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.6"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph (old)",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Skew (%)"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "NaN": {
                        "index": 0,
                        "text": "-"
                      }
                    },
                    "type": "value"
                  }
                ]
              },
              {
                "id": "custom.width",
                "value": 185
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "red",
                      "value": 0.1
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Partitions"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 139
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Max Offset"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 149
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": ".*Throughput"
            },
            "properties": [
              {
                "id": "unit",
                "value": "Bps"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 8,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "(sum(redpanda_kafka_max_offset{topic!=\"__consumer_offsets\", redpanda_namespace=\"kafka\",redpanda_cloud_data_cluster_name=~\"[[data_cluster]]\", redpanda_topic=~\"[[redpanda_topic]]\"}) by ([[aggr_criteria]]))   ",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "key": "Q-2f2af91b-9266-4c03-8a75-09b37685e65d-0",
          "range": false,
          "refId": "MaxOffset"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "100 * abs((stddev by (redpanda_topic) (sum(redpanda_kafka_max_offset{redpanda_namespace=\"kafka\",redpanda_cloud_data_cluster_name=~\"\", redpanda_topic=~\"[[redpanda_topic]]\"}) by (redpanda_topic,redpanda_partition))) /  (avg by (redpanda_topic) ((sum(redpanda_kafka_max_offset{redpanda_namespace=\"kafka\",redpanda_cloud_data_cluster_name=~\"\", redpanda_topic=~\"[[redpanda_topic]]\"}) by (redpanda_topic,redpanda_partition)))))",
          "format": "table",
          "hide": false,
          "instant": true,
          "range": false,
          "refId": "Skew"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max by(redpanda_topic)(redpanda_kafka_partitions{redpanda_namespace=\"kafka\",redpanda_cloud_data_cluster_name=~\"\", redpanda_topic=~\"[[redpanda_topic]]\"})",
          "format": "table",
          "hide": false,
          "instant": true,
          "range": false,
          "refId": "Partitions"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max by(redpanda_topic)(redpanda_kafka_replicas{redpanda_namespace=\"kafka\",redpanda_cloud_data_cluster_name=~\"\", redpanda_topic=~\"[[redpanda_topic]]\"})",
          "format": "table",
          "hide": false,
          "instant": true,
          "range": false,
          "refId": "Replicas"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sum(rate(redpanda_kafka_request_bytes_total{redpanda_topic=~\"[[redpanda_topic]]\",redpanda_cloud_data_cluster_name=~\"[[data_cluster]]\",redpanda_request=\"produce\"}[1m])) by (redpanda_topic)",
          "format": "table",
          "hide": false,
          "instant": true,
          "range": false,
          "refId": "ProduceThroughput"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sum(rate(redpanda_kafka_request_bytes_total{redpanda_topic=~\"[[redpanda_topic]]\",redpanda_cloud_data_cluster_name=~\"[[data_cluster]]\",redpanda_request=\"consume\"}[1m])) by (redpanda_topic)",
          "format": "table",
          "hide": false,
          "instant": true,
          "range": false,
          "refId": "ConsumeThroughput"
        }
      ],
      "title": "Topic Summary",
      "transformations": [
        {
          "id": "seriesToColumns",
          "options": {
            "byField": "redpanda_topic"
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Time 1": true,
              "Time 2": true,
              "Time 3": false,
              "Time 4": false,
              "redpanda_request": false
            },
            "indexByName": {
              "Time 1": 1,
              "Time 2": 2,
              "Time 3": 7,
              "Time 4": 8,
              "Value #MaxOffset": 5,
              "Value #Partitions": 4,
              "Value #Replicas": 3,
              "Value #Skew": 6,
              "redpanda_topic": 0
            },
            "renameByName": {
              "Time 1": "",
              "Value #A": "Topic Size",
              "Value #B": "Topic Skew (%age)",
              "Value #ConsumeThroughput": "Consume Throughput",
              "Value #MaxOffset": "Max Offset",
              "Value #Partitions": "Partitions",
              "Value #ProduceThroughput": "Produce Throughput",
              "Value #Replicas": "Replicas",
              "Value #Skew": "Skew (%)",
              "Value #Throughput": "Thoughput",
              "redpanda_partition": "Partition",
              "redpanda_topic": "Topic"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 7
      },
      "hiddenSeries": false,
      "id": 2,
      "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,
      "pluginVersion": "9.3.6",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": true,
          "expr": "sum by([[aggr_criteria]]) (rate(redpanda_kafka_max_offset{redpanda_topic=~\"[[redpanda_topic]]\", redpanda_cloud_data_cluster_name=~\"[[data_cluster]]\"}[1m]))",
          "interval": "",
          "legendFormat": "{{redpanda_topic}}:{{redpanda_partition}}",
          "range": true,
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Records Received per Topic",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:24",
          "format": "short",
          "logBase": 1,
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:25",
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 14
      },
      "hiddenSeries": false,
      "id": 7,
      "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,
      "pluginVersion": "9.3.6",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": true,
          "expr": "sum(irate(redpanda_kafka_request_bytes_total{redpanda_topic=~\"[[redpanda_topic]]\", redpanda_request=\"produce\",redpanda_cloud_data_cluster_name=~\"[[data_cluster]]\"}[1m])) by ([[aggr_criteria]])",
          "interval": "",
          "legendFormat": "{{redpanda_topic}}:{{redpanda_partition}}",
          "range": true,
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Write Throughput per Topic",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:225",
          "format": "Bps",
          "logBase": 1,
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:226",
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 14
      },
      "hiddenSeries": false,
      "id": 6,
      "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,
      "pluginVersion": "9.3.6",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": true,
          "expr": "sum(irate(redpanda_kafka_request_bytes_total{redpanda_topic=~\"[[redpanda_topic]]\",redpanda_request=\"consume\",vectorized_cloud_data_cluster_name=~\"[[data_cluster]]\"}[1m])) by ([[aggr_criteria]])",
          "interval": "",
          "legendFormat": "{{redpanda_topic}}:{{redpanda_partition}}",
          "range": true,
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Read Throughput per Topic",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:225",
          "format": "Bps",
          "logBase": 1,
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:226",
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    }
  ],
  "refresh": "5s",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Data Source",
        "multi": false,
        "name": "DS_PROMETHEUS",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(vectorized_cloud_data_cluster_name)",
        "hide": 0,
        "includeAll": false,
        "label": "Data cluster",
        "multi": false,
        "name": "data_cluster",
        "options": [],
        "query": {
          "query": "label_values(vectorized_cloud_data_cluster_name)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "allValue": "",
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(redpanda_kafka_request_bytes_total{redpanda_namespace='kafka', redpanda_topic !~ 'controller|group'}, redpanda_topic)",
        "hide": 0,
        "includeAll": true,
        "label": "Topic",
        "multi": true,
        "name": "redpanda_topic",
        "options": [],
        "query": {
          "query": "label_values(redpanda_kafka_request_bytes_total{redpanda_namespace='kafka', redpanda_topic !~ 'controller|group'}, redpanda_topic)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": true,
          "text": "Topic",
          "value": "redpanda_topic"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Aggregate by",
        "multi": false,
        "name": "aggr_criteria",
        "options": [
          {
            "selected": true,
            "text": "Topic",
            "value": "redpanda_topic"
          },
          {
            "selected": false,
            "text": "Topic,Partition",
            "value": "redpanda_topic,redpanda_partition"
          }
        ],
        "query": "Topic : redpanda_topic,Topic\\,Partition : redpanda_topic\\,redpanda_partition",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "filters": [],
        "hide": 0,
        "name": "Filters",
        "skipUrlSync": false,
        "type": "adhoc"
      }
    ]
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Kafka Topic Metrics",
  "uid": "Nxwln29Mz",
  "version": 1,
  "weekStart": "",
  "gnetId": 18132,
  "description": "Kafka Topic Metrics for Redpanda"
}