Copilot commented on code in PR #7988:
URL: https://github.com/apache/incubator-seata/pull/7988#discussion_r2785447390
##########
script/server/grafana/panel.json:
##########
@@ -0,0 +1,651 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 0,
+ "id": 707,
Review Comment:
The exported dashboard includes a fixed numeric "id" (707). Grafana
dashboard JSON meant for import should typically omit "id" or set it to null so
imports don’t try to update a non-existent dashboard or collide with an
existing one.
```suggestion
"id": null,
```
##########
script/server/grafana/panel.json:
##########
@@ -0,0 +1,651 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 0,
+ "id": 707,
+ "links": [],
+ "liveNow": false,
+ "panels": [
+ {
+ "aliasColors": {},
+ "breakPoint": "50%",
+ "combine": {
+ "label": "Others",
+ "threshold": 0
+ },
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
Review Comment:
The Prometheus datasource is hardcoded to a specific Grafana datasource UID
("hJ8_mPCnk"). This makes the dashboard non-portable (imports will fail unless
the target Grafana has the same UID). Consider using Grafana’s datasource input
mechanism (e.g., __inputs) or a datasource variable placeholder so the UID can
be selected at import time.
##########
script/server/grafana/panel.json:
##########
@@ -0,0 +1,651 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 0,
+ "id": 707,
+ "links": [],
+ "liveNow": false,
+ "panels": [
+ {
+ "aliasColors": {},
+ "breakPoint": "50%",
+ "combine": {
+ "label": "Others",
+ "threshold": 0
+ },
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "palette-classic"
+ },
+ "custom": {
+ "hideFrom": {
+ "legend": false,
+ "tooltip": false,
+ "viz": false
+ }
+ },
+ "mappings": []
+ },
+ "overrides": []
+ },
+ "fontSize": "80%",
+ "format": "locale",
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "id": 2,
+ "legend": {
+ "header": "事务状态",
+ "percentage": false,
+ "show": true,
+ "sideWidth": 200,
+ "values": true
+ },
+ "legendType": "Right side",
+ "links": [],
+ "nullPointMode": "connected",
+ "options": {
+ "legend": {
+ "displayMode": "list",
+ "placement": "bottom",
+ "showLegend": true
+ },
+ "pieType": "pie",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "tooltip": {
+ "mode": "single",
+ "sort": "none"
+ }
+ },
+ "pieType": "pie",
+ "pluginVersion": "7.4.0-pre",
+ "strokeWidth": "1",
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\"})
by (status)",
Review Comment:
These PromQL queries filter on the label key "kubeone_ali_appinstance_name",
which is not a label produced by Seata’s metrics exporter (the standard key is
"applicationId" per metrics IdConstants). As written, the dashboard won’t work
out-of-the-box unless the Prometheus scrape/relabeling injects this custom
label; consider switching to Seata’s built-in labels
(applicationId/group/role/status/...) or documenting the required relabeling.
```suggestion
"expr":
"sum(seata_transaction{applicationId=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\"})
by (status)",
```
##########
script/server/grafana/panel.json:
##########
@@ -0,0 +1,651 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 0,
+ "id": 707,
+ "links": [],
+ "liveNow": false,
+ "panels": [
+ {
+ "aliasColors": {},
+ "breakPoint": "50%",
+ "combine": {
+ "label": "Others",
+ "threshold": 0
+ },
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "palette-classic"
+ },
+ "custom": {
+ "hideFrom": {
+ "legend": false,
+ "tooltip": false,
+ "viz": false
+ }
+ },
+ "mappings": []
+ },
+ "overrides": []
+ },
+ "fontSize": "80%",
+ "format": "locale",
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "id": 2,
+ "legend": {
+ "header": "事务状态",
+ "percentage": false,
+ "show": true,
+ "sideWidth": 200,
+ "values": true
+ },
+ "legendType": "Right side",
+ "links": [],
+ "nullPointMode": "connected",
+ "options": {
+ "legend": {
+ "displayMode": "list",
+ "placement": "bottom",
+ "showLegend": true
+ },
+ "pieType": "pie",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "tooltip": {
+ "mode": "single",
+ "sort": "none"
+ }
+ },
+ "pieType": "pie",
+ "pluginVersion": "7.4.0-pre",
+ "strokeWidth": "1",
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\"})
by (status)",
Review Comment:
The "$pod" template variable is configured as multi-select + includeAll, but
the query uses an exact-match selector pod="$pod". For multi/all selections
Grafana expands the variable to a regex or $__all, so this selector can match
nothing. Use a regex matcher (pod=~"$pod") or make the variable single-select
without includeAll.
```suggestion
"expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=~\"$pod\"})
by (status)",
```
##########
script/server/grafana/panel.json:
##########
@@ -0,0 +1,651 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 0,
+ "id": 707,
+ "links": [],
+ "liveNow": false,
+ "panels": [
+ {
+ "aliasColors": {},
+ "breakPoint": "50%",
+ "combine": {
+ "label": "Others",
+ "threshold": 0
+ },
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "palette-classic"
+ },
+ "custom": {
+ "hideFrom": {
+ "legend": false,
+ "tooltip": false,
+ "viz": false
+ }
+ },
+ "mappings": []
+ },
+ "overrides": []
+ },
+ "fontSize": "80%",
+ "format": "locale",
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "id": 2,
+ "legend": {
+ "header": "事务状态",
+ "percentage": false,
+ "show": true,
+ "sideWidth": 200,
+ "values": true
+ },
+ "legendType": "Right side",
+ "links": [],
+ "nullPointMode": "connected",
+ "options": {
+ "legend": {
+ "displayMode": "list",
+ "placement": "bottom",
+ "showLegend": true
+ },
+ "pieType": "pie",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "tooltip": {
+ "mode": "single",
+ "sort": "none"
+ }
+ },
+ "pieType": "pie",
+ "pluginVersion": "7.4.0-pre",
+ "strokeWidth": "1",
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "title": "事务总量统计",
+ "type": "piechart",
+ "valueName": "current"
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 0
+ },
+ "hiddenSeries": false,
+ "id": 4,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"avg(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"timer\",statistic=\"average\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "事务耗时(含业务时间)",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:217",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:218",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 8
+ },
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"count\",status=~\"committed|rollbacked\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "正常事务统计",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:345",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:346",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 8
+ },
+ "hiddenSeries": false,
+ "id": 8,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"count\",status=~\"unretry|timeout\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "异常事务统计",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:434",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:435",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 16
+ },
+ "hiddenSeries": false,
+ "id": 10,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"tps\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "事务TPS(按状态)",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:524",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:525",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 16
+ },
+ "hiddenSeries": false,
+ "id": 12,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(rate(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\",status=~\"committed|rollbacked\"}[1m]))
by (kubeone_ali_appinstance_name)",
+ "interval": "",
+ "legendFormat": "{{kubeone_ali_appinstance_name}}{{pod}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "事务TPS(按容器)",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:613",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:614",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ }
+ ],
+ "refresh": "",
+ "schemaVersion": 38,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "list": [
+ {
+ "current": {
+ "isNone": true,
+ "selected": false,
+ "text": "None",
+ "value": ""
+ },
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
Review Comment:
The templating variables hardcode the Prometheus datasource UID
("hJ8_mPCnk"). If you switch to Grafana __inputs / a datasource placeholder for
portability, make sure to apply it to the templating datasources too (not just
panel datasources).
##########
script/server/grafana/panel.json:
##########
@@ -0,0 +1,651 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 0,
+ "id": 707,
+ "links": [],
+ "liveNow": false,
+ "panels": [
+ {
+ "aliasColors": {},
+ "breakPoint": "50%",
+ "combine": {
+ "label": "Others",
+ "threshold": 0
+ },
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "palette-classic"
+ },
+ "custom": {
+ "hideFrom": {
+ "legend": false,
+ "tooltip": false,
+ "viz": false
+ }
+ },
+ "mappings": []
+ },
+ "overrides": []
+ },
+ "fontSize": "80%",
+ "format": "locale",
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "id": 2,
+ "legend": {
+ "header": "事务状态",
+ "percentage": false,
+ "show": true,
+ "sideWidth": 200,
+ "values": true
+ },
+ "legendType": "Right side",
+ "links": [],
+ "nullPointMode": "connected",
+ "options": {
+ "legend": {
+ "displayMode": "list",
+ "placement": "bottom",
+ "showLegend": true
+ },
+ "pieType": "pie",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "tooltip": {
+ "mode": "single",
+ "sort": "none"
+ }
+ },
+ "pieType": "pie",
+ "pluginVersion": "7.4.0-pre",
+ "strokeWidth": "1",
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "title": "事务总量统计",
+ "type": "piechart",
+ "valueName": "current"
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 0
+ },
+ "hiddenSeries": false,
+ "id": 4,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"avg(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"timer\",statistic=\"average\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "事务耗时(含业务时间)",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:217",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:218",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 8
+ },
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"count\",status=~\"committed|rollbacked\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "正常事务统计",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:345",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:346",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 8
+ },
+ "hiddenSeries": false,
+ "id": 8,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"count\",status=~\"unretry|timeout\",pod=\"$pod\"})
by (status)",
Review Comment:
The "异常事务统计" query matches status=~"unretry|timeout", but Seata’s exported
transaction statuses are things like "failed" and "2phaseTimeout" (plus
retrying statuses), not "unretry"/"timeout". Update the status matcher to
reflect actual Seata metric label values so the panel returns data.
```suggestion
"expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"count\",status=~\"failed|2phaseTimeout|retrying\",pod=\"$pod\"})
by (status)",
```
##########
script/server/grafana/panel.json:
##########
@@ -0,0 +1,651 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 0,
+ "id": 707,
+ "links": [],
+ "liveNow": false,
+ "panels": [
+ {
+ "aliasColors": {},
+ "breakPoint": "50%",
+ "combine": {
+ "label": "Others",
+ "threshold": 0
+ },
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "palette-classic"
+ },
+ "custom": {
+ "hideFrom": {
+ "legend": false,
+ "tooltip": false,
+ "viz": false
+ }
+ },
+ "mappings": []
+ },
+ "overrides": []
+ },
+ "fontSize": "80%",
+ "format": "locale",
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "id": 2,
+ "legend": {
+ "header": "事务状态",
+ "percentage": false,
+ "show": true,
+ "sideWidth": 200,
+ "values": true
+ },
+ "legendType": "Right side",
+ "links": [],
+ "nullPointMode": "connected",
+ "options": {
+ "legend": {
+ "displayMode": "list",
+ "placement": "bottom",
+ "showLegend": true
+ },
+ "pieType": "pie",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "tooltip": {
+ "mode": "single",
+ "sort": "none"
+ }
+ },
+ "pieType": "pie",
+ "pluginVersion": "7.4.0-pre",
+ "strokeWidth": "1",
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "title": "事务总量统计",
+ "type": "piechart",
+ "valueName": "current"
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 0
+ },
+ "hiddenSeries": false,
+ "id": 4,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"avg(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"timer\",statistic=\"average\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "事务耗时(含业务时间)",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:217",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:218",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 8
+ },
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"count\",status=~\"committed|rollbacked\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "正常事务统计",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:345",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:346",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 8
+ },
+ "hiddenSeries": false,
+ "id": 8,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"count\",status=~\"unretry|timeout\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "异常事务统计",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:434",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:435",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 16
+ },
+ "hiddenSeries": false,
+ "id": 10,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"summary\",statistic=\"tps\",pod=\"$pod\"})
by (status)",
+ "interval": "",
+ "legendFormat": "{{status}}",
+ "queryType": "randomWalk",
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "事务TPS(按状态)",
+ "tooltip": {
+ "shared": true,
+ "sort": 0,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:524",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ },
+ {
+ "$$hashKey": "object:525",
+ "format": "short",
+ "logBase": 1,
+ "show": true
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "fill": 1,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 16
+ },
+ "hiddenSeries": false,
+ "id": 12,
+ "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": "10.0.9",
+ "pointradius": 2,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "hJ8_mPCnk"
+ },
+ "expr":
"sum(rate(seata_transaction{kubeone_ali_appinstance_name=\"$instance\",group=~\"$group\",meter=\"counter\",pod=\"$pod\",status=~\"committed|rollbacked\"}[1m]))
by (kubeone_ali_appinstance_name)",
+ "interval": "",
+ "legendFormat": "{{kubeone_ali_appinstance_name}}{{pod}}",
Review Comment:
This query aggregates `... by (kubeone_ali_appinstance_name)` but the legend
format includes `{{pod}}`. Since `pod` is not in the grouping labels, it will
be dropped from the output series and the legend will render empty/incorrect
for `pod`. Either include `pod` in the aggregation labels or remove it from the
legend template.
```suggestion
"legendFormat": "{{kubeone_ali_appinstance_name}}",
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]