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

checker: unify checker name and checker type #8316

Closed
wants to merge 23 commits into from

Conversation

okJiang
Copy link
Member

@okJiang okJiang commented Jun 21, 2024

What problem does this PR solve?

Issue Number: Ref #5845 Ref #8379

What is changed and how does it work?

* Use underscore format to represent a checker
* use dash format to represent a checker in monitoring

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

Release note

None.

Signed-off-by: okJiang <[email protected]>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 21, 2024
pkg/schedule/config/name.go Outdated Show resolved Hide resolved
Signed-off-by: okJiang <[email protected]>
@okJiang okJiang changed the title checker: unify checker name checker: unify checker name and checker type Jun 21, 2024
@@ -83,8 +83,8 @@ var scopes = [scopeLen]string{

"evict-leader-scheduler",
"region-scatter",
"replica-checker",
"rule-checker",
"replica_checker",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we unify the - and _?

Copy link
Member Author

@okJiang okJiang Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, scheduler will be unified in the next pr~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The monitor might also need to be changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the checker's monitor?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about that, maybe scheduler or maybe checker

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scheduler name has not been changed.

The checker monitor is no need to change, after I checked. They are all in the form of xxx_checker.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder

@okJiang
Copy link
Member Author

okJiang commented Jun 24, 2024

/cc @lhy1024

@ti-chi-bot ti-chi-bot bot requested a review from lhy1024 June 24, 2024 03:31
@@ -404,7 +403,7 @@ func (c *RuleChecker) allowLeader(fit *placement.RegionFit, peer *metapb.Peer) b
if s == nil {
return false
}
stateFilter := &filter.StoreStateFilter{ActionScope: "rule-checker", TransferLeader: true}
stateFilter := &filter.StoreStateFilter{ActionScope: "rule_checker", TransferLeader: true}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it affect the monitor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Scope is by group, so it will not affect the monitor. It will generate a new name after the new version goes live, but it won't have any actual impact.

image

Copy link
Member

@rleungx rleungx Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it become xxx_checker-store which mixes hyphen and underscore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. We want to use underscores in the code and hyphens for monitoring, right?

Waiting for confirmation~

Copy link
Member

@rleungx rleungx Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, it's better to use hyphens in the monitor.

@@ -108,7 +107,7 @@ func NewRuleChecker(ctx context.Context, cluster sche.CheckerCluster, ruleManage

// GetType returns RuleChecker's Type
func (*RuleChecker) GetType() string {
return ruleCheckerName
return config.RuleCheckerName.String()
Copy link
Member

@rleungx rleungx Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this PR, the type will be changed from xx-xx to xx_xx. It might affect the current monitor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 24, 2024
// IncOperatorLimitCounter increases the counter of operator meeting limit.
func IncOperatorLimitCounter(typ, name string) {
operatorLimitCounter.WithLabelValues(
strings.ReplaceAll(typ, "_", "-"), name).Inc()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible not to replace it every time?

Copy link
Member Author

@okJiang okJiang Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it for performance reasons? In that case, we still need to cache one more xxxx-xxxx for monitoring, which brings us back to the original issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using a map to do this?

Copy link
Member Author

@okJiang okJiang Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 26, 2024
Signed-off-by: okJiang <[email protected]>
@okJiang
Copy link
Member Author

okJiang commented Jun 28, 2024

/hold Need to be discuss

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 28, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 2, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign easonn7, husharp for approval, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 2, 2024
@ti-chi-bot ti-chi-bot bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 2, 2024
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
EvictLeaderName config.CheckerSchedulerName = "user-evict-leader-scheduler"
noStoreInSchedulerInfo = "No store in user-evict-leader-scheduler-config"
)
const noStoreInSchedulerInfo = "No store in user-evict-leader-scheduler-config"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to define a constant

@rleungx
Copy link
Member

rleungx commented Jul 3, 2024

BTW, this PR is too large to review. Is it possible to split them?

@okJiang
Copy link
Member Author

okJiang commented Jul 3, 2024

BTW, this PR is too large to review. Is it possible to split them?

After the ci pass, I will try it. But I still have to say, splitting is really tough😭 @rleungx

@okJiang okJiang marked this pull request as draft July 3, 2024 03:08
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 3, 2024
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Copy link

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 75.76471% with 103 lines in your changes missing coverage. Please review.

Project coverage is 77.16%. Comparing base (86f8030) to head (823efe8).
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8316      +/-   ##
==========================================
- Coverage   77.31%   77.16%   -0.15%     
==========================================
  Files         470      471       +1     
  Lines       61681    61688       +7     
==========================================
- Hits        47686    47600      -86     
- Misses      10405    10501      +96     
+ Partials     3590     3587       -3     
Flag Coverage Δ
unittests 77.16% <75.76%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Contributor

ti-chi-bot bot commented Jul 9, 2024

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456, multiple issues should use full syntax for each issue and be separated by a comma, like: Issue Number: close #123, ref #456.

📖 For more info, you can check the "Linking issues" section in the CONTRIBUTING.md.

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 12, 2024

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@okJiang okJiang closed this Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants