Skip to content

Commit

Permalink
metrics for balance region
Browse files Browse the repository at this point in the history
Signed-off-by: bufferflies <1045931706@qq.com>
  • Loading branch information
bufferflies committed Aug 21, 2023
1 parent 346e771 commit 54c0112
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions metrics/grafana/pd.json
Original file line number Diff line number Diff line change
Expand Up @@ -7403,20 +7403,20 @@
"steppedLine": false,
"targets": [
{
"expr": "sum(rate(pd_scheduler_event_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=\"$instance\", type=\"balance-region-scheduler\"}[5m])) by (name)",
"expr": "sum(rate(pd_scheduler_balance_region{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=\"$instance\"}[5m])) by (type)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{name}}",
"metric": "pd_scheduler_event_count",
"metric": "pd_scheduler_balance_region",
"refId": "A",
"step": 4
},
{
"expr": "sum(rate(pd_scheduler_event_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=\"$instance\", type=\"balance-region-scheduler\"}[5m]))",
"expr": "sum(rate(pd_scheduler_event_count{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=\"$instance\"}[5m]))",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "total",
"metric": "pd_scheduler_event_count",
"metric": "pd_scheduler_balance_region",
"refId": "B",
"step": 4
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/schedule/schedulers/balance_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ const (

var (
// WithLabelValues is a heavy operation, define variable to avoid call it every time.
balanceRegionScheduleCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "schedule")
balanceRegionNoRegionCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "no-region")
balanceRegionHotCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "region-hot")
balanceRegionNoLeaderCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "no-leader")
balanceRegionNewOpCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "new-operator")
balanceRegionSkipCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "skip")
balanceRegionCreateOpFailCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "create-operator-fail")
balanceRegionNoReplacementCounter = balanceRegionCounter.WithLabelValues(BalanceRegionName, "no-replacement")
balanceRegionScheduleCounter = balanceRegionCounter.WithLabelValues("schedule")
balanceRegionNoRegionCounter = balanceRegionCounter.WithLabelValues("no-region")
balanceRegionHotCounter = balanceRegionCounter.WithLabelValues("region-hot")
balanceRegionNoLeaderCounter = balanceRegionCounter.WithLabelValues("no-leader")
balanceRegionNewOpCounter = balanceRegionCounter.WithLabelValues("new-operator")
balanceRegionSkipCounter = balanceRegionCounter.WithLabelValues("skip")
balanceRegionCreateOpFailCounter = balanceRegionCounter.WithLabelValues("create-operator-fail")
balanceRegionNoReplacementCounter = balanceRegionCounter.WithLabelValues("no-replacement")
)

type balanceRegionSchedulerConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule/schedulers/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var (
Subsystem: "scheduler",
Name: "balance_region",
Help: "Counter of balance region scheduler.",
}, []string{"type", "store"})
}, []string{"type"})

// TODO: pre-allocate gauge metrics
hotSchedulerResultCounter = prometheus.NewCounterVec(
Expand Down

0 comments on commit 54c0112

Please sign in to comment.