diff --git a/metrics/grafana/ticdc_new_arch.json b/metrics/grafana/ticdc_new_arch.json index d2bf3084d9..7c438dbf07 100644 --- a/metrics/grafana/ticdc_new_arch.json +++ b/metrics/grafana/ticdc_new_arch.json @@ -27296,7 +27296,7 @@ ] }, "timezone": "browser", - "title": "test-cluster-TiCDC-New-Arch", + "title": "${DS_TEST-CLUSTER}-TiCDC-New-Arch", "uid": "YiGL8hBZ0aac", "version": 40 } diff --git a/metrics/nextgengrafana/ticdc_new_arch_next_gen.json b/metrics/nextgengrafana/ticdc_new_arch_next_gen.json index 826a7987e8..b89adf1f76 100644 --- a/metrics/nextgengrafana/ticdc_new_arch_next_gen.json +++ b/metrics/nextgengrafana/ticdc_new_arch_next_gen.json @@ -27296,7 +27296,7 @@ ] }, "timezone": "browser", - "title": "test-cluster-TiCDC-New-Arch", + "title": "${DS_TEST-CLUSTER}-TiCDC-New-Arch", "uid": "YiGL8hBZ0aac", "version": 40 } diff --git a/metrics/nextgengrafana/ticdc_new_arch_with_keyspace_name.json b/metrics/nextgengrafana/ticdc_new_arch_with_keyspace_name.json index a5d5fde2e1..e1881dffce 100644 --- a/metrics/nextgengrafana/ticdc_new_arch_with_keyspace_name.json +++ b/metrics/nextgengrafana/ticdc_new_arch_with_keyspace_name.json @@ -11488,7 +11488,7 @@ ] }, "timezone": "browser", - "title": "test-cluster-TiCDC-New-Arch", + "title": "${DS_TEST-CLUSTER}-TiCDC-New-Arch-KeyspaceName", "uid": "lGT5hED6vqTn", "version": 40 } diff --git a/scripts/generate-next-gen-metrics.sh b/scripts/generate-next-gen-metrics.sh index 770d30a501..f12eef3007 100755 --- a/scripts/generate-next-gen-metrics.sh +++ b/scripts/generate-next-gen-metrics.sh @@ -41,6 +41,16 @@ if [ ! -f "$NEXT_GEN_SHARED_FILE" ]; then exit 1 fi +require_file_contains() { + local file="$1" + local expected="$2" + + if ! grep -Fq -- "$expected" "$file"; then + echo "Error: Generated file '$file' must contain '$expected'" >&2 + exit 1 + fi +} + # This jq script filters the panels in the Grafana dashboard. # It defines a recursive function `filter_panels` that: # 1. For panels of type "row", it recursively filters their sub-panels. @@ -64,9 +74,11 @@ jq ' "$SED_CMD" "${SED_INPLACE_ARGS[@]}" "s/\${DS_TEST-CLUSTER}-TiCDC-New-Arch/&-KeyspaceName/" "$NEXT_GEN_USER_FILE" "$SED_CMD" "${SED_INPLACE_ARGS[@]}" "s/YiGL8hBZ0aac/lGT5hED6vqTn/" "$NEXT_GEN_USER_FILE" +require_file_contains "$NEXT_GEN_USER_FILE" "-KeyspaceName" echo "Userscope dashboard created at '$NEXT_GEN_USER_FILE'" "$SED_CMD" "${SED_INPLACE_ARGS[@]}" 's/\([^$]\)tidb_cluster/\1sharedpool_id/g' "$NEXT_GEN_SHARED_FILE" +require_file_contains "$NEXT_GEN_SHARED_FILE" "sharedpool_id" echo "Sharedscope dashboard created at '$NEXT_GEN_SHARED_FILE'"