Skip to content

Commit

Permalink
add metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Zheng Xiangsheng <[email protected]>
  • Loading branch information
HunDunDM committed Sep 16, 2020
1 parent 92d1cee commit 5cf9643
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/schedule/checker/joint_state_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,21 @@ func NewJointStateChecker(cluster opt.Cluster) *JointStateChecker {

// Check verifies a region's role, creating an Operator if need.
func (c *JointStateChecker) Check(region *core.RegionInfo) *operator.Operator {
checkerCounter.WithLabelValues("joint_state_checker", "check").Inc()
if !core.IsInJointState(region.GetPeers()...) {
return nil
}
op, err := operator.CreateLeaveJointStateOperator("leave-joint-state", c.cluster, region)
if err != nil {
checkerCounter.WithLabelValues("joint_state_checker", "create-operator-fail").Inc()
log.Debug("fail to create leave joint state operator", zap.Error(err))
return nil
} else if op != nil {
checkerCounter.WithLabelValues("joint_state_checker", "new-operator").Inc()
if op.Len() > 1 {
checkerCounter.WithLabelValues("joint_state_checker", "transfer-leader").Inc()
}
op.SetPriorityLevel(core.HighPriority)
}
op.SetPriorityLevel(core.HighPriority)
return op
}

0 comments on commit 5cf9643

Please sign in to comment.