Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scheduler: add scheduler type and move metrics file #8393

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions pkg/schedule/schedulers/balance_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ const (
transferOut = "transfer-out"
)

var (
// WithLabelValues is a heavy operation, define variable to avoid call it every time.
balanceLeaderScheduleCounter = schedulerCounter.WithLabelValues(BalanceLeaderName, "schedule")
balanceLeaderNoLeaderRegionCounter = schedulerCounter.WithLabelValues(BalanceLeaderName, "no-leader-region")
balanceLeaderRegionHotCounter = schedulerCounter.WithLabelValues(BalanceLeaderName, "region-hot")
balanceLeaderNoTargetStoreCounter = schedulerCounter.WithLabelValues(BalanceLeaderName, "no-target-store")
balanceLeaderNoFollowerRegionCounter = schedulerCounter.WithLabelValues(BalanceLeaderName, "no-follower-region")
balanceLeaderSkipCounter = schedulerCounter.WithLabelValues(BalanceLeaderName, "skip")
balanceLeaderNewOpCounter = schedulerCounter.WithLabelValues(BalanceLeaderName, "new-operator")
)

type balanceLeaderSchedulerConfig struct {
syncutil.RWMutex
storage endpoint.ConfigStorage
Expand Down
12 changes: 0 additions & 12 deletions pkg/schedule/schedulers/balance_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ const (
BalanceRegionType = "balance-region"
)

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

type balanceRegionSchedulerConfig struct {
Name string `json:"name"`
Ranges []core.KeyRange `json:"ranges"`
Expand Down
9 changes: 0 additions & 9 deletions pkg/schedule/schedulers/evict_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ const (
lastStoreDeleteInfo = "The last store has been deleted"
)

var (
// WithLabelValues is a heavy operation, define variable to avoid call it every time.
evictLeaderCounter = schedulerCounter.WithLabelValues(EvictLeaderName, "schedule")
evictLeaderNoLeaderCounter = schedulerCounter.WithLabelValues(EvictLeaderName, "no-leader")
evictLeaderPickUnhealthyCounter = schedulerCounter.WithLabelValues(EvictLeaderName, "pick-unhealthy-region")
evictLeaderNoTargetStoreCounter = schedulerCounter.WithLabelValues(EvictLeaderName, "no-target-store")
evictLeaderNewOperatorCounter = schedulerCounter.WithLabelValues(EvictLeaderName, "new-operator")
)

type evictLeaderSchedulerConfig struct {
syncutil.RWMutex
storage endpoint.ConfigStorage
Expand Down
3 changes: 0 additions & 3 deletions pkg/schedule/schedulers/evict_slow_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ const (
slowStoreRecoverThreshold = 1
)

// WithLabelValues is a heavy operation, define variable to avoid call it every time.
var evictSlowStoreCounter = schedulerCounter.WithLabelValues(EvictSlowStoreName, "schedule")

type evictSlowStoreSchedulerConfig struct {
syncutil.RWMutex
cluster *core.BasicCluster
Expand Down
6 changes: 0 additions & 6 deletions pkg/schedule/schedulers/grant_hot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ const (
GrantHotRegionType = "grant-hot-region"
)

var (
// WithLabelValues is a heavy operation, define variable to avoid call it every time.
grantHotRegionCounter = schedulerCounter.WithLabelValues(GrantHotRegionName, "schedule")
grantHotRegionSkipCounter = schedulerCounter.WithLabelValues(GrantHotRegionName, "skip")
)

type grantHotRegionSchedulerConfig struct {
syncutil.RWMutex
storage endpoint.ConfigStorage
Expand Down
7 changes: 0 additions & 7 deletions pkg/schedule/schedulers/grant_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ const (
GrantLeaderType = "grant-leader"
)

var (
// WithLabelValues is a heavy operation, define variable to avoid call it every time.
grantLeaderCounter = schedulerCounter.WithLabelValues(GrantLeaderName, "schedule")
grantLeaderNoFollowerCounter = schedulerCounter.WithLabelValues(GrantLeaderName, "no-follower")
grantLeaderNewOperatorCounter = schedulerCounter.WithLabelValues(GrantLeaderName, "new-operator")
)

type grantLeaderSchedulerConfig struct {
syncutil.RWMutex
storage endpoint.ConfigStorage
Expand Down
38 changes: 0 additions & 38 deletions pkg/schedule/schedulers/hot_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,44 +71,6 @@ var (
statisticsInterval = time.Second
)

var (
// WithLabelValues is a heavy operation, define variable to avoid call it every time.
hotSchedulerCounter = schedulerCounter.WithLabelValues(HotRegionName, "schedule")
hotSchedulerSkipCounter = schedulerCounter.WithLabelValues(HotRegionName, "skip")
hotSchedulerSearchRevertRegionsCounter = schedulerCounter.WithLabelValues(HotRegionName, "search_revert_regions")
hotSchedulerNotSameEngineCounter = schedulerCounter.WithLabelValues(HotRegionName, "not_same_engine")
hotSchedulerNoRegionCounter = schedulerCounter.WithLabelValues(HotRegionName, "no_region")
hotSchedulerUnhealthyReplicaCounter = schedulerCounter.WithLabelValues(HotRegionName, "unhealthy_replica")
hotSchedulerAbnormalReplicaCounter = schedulerCounter.WithLabelValues(HotRegionName, "abnormal_replica")
hotSchedulerCreateOperatorFailedCounter = schedulerCounter.WithLabelValues(HotRegionName, "create_operator_failed")
hotSchedulerNewOperatorCounter = schedulerCounter.WithLabelValues(HotRegionName, "new_operator")
hotSchedulerSnapshotSenderLimitCounter = schedulerCounter.WithLabelValues(HotRegionName, "snapshot_sender_limit")

// counter related with the split region
hotSchedulerNotFoundSplitKeysCounter = schedulerCounter.WithLabelValues(HotRegionName, "not_found_split_keys")
hotSchedulerRegionBucketsNotHotCounter = schedulerCounter.WithLabelValues(HotRegionName, "region_buckets_not_hot")
hotSchedulerOnlyOneBucketsHotCounter = schedulerCounter.WithLabelValues(HotRegionName, "only_one_buckets_hot")
hotSchedulerHotBucketNotValidCounter = schedulerCounter.WithLabelValues(HotRegionName, "hot_buckets_not_valid")
hotSchedulerRegionBucketsSingleHotSpotCounter = schedulerCounter.WithLabelValues(HotRegionName, "region_buckets_single_hot_spot")
hotSchedulerSplitSuccessCounter = schedulerCounter.WithLabelValues(HotRegionName, "split_success")
hotSchedulerNeedSplitBeforeScheduleCounter = schedulerCounter.WithLabelValues(HotRegionName, "need_split_before_move_peer")
hotSchedulerRegionTooHotNeedSplitCounter = schedulerCounter.WithLabelValues(HotRegionName, "region_is_too_hot_need_split")

hotSchedulerMoveLeaderCounter = schedulerCounter.WithLabelValues(HotRegionName, moveLeader.String())
hotSchedulerMovePeerCounter = schedulerCounter.WithLabelValues(HotRegionName, movePeer.String())
hotSchedulerTransferLeaderCounter = schedulerCounter.WithLabelValues(HotRegionName, transferLeader.String())

readSkipAllDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "read-skip-all-dim-uniform-store")
writeSkipAllDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "write-skip-all-dim-uniform-store")
readSkipByteDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "read-skip-byte-uniform-store")
writeSkipByteDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "write-skip-byte-uniform-store")
readSkipKeyDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "read-skip-key-uniform-store")
writeSkipKeyDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "write-skip-key-uniform-store")
readSkipQueryDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "read-skip-query-uniform-store")
writeSkipQueryDimUniformStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "write-skip-query-uniform-store")
pendingOpFailsStoreCounter = schedulerCounter.WithLabelValues(HotRegionName, "pending-op-fails")
)

type baseHotScheduler struct {
*BaseScheduler
// stLoadInfos contain store statistics information by resource type.
Expand Down
9 changes: 0 additions & 9 deletions pkg/schedule/schedulers/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ const (
LabelType = "label"
)

var (
// WithLabelValues is a heavy operation, define variable to avoid call it every time.
labelCounter = schedulerCounter.WithLabelValues(LabelName, "schedule")
labelNewOperatorCounter = schedulerCounter.WithLabelValues(LabelName, "new-operator")
labelNoTargetCounter = schedulerCounter.WithLabelValues(LabelName, "no-target")
labelSkipCounter = schedulerCounter.WithLabelValues(LabelName, "skip")
labelNoRegionCounter = schedulerCounter.WithLabelValues(LabelName, "no-region")
)

type labelSchedulerConfig struct {
Name string `json:"name"`
Ranges []core.KeyRange `json:"ranges"`
Expand Down
Loading