Skip to content

Commit

Permalink
fix metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Sep 21, 2023
1 parent 6376783 commit 074797e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
24 changes: 16 additions & 8 deletions metrics/grafana/pd.json
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@
"tableColumn": "idalloc",
"targets": [
{
"expr": "pd_cluster_id{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", type=\"idalloc\"}",
"expr": "max(pd_cluster_id{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", type=\"idalloc\"})",
"format": "time_series",
"hide": false,
"instant": true,
Expand Down Expand Up @@ -2202,7 +2202,7 @@
"tableColumn": "tso",
"targets": [
{
"expr": "pd_cluster_tso{type=\"tso\", dc=\"global\"}",
"expr": "max(pd_cluster_tso{type=\"tso\", dc=\"global\"})",
"format": "time_series",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -2508,7 +2508,7 @@
"tableColumn": "tso",
"targets": [
{
"expr": "pd_cluster_tso{type=\"tso\", dc=\"global\"}",
"expr": "max(pd_cluster_tso{type=\"tso\", dc=\"global\"})",
"format": "time_series",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -7814,7 +7814,7 @@
"tableColumn": "",
"targets": [
{
"expr": "pd_checker_patrol_regions_time{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"}",
"expr": "pd_checker_patrol_regions_time{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\"} != 0",
"format": "time_series",
"intervalFactor": 1,
"refId": "A"
Expand Down Expand Up @@ -9105,7 +9105,9 @@
"show": true,
"sideWidth": 300,
"total": false,
"values": true
"values": true,
"hideEmpty": true,
"hideZero": true
},
"lines": true,
"linewidth": 1,
Expand Down Expand Up @@ -9200,7 +9202,9 @@
"show": true,
"sideWidth": 300,
"total": false,
"values": true
"values": true,
"hideEmpty": true,
"hideZero": true
},
"lines": true,
"linewidth": 1,
Expand Down Expand Up @@ -9526,7 +9530,9 @@
"rightSide": true,
"show": true,
"total": false,
"values": true
"values": true,
"hideEmpty": true,
"hideZero": true
},
"lines": true,
"linewidth": 1,
Expand Down Expand Up @@ -9723,7 +9729,9 @@
"rightSide": true,
"show": true,
"total": false,
"values": true
"values": true,
"hideEmpty": true,
"hideZero": true
},
"lines": true,
"linewidth": 1,
Expand Down
6 changes: 0 additions & 6 deletions pkg/mcs/scheduling/server/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/kvproto/pkg/schedulingpb"
"github.com/pingcap/log"
Expand Down Expand Up @@ -400,11 +399,6 @@ func (c *Cluster) runMetricsCollectionJob() {
defer c.wg.Done()

ticker := time.NewTicker(10 * time.Second)
failpoint.Inject("highFrequencyClusterJobs", func() {
ticker.Stop()
ticker = time.NewTicker(time.Microsecond)
})

defer ticker.Stop()

for {
Expand Down
1 change: 1 addition & 0 deletions pkg/schedule/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (c *Coordinator) PatrolRegions() {
// Note: we reset the ticker here to support updating configuration dynamically.
ticker.Reset(c.cluster.GetCheckerConfig().GetPatrolRegionInterval())
case <-c.ctx.Done():
patrolCheckRegionsGauge.Set(0)
log.Info("patrol regions has been stopped")
return
}
Expand Down

0 comments on commit 074797e

Please sign in to comment.