-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Feature/Add Discord Alert Destination #6106
Conversation
@VitalyVakhteev Note that you're not being ignored. We're just getting some core stuff with the |
Yeah, just wanted to make sure the feature gets merged into both repositories. |
I've just rebased this onto the current tip of the I'm wanting to fix a bunch of dependencies before we merge this due to the boto3 version upgrade it includes. So, it might need to wait a few days until I have time to get that finished first. |
@wlach Is this the kind of thing you'd be interested in reviewing? 😄 |
Just manually re-created the "Boto3 dependency" commit, as that dependency is in a different file now. Once the CI checks pass (in maybe 1/2 hour), then this should be in a good position to review and merge. 😄 |
Looks like botocore will probably need to be updated at the same time as boto3 too. That could be doable, as we've recently been updating a bunch of other dependencies. So whatever was holding back boto3/botocore before might have gone away. No idea either way personally though. 😉 |
Co-authored-by: Jun <junnplus@gmail.com>
|
||
colors = { | ||
# Colors are in a Decimal format as Discord requires them to be Decimals for embeds | ||
Alert.OK_STATE: "2600544", # Green Decimal Code |
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.
Python can read color code like green or red
. So you can replace "260054" into green
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.
It doesn't look like that's the case, just tested it and got the following worker log:
[2023-07-11 08:58:58,920][PID:129][ERROR][root] Discord send ERROR. status_code => 400
So looks like it has to be decimal codes rather than more straightforward codes like green and red.
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.
It doesn't look like that's the case, just tested it and got the following worker log:
[2023-07-11 08:58:58,920][PID:129][ERROR][root] Discord send ERROR. status_code => 400
So looks like it has to be decimal codes rather than more straightforward codes like green and red.
You can change this code in your way. Let's try it again.
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.
Could you elaborate?
Co-authored-by: Jun <junnplus@gmail.com>
Please rebase master, and fix some confilcts, run |
We should probably add a |
I think I'll let the rest of y'all finish reviewing this |
Need to resolve the conflict. |
Fixed the merge conflict. It was just the newer boto3 and botocore deps, so super easy. 😄 |
Codecov Report
@@ Coverage Diff @@
## master #6106 +/- ##
==========================================
+ Coverage 59.99% 60.00% +0.01%
==========================================
Files 152 153 +1
Lines 12448 12480 +32
Branches 1687 1691 +4
==========================================
+ Hits 7468 7489 +21
- Misses 4771 4778 +7
- Partials 209 213 +4
|
Yay, finally merged! 😄 |
* Add discord webhook * Fix icon * Boto3 dependency * Add unit test for Discord webhook * Add suggestions * Apply suggestions from code review Co-authored-by: Jun <junnplus@gmail.com> * Misunderstood suggestion ) * Add suggestions * Apply suggestions from code review Co-authored-by: Jun <junnplus@gmail.com> * Fix test * Fix variables in strings * Fix formatting using our pre-commit hook --------- Co-authored-by: Jun <junnplus@gmail.com> Co-authored-by: Justin Clift <justin@postgresql.org>
* Add discord webhook * Fix icon * Boto3 dependency * Add unit test for Discord webhook * Add suggestions * Apply suggestions from code review Co-authored-by: Jun <junnplus@gmail.com> * Misunderstood suggestion ) * Add suggestions * Apply suggestions from code review Co-authored-by: Jun <junnplus@gmail.com> * Fix test * Fix variables in strings * Fix formatting using our pre-commit hook --------- Co-authored-by: Jun <junnplus@gmail.com> Co-authored-by: Justin Clift <justin@postgresql.org>
What type of PR is this?
Description
Added a new Discord destination that functions similarly to Slack. Asks for a URL (from a webhook) and a name for the destination.
How is this tested?
Add a query, add the destination with your own webhook URL, add an alert, and point the alert at the Discord destination.
Related Tickets & Documents
N/A
Mobile & Desktop Screenshots/Recordings (if there are UI changes)