Skip to content

Commit

Permalink
metrics: fix dr-auto-sync metics (#7975)
Browse files Browse the repository at this point in the history
close #7974

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
lhy1024 and ti-chi-bot[bot] authored Mar 26, 2024
1 parent 39108f7 commit 29a4a2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions metrics/grafana/pd.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -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": "",
Expand Down Expand Up @@ -13081,7 +13081,7 @@
"id": 1601,
"options": {
"colorMode": "value",
"graphMode": "area",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
Expand All @@ -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}}",
Expand Down Expand Up @@ -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}}",
Expand Down
5 changes: 4 additions & 1 deletion pkg/replication/replication_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 29a4a2a

Please sign in to comment.