Skip to content

Commit cf003bb

Browse files
authored
metrics: fix bug that the target is wrong (#5647)
close #5646 Signed-off-by: bufferflies <1045931706@qq.com>
1 parent 8501508 commit cf003bb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

metrics/grafana/pd.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -7736,10 +7736,10 @@
77367736
"steppedLine": false,
77377737
"targets": [
77387738
{
7739-
"expr": "sum(delta(pd_schedule_filter{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", store=~\"$store\", action=\"filter-source\"}[1m])) by (store, type, scope)",
7739+
"expr": "sum(delta(pd_schedule_filter{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", store=~\"$store\", action=\"filter-source\"}[1m])) by (source, type, scope)",
77407740
"format": "time_series",
77417741
"intervalFactor": 2,
7742-
"legendFormat": "{{scope}}-store-{{store}}-{{type}}",
7742+
"legendFormat": "{{scope}}-store-{{source}}-{{type}}",
77437743
"metric": "pd_scheduler_event_count",
77447744
"refId": "A",
77457745
"step": 4
@@ -7832,10 +7832,10 @@
78327832
"steppedLine": false,
78337833
"targets": [
78347834
{
7835-
"expr": "sum(delta(pd_schedule_filter{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", store=~\"$store\", action=\"filter-target\"}[1m])) by (store, type, scope)",
7835+
"expr": "sum(delta(pd_schedule_filter{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", store=~\"$store\", action=\"filter-target\"}[1m])) by (target, type, scope)",
78367836
"format": "time_series",
78377837
"intervalFactor": 2,
7838-
"legendFormat": "{{scope}}-store-{{store}}-{{type}}",
7838+
"legendFormat": "{{scope}}-store-{{target}}-{{type}}",
78397839
"metric": "pd_scheduler_event_count",
78407840
"refId": "A",
78417841
"step": 4

server/schedule/filter/counter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (c *Counter) Flush() {
200200
for sourceID, count := range counters {
201201
sourceIDStr := strconv.FormatUint(sourceID, 10)
202202
for targetID, value := range count {
203-
targetIDStr := strconv.FormatUint(sourceID, 10)
203+
targetIDStr := strconv.FormatUint(targetID, 10)
204204
if value > 0 {
205205
filterCounter.WithLabelValues(actionName, c.scope, filterName, sourceIDStr, targetIDStr).
206206
Add(float64(value))

0 commit comments

Comments
 (0)