-
Notifications
You must be signed in to change notification settings - Fork 101
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
feat: add alert classifier #2494
Conversation
return NotifyTelemetry | ||
} | ||
|
||
func GetErrorClass(ctx context.Context, err error) ErrorClass { |
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.
func GetErrorClass(ctx context.Context, err error) ErrorClass { | |
func GetErrorClass(ctx context.Context, err error) (ErrorClass, []string) { |
this might as well compute tags, lots of overlap. Appending logic currently will cause duplicate tagging. Logic a bit annoying with early returns here
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.
Appending logic currently will cause duplicate tagging
Duplicate tags are fine, will do the same in phases, will have a different prefix for classification and action
Logic a bit annoying with early returns here
Did it to prevent going through all if cases, can remove the return from switch and move after the switches, IIRC the switches use binary search
4051b29
to
702f8b5
Compare
package exceptions | ||
|
||
// PostgresSetupError represents errors during setup of Postgres peers, maybe we can later replace with a more generic error type | ||
type PostgresSetupError struct { |
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.
should implement Unwrap() error
to work better with various functions from errors
tho as is I don't see what this adds over fmt.Errorf
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 don't see what this adds over fmt.Errorf
This is just for easier check, so we don't have to do string matching, have used it in 1 place and can gradually increase usage
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.
ideal would be for there to be interface that has ErrorClass() ErrorClass
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.
agreed, I think we can do that once we have more error types
347f10e
to
9ca41b3
Compare
Will be good to have #2493 out first if possible