diff --git a/pkg/schedule/checker/checker_controller.go b/pkg/schedule/checker/checker_controller.go index 17bf36cc92f..1c0492abd9b 100644 --- a/pkg/schedule/checker/checker_controller.go +++ b/pkg/schedule/checker/checker_controller.go @@ -282,6 +282,8 @@ func (c *Controller) CheckRegion(region *core.RegionInfo) []*operator.Operator { } if c.mergeChecker != nil { + operator.DebugIncOperatorCounter("op", opController.OperatorCount(operator.OpMerge)) + operator.DebugIncOperatorCounter("limit", c.conf.GetMergeScheduleLimit()) allowed := opController.OperatorCount(operator.OpMerge) < c.conf.GetMergeScheduleLimit() if !allowed { operator.IncOperatorLimitCounter(c.mergeChecker.GetType(), operator.OpMerge) diff --git a/pkg/schedule/operator/metrics.go b/pkg/schedule/operator/metrics.go index 47a165500e9..ac3a9e3675d 100644 --- a/pkg/schedule/operator/metrics.go +++ b/pkg/schedule/operator/metrics.go @@ -80,6 +80,13 @@ var ( Help: "Bucketed histogram of the operator region size.", Buckets: prometheus.ExponentialBuckets(1, 2, 20), // 1MB~1TB }, []string{"type"}) + debugOperatorCounter = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: "pd", + Subsystem: "schedule", + Name: "debug_operator_count", + Help: "Counter of debug schedule operators.", + }, []string{"type"}) ) func init() { @@ -90,9 +97,15 @@ func init() { prometheus.MustRegister(operatorDuration) prometheus.MustRegister(operatorSizeHist) prometheus.MustRegister(storeLimitCostCounter) + prometheus.MustRegister(debugOperatorCounter) } // IncOperatorLimitCounter increases the counter of operator meeting limit. func IncOperatorLimitCounter(typ types.CheckerSchedulerType, kind OpKind) { operatorLimitCounter.WithLabelValues(typ.String(), kind.String()).Inc() } + +// DebugIncOperatorCounter increases the counter of debug schedule operators. +func DebugIncOperatorCounter(typ string, num uint64) { + debugOperatorCounter.WithLabelValues(typ).Set(float64(num)) +}