-
Notifications
You must be signed in to change notification settings - Fork 543
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
Add validation.RateLimited and TooManyHAClusters to errors catalogue #2009
Conversation
0fae871
to
fb00149
Compare
fc6fc62
to
9501ea2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! The direction is good. I left few comments. Looking forward for the runbooks. Thanks!
pkg/util/globalerror/errors.go
Outdated
@@ -57,3 +60,7 @@ func (id ID) Message(msg string) string { | |||
func (id ID) MessageWithLimitConfig(flag, msg string) string { | |||
return fmt.Sprintf("%s (%s%s). You can adjust the related per-tenant limit by configuring -%s, or by contacting your service administrator.", msg, errPrefix, id, flag) | |||
} | |||
|
|||
func (id ID) MessageWith2LimitConfig(flag, flag2, msg string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of "With2" version. A cleaner alternative, from the caller perspective, may be reversing MessageWithLimitConfig()
arguments order and making flags a variable argument, like this:
func (id ID) MessageWithLimitConfig(msg string, flags ...string) string {
Then, you could dynamically generate the error message to include all flags
.
I would do this change in a separate PR, to keep the change isolated from this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the With2 to what you suggested, but kept flag as a separate string to ensure there's a compile error if there isn't at least 1 flag. After this is merged, I can open a separate PR to change all previous uses of the old one to use the new one and then remove the old one. Is this okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new function version LGTM!
I can open a separate PR to change all previous uses of the old one to use the new one and then remove the old one.
LGTM
9501ea2
to
b39c533
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! I left few more comments. Definitely heading to the right direction. I would like to see runbooks now :)
pkg/util/globalerror/errors.go
Outdated
@@ -57,3 +60,7 @@ func (id ID) Message(msg string) string { | |||
func (id ID) MessageWithLimitConfig(flag, msg string) string { | |||
return fmt.Sprintf("%s (%s%s). You can adjust the related per-tenant limit by configuring -%s, or by contacting your service administrator.", msg, errPrefix, id, flag) | |||
} | |||
|
|||
func (id ID) MessageWith2LimitConfig(flag, flag2, msg string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new function version LGTM!
I can open a separate PR to change all previous uses of the old one to use the new one and then remove the old one.
LGTM
Co-authored-by: Marco Pracucci <marco@pracucci.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! We're super close to the finish line!
Co-authored-by: Marco Pracucci <marco@pracucci.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, thank you! :)
3c093e3
to
fd95e66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What this PR does
Following what we've done in #1939, this PR adds "rate_limited" and "too_many_ha_clusters" to the errors catalogue.
Which issue(s) this PR fixes or relates to
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]