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

feat: add alert classifier #2494

Merged
merged 12 commits into from
Jan 30, 2025
Merged

feat: add alert classifier #2494

merged 12 commits into from
Jan 30, 2025

Conversation

iamKunalGupta
Copy link
Member

@iamKunalGupta iamKunalGupta commented Jan 28, 2025

Will be good to have #2493 out first if possible

return NotifyTelemetry
}

func GetErrorClass(ctx context.Context, err error) ErrorClass {
Copy link
Contributor

@serprex serprex Jan 28, 2025

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Member Author

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

@iamKunalGupta iamKunalGupta force-pushed the feat/add-alert-classifier branch 3 times, most recently from 4051b29 to 702f8b5 Compare January 29, 2025 18:17
@iamKunalGupta iamKunalGupta marked this pull request as ready for review January 29, 2025 20:11
@iamKunalGupta iamKunalGupta requested review from a team and serprex January 29, 2025 20:11
@iamKunalGupta iamKunalGupta linked an issue Jan 29, 2025 that may be closed by this pull request
package exceptions

// PostgresSetupError represents errors during setup of Postgres peers, maybe we can later replace with a more generic error type
type PostgresSetupError struct {
Copy link
Contributor

@serprex serprex Jan 30, 2025

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

Copy link
Member Author

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

Copy link
Contributor

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

Copy link
Member Author

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

@iamKunalGupta iamKunalGupta requested a review from serprex January 30, 2025 10:54
@iamKunalGupta iamKunalGupta force-pushed the feat/add-alert-classifier branch from 347f10e to 9ca41b3 Compare January 30, 2025 15:31
@iamKunalGupta iamKunalGupta enabled auto-merge (squash) January 30, 2025 15:36
@iamKunalGupta iamKunalGupta merged commit 43d6ae0 into main Jan 30, 2025
7 of 9 checks passed
@iamKunalGupta iamKunalGupta deleted the feat/add-alert-classifier branch January 30, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maybe ignore EOF errors for CH Cloud
3 participants