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

add reason code to slack notifier #3252

Merged
merged 3 commits into from
Apr 28, 2023
Merged

add reason code to slack notifier #3252

merged 3 commits into from
Apr 28, 2023

Conversation

gotjosh
Copy link
Member

@gotjosh gotjosh commented Feb 15, 2023

this uses the new error with reason to determine based on status code what the reason is for the slack integration

partial #3231

While I'm the committer of this message, I had no doing in the actual code and instead, the list of individuals below are to be contributed:

@alexmobo @zzehring @suntala @gloriasc @katebrenner @ktw4071

this uses the new error with reason to determine based on status code what the reason is for the slack integration

partial #3231

Signed-off-by: gotjosh <josue.abreu@gmail.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
@gotjosh gotjosh merged commit 4dc2015 into main Apr 28, 2023
@gotjosh gotjosh deleted the slack_reason branch April 28, 2023 13:05
@@ -213,5 +217,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
// https://api.slack.com/changelog/2016-05-17-changes-to-errors-for-incoming-webhooks
retry, err := n.retrier.Check(resp.StatusCode, resp.Body)
err = errors.Wrap(err, fmt.Sprintf("channel %q", req.Channel))
return retry, err
reasonErr := notify.NewErrorWithReason(notify.GetFailureReasonFromStatusCode(resp.StatusCode), err)
Copy link
Contributor

@knyar knyar Apr 29, 2023

Choose a reason for hiding this comment

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

Does not this make Notify return a non-nil error even when err is nil here?

UPD: fixing as part of #3121

gotjosh added a commit that referenced this pull request May 2, 2023
This was introduced as part of #3252 and its a case I didn't really took into account.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
gotjosh added a commit that referenced this pull request Aug 7, 2023
* add reason code to slack notifier
this uses the new error with reason to determine based on status code what the reason is for the slack integration

partial #3231

Signed-off-by: gotjosh <josue.abreu@gmail.com>

* Add some tests

Signed-off-by: gotjosh <josue.abreu@gmail.com>

* Handle the error

Signed-off-by: gotjosh <josue.abreu@gmail.com>

---------

Signed-off-by: gotjosh <josue.abreu@gmail.com>
radek-ryckowski pushed a commit to goldmansachs/alertmanager that referenced this pull request Nov 6, 2023
* add reason code to slack notifier
this uses the new error with reason to determine based on status code what the reason is for the slack integration

partial prometheus#3231

Signed-off-by: gotjosh <josue.abreu@gmail.com>

* Add some tests

Signed-off-by: gotjosh <josue.abreu@gmail.com>

* Handle the error

Signed-off-by: gotjosh <josue.abreu@gmail.com>

---------

Signed-off-by: gotjosh <josue.abreu@gmail.com>
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.

3 participants