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

Alerting: Add support for Sensu Go notification channel #28012

Merged
merged 18 commits into from
Nov 27, 2020

Conversation

nixwiz
Copy link
Contributor

@nixwiz nixwiz commented Oct 2, 2020

What this PR does / why we need it:
Similar to current support for the older "Core" version of
Sensu, this commit add support for the newer version.

Which issue(s) this PR fixes:

Fixes #19908

Special notes for your reviewer:

Similar to current support for the older "Core" version of
Sensu, this commit add support for the newer version.

Closes grafana#19908

Signed-off-by: Todd Campbell <todd@sensu.io>
@nixwiz nixwiz requested review from a team, papagian, kylebrandt, mckn and hugohaggmark and removed request for a team October 2, 2020 19:26
Signed-off-by: Todd Campbell <todd@sensu.io>
Copy link
Contributor

@hugohaggmark hugohaggmark left a comment

Choose a reason for hiding this comment

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

Frontend changes look ok a bit confusing with 2 versions of sensu but I hope there is a description somewhere that helps the users?

@aknuds1 aknuds1 added area/alerting/notifications Issues when sending alert notifications area/backend pr/external This PR is from external contributor type/feature labels Oct 5, 2020
@aknuds1
Copy link
Contributor

aknuds1 commented Oct 5, 2020

Thanks, we'll review it this week.

Copy link
Contributor

@mckn mckn left a comment

Choose a reason for hiding this comment

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

I agree with what @hugohaggmark said. What is the difference? Can it be expressed in a better way?

@aknuds1 aknuds1 added the pr/needs-discussion This PR needs a bigger discussion label Oct 6, 2020
Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

I saw some issues that should be fixed, but bear in mind that we need to decide first if we want to include this new channel.

pkg/services/alerting/notifiers/sensugo.go Outdated Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo_test.go Outdated Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo_test.go Outdated Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo_test.go Outdated Show resolved Hide resolved
Todd Campbell and others added 3 commits October 7, 2020 06:36
PR review suggestions

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Todd Campbell <todd@sensu.io>
@aknuds1 aknuds1 self-requested a review October 8, 2020 06:36
@aknuds1
Copy link
Contributor

aknuds1 commented Oct 12, 2020

We're still discussing potential inclusion of Sensu Go support.

Copy link
Contributor

@achatterjee-grafana achatterjee-grafana left a comment

Choose a reason for hiding this comment

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

Added two copy-edit suggestions.

pkg/services/alerting/notifiers/sensugo.go Outdated Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo.go Outdated Show resolved Hide resolved
Signed-off-by: Todd Campbell <todd@sensu.io>
Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

We have thought about this a bit, and are leaning towards accepting the PR.

However, we need facilities to make it maintainable. Could you also add a Sensu Go block to devenv/docker/blocks, so we can easily bring up a Docker Compose environment when we need to maintain/test it?

@nixwiz
Copy link
Contributor Author

nixwiz commented Oct 22, 2020

There seems to be something wrong when wrong it with our devenv:

This should be fixed now.

Signed-off-by: Todd Campbell <todd@sensu.io>
Copy link
Contributor

@kylebrandt kylebrandt left a comment

Choose a reason for hiding this comment

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

Works with devenv for me

image

Copy link
Contributor

@papagian papagian left a comment

Choose a reason for hiding this comment

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

Generally works fine!
I have requested some changes regarding securely storing the API key.

devenv/docker/blocks/sensugo/notes.md Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo.go Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo.go Outdated Show resolved Hide resolved
Todd Campbell and others added 2 commits November 18, 2020 11:55
Set the API key as a secure value.

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
@nixwiz nixwiz requested a review from a team as a code owner November 18, 2020 17:02
@nixwiz nixwiz requested review from papagian and removed request for a team November 18, 2020 17:30
Copy link
Contributor

@papagian papagian left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution and the delayed response.
It works fine but I have a small suggestion.

pkg/services/alerting/notifiers/sensugo.go Outdated Show resolved Hide resolved
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Copy link
Contributor

@papagian papagian left a comment

Choose a reason for hiding this comment

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

Great! one last thing: you have to synchronise your branch with master once again for the CI built to succeed in order to get it merged!

@nixwiz
Copy link
Contributor Author

nixwiz commented Nov 26, 2020

@papagian branch merged with master and pushed again, CI builds successful. Thanks for your assistance!

Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

Generally looks good to me, but left suggestions for some improvements to the tests. Basically, you should use require.NoError and require.Error instead of their assert equivalents, since you want to abort the tests if these tests fail, to avoid chaos/undefined behaviour in the following code.

pkg/services/alerting/notifiers/sensugo_test.go Outdated Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo_test.go Outdated Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo_test.go Outdated Show resolved Hide resolved
pkg/services/alerting/notifiers/sensugo_test.go Outdated Show resolved Hide resolved
Signed-off-by: Todd Campbell <todd@sensu.io>
@papagian papagian added this to the 7.4.0 milestone Nov 27, 2020
@papagian papagian merged commit 643f790 into grafana:master Nov 27, 2020
@nixwiz nixwiz deleted the add-sensu-go branch November 30, 2020 12:41
@mjseaman mjseaman added this to the 7.4.0 milestone Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/alerting/notifications Issues when sending alert notifications area/backend pr/external This PR is from external contributor pr/needs-discussion This PR needs a bigger discussion type/feature-request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notifications no longer work against latest version of Sensu Go
9 participants