diff --git a/metrics/grafana/pd.json b/metrics/grafana/pd.json index 30014a959dc..89f2828757f 100644 --- a/metrics/grafana/pd.json +++ b/metrics/grafana/pd.json @@ -1738,7 +1738,7 @@ "tableColumn": "idalloc", "targets": [ { - "expr": "pd_cluster_id{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", type=\"idalloc\"}!=0", + "expr": "max(pd_cluster_id{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", type=\"idalloc\"})by(type)", "format": "time_series", "hide": false, "instant": true, @@ -2284,7 +2284,7 @@ "tableColumn": "tso", "targets": [ { - "expr": "pd_cluster_tso{type=\"tso\", dc=\"global\"}!=0", + "expr": "max(pd_cluster_tso{type=\"tso\", dc=\"global\"})by(type)", "format": "time_series", "instant": true, "interval": "", @@ -2588,7 +2588,7 @@ "tableColumn": "tso", "targets": [ { - "expr": "pd_cluster_tso{type=\"tso\", dc=\"global\"}!=0", + "expr": "max(pd_cluster_tso{type=\"tso\", dc=\"global\"})by(type)", "format": "time_series", "instant": true, "interval": "", @@ -13081,7 +13081,7 @@ "id": 1601, "options": { "colorMode": "value", - "graphMode": "area", + "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { @@ -13098,7 +13098,7 @@ "targets": [ { "exemplar": true, - "expr": "pd_replication_dr_state{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=\"$instance\"}", + "expr": "max(pd_replication_dr_state{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"})", "instant": false, "interval": "", "legendFormat": "{{instance}}", @@ -13266,7 +13266,7 @@ "targets": [ { "exemplar": true, - "expr": "rate(pd_replication_dr_tick_total{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=\"$instance\"}[5m])", + "expr": "rate(pd_replication_dr_tick_total{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}[5m])", "instant": false, "interval": "", "legendFormat": "{{instance}}", diff --git a/pkg/replication/replication_mode.go b/pkg/replication/replication_mode.go index 9776a36a8f3..5f6b212529b 100644 --- a/pkg/replication/replication_mode.go +++ b/pkg/replication/replication_mode.go @@ -366,7 +366,10 @@ func (m *ModeManager) Run(ctx context.Context) { }() go func() { - defer wg.Done() + defer func() { + wg.Done() + drStateGauge.Set(0) + }() ticker := time.NewTicker(replicateStateInterval) defer ticker.Stop() for {