Skip to content

Commit

Permalink
This is an automated cherry-pick of #8124
Browse files Browse the repository at this point in the history
close #8125

Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
HuSharp authored and ti-chi-bot committed Apr 26, 2024
1 parent c325311 commit 1937a9e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/schedule/filter/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func NewCounter(scope string) *Counter {
return &Counter{counter: counter, scope: scope}
}

func (c *Counter) SetScope(scope string) {
c.scope = scope
}

// Add adds the filter counter.
func (c *Counter) inc(action action, filterType filterType, sourceID uint64, targetID uint64) {
if _, ok := c.counter[action][filterType][sourceID]; !ok {
Expand Down
7 changes: 7 additions & 0 deletions pkg/schedule/schedulers/balance_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,17 @@ func (l *balanceLeaderScheduler) ServeHTTP(w http.ResponseWriter, r *http.Reques
// BalanceLeaderCreateOption is used to create a scheduler with an option.
type BalanceLeaderCreateOption func(s *balanceLeaderScheduler)

<<<<<<< HEAD

Check failure on line 201 in pkg/schedule/schedulers/balance_leader.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: non-declaration statement outside function body
// WithBalanceLeaderCounter sets the counter for the scheduler.
func WithBalanceLeaderCounter(counter *prometheus.CounterVec) BalanceLeaderCreateOption {
return func(s *balanceLeaderScheduler) {
s.counter = counter
=======

Check failure on line 206 in pkg/schedule/schedulers/balance_leader.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected ==, expected }
// WithBalanceLeaderFilterCounterName sets the filter counter name for the scheduler.
func WithBalanceLeaderFilterCounterName(name string) BalanceLeaderCreateOption {

Check failure on line 208 in pkg/schedule/schedulers/balance_leader.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected ) at end of statement
return func(s *balanceLeaderScheduler) {
s.filterCounter.SetScope(name)
>>>>>>> 50c80407c (scheduler: fix scatter counter name (#8124))

Check failure on line 211 in pkg/schedule/schedulers/balance_leader.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected >>, expected }

Check failure on line 211 in pkg/schedule/schedulers/balance_leader.go

View workflow job for this annotation

GitHub Actions / tso-function-test

invalid character U+0023 '#'
}
}

Check failure on line 213 in pkg/schedule/schedulers/balance_leader.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: non-declaration statement outside function body

Expand Down
7 changes: 7 additions & 0 deletions pkg/schedule/schedulers/balance_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ func WithBalanceRegionName(name string) BalanceRegionCreateOption {
}
}

// WithBalanceRegionFilterCounterName sets the filter counter name for the scheduler.
func WithBalanceRegionFilterCounterName(name string) BalanceRegionCreateOption {
return func(s *balanceRegionScheduler) {
s.filterCounter.SetScope(name)
}
}

func (s *balanceRegionScheduler) GetName() string {
return s.conf.Name
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/schedule/schedulers/scatter_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,21 @@ func newScatterRangeScheduler(opController *schedule.OperatorController, config
opController,
&balanceLeaderSchedulerConfig{Ranges: []core.KeyRange{core.NewKeyRange("", "")}},
WithBalanceLeaderName("scatter-range-leader"),
<<<<<<< HEAD

Check failure on line 141 in pkg/schedule/schedulers/scatter_range.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected <<, expected expression
WithBalanceLeaderCounter(scatterRangeLeaderCounter),
=======

Check failure on line 143 in pkg/schedule/schedulers/scatter_range.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected ==, expected expression
WithBalanceLeaderFilterCounterName("scatter-range-leader"),

Check failure on line 144 in pkg/schedule/schedulers/scatter_range.go

View workflow job for this annotation

GitHub Actions / tso-function-test

syntax error: unexpected ) in composite literal; possibly missing comma or }
>>>>>>> 50c80407c (scheduler: fix scatter counter name (#8124))

Check failure on line 145 in pkg/schedule/schedulers/scatter_range.go

View workflow job for this annotation

GitHub Actions / tso-function-test

invalid character U+0023 '#'
),
balanceRegion: newBalanceRegionScheduler(
opController,
&balanceRegionSchedulerConfig{Ranges: []core.KeyRange{core.NewKeyRange("", "")}},
WithBalanceRegionName("scatter-range-region"),
<<<<<<< HEAD
WithBalanceRegionCounter(scatterRangeRegionCounter),
=======
WithBalanceRegionFilterCounterName("scatter-range-region"),
>>>>>>> 50c80407c (scheduler: fix scatter counter name (#8124))
),
}
return scheduler
Expand Down

0 comments on commit 1937a9e

Please sign in to comment.