Skip to content

Commit 0a418b4

Browse files
authored
metrics,scripts: keep TiCDC dashboard titles consistent (pingcap#4765)
close pingcap#4764
1 parent 567506c commit 0a418b4

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

metrics/grafana/ticdc_new_arch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27296,7 +27296,7 @@
2729627296
]
2729727297
},
2729827298
"timezone": "browser",
27299-
"title": "test-cluster-TiCDC-New-Arch",
27299+
"title": "${DS_TEST-CLUSTER}-TiCDC-New-Arch",
2730027300
"uid": "YiGL8hBZ0aac",
2730127301
"version": 40
2730227302
}

metrics/nextgengrafana/ticdc_new_arch_next_gen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27296,7 +27296,7 @@
2729627296
]
2729727297
},
2729827298
"timezone": "browser",
27299-
"title": "test-cluster-TiCDC-New-Arch",
27299+
"title": "${DS_TEST-CLUSTER}-TiCDC-New-Arch",
2730027300
"uid": "YiGL8hBZ0aac",
2730127301
"version": 40
2730227302
}

metrics/nextgengrafana/ticdc_new_arch_with_keyspace_name.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11488,7 +11488,7 @@
1148811488
]
1148911489
},
1149011490
"timezone": "browser",
11491-
"title": "test-cluster-TiCDC-New-Arch",
11491+
"title": "${DS_TEST-CLUSTER}-TiCDC-New-Arch-KeyspaceName",
1149211492
"uid": "lGT5hED6vqTn",
1149311493
"version": 40
1149411494
}

scripts/generate-next-gen-metrics.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ if [ ! -f "$NEXT_GEN_SHARED_FILE" ]; then
4141
exit 1
4242
fi
4343

44+
require_file_contains() {
45+
local file="$1"
46+
local expected="$2"
47+
48+
if ! grep -Fq -- "$expected" "$file"; then
49+
echo "Error: Generated file '$file' must contain '$expected'" >&2
50+
exit 1
51+
fi
52+
}
53+
4454
# This jq script filters the panels in the Grafana dashboard.
4555
# It defines a recursive function `filter_panels` that:
4656
# 1. For panels of type "row", it recursively filters their sub-panels.
@@ -64,9 +74,11 @@ jq '
6474

6575
"$SED_CMD" "${SED_INPLACE_ARGS[@]}" "s/\${DS_TEST-CLUSTER}-TiCDC-New-Arch/&-KeyspaceName/" "$NEXT_GEN_USER_FILE"
6676
"$SED_CMD" "${SED_INPLACE_ARGS[@]}" "s/YiGL8hBZ0aac/lGT5hED6vqTn/" "$NEXT_GEN_USER_FILE"
77+
require_file_contains "$NEXT_GEN_USER_FILE" "-KeyspaceName"
6778

6879
echo "Userscope dashboard created at '$NEXT_GEN_USER_FILE'"
6980

7081
"$SED_CMD" "${SED_INPLACE_ARGS[@]}" 's/\([^$]\)tidb_cluster/\1sharedpool_id/g' "$NEXT_GEN_SHARED_FILE"
82+
require_file_contains "$NEXT_GEN_SHARED_FILE" "sharedpool_id"
7183

7284
echo "Sharedscope dashboard created at '$NEXT_GEN_SHARED_FILE'"

0 commit comments

Comments
 (0)