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(alerting): Add group-specific WebHook URL for Discord #271

Merged
merged 8 commits into from
Apr 12, 2022

Conversation

appleboy
Copy link
Contributor

Add group-specific webhook URL for discord alert

Provides support for paging multiple Discords based on the group selector while keeping backward compatibility to the old Discords configuration manifest

integration per team can be specified in the overrides sections in an array form.

alerting:
  discord: 
    webhook-url: "https://discord.com/api/webhooks/**********/**********"
    # You can also add group-specific to keys, which will 
    # override the to key above for the specified groups
    overrides:
      - group: "core"
        webhook-url: "https://discord.com/api/webhooks/************"

endpoints:
  - name: website
    url: "https://twin.sh/health"
    interval: 30s
    conditions:
      - "[STATUS] == 200"
      - "[BODY].status == UP"
      - "[RESPONSE_TIME] < 300"
    alerts:
      - type: discord
        enabled: true
        description: "healthcheck failed"
        send-on-resolved: true

  - name: back-end
    group: core
    url: "https://example.org/"
    interval: 5m
    conditions:
      - "[STATUS] == 200"
      - "[CERTIFICATE_EXPIRATION] > 48h"
    alerts:
      - type: discord
        enabled: true
        description: "healthcheck failed"
        send-on-resolved: true

ref: #96

Signed-off-by: Bo-Yi Wu appleboy.tw@gmail.com

Add group-specific webhook URL for discord alert

Provides support for paging multiple Discords based on the group selector while keeping backward compatibility to the old Discords configuration manifest

integration per team can be specified in the overrides sections in an array form.

ref: TwiN#96

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
@appleboy appleboy changed the title feat(alerting): Add group-specific WebHook URL for discord feat(alerting): Add group-specific WebHook URL for Discord Mar 25, 2022
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
@appleboy
Copy link
Contributor Author

appleboy commented Apr 2, 2022

@TwiN All Done, Please help to review again.

README.md Outdated Show resolved Hide resolved
alerting/provider/discord/discord_test.go Outdated Show resolved Hide resolved
alerting/provider/discord/discord.go Outdated Show resolved Hide resolved
appleboy and others added 3 commits April 4, 2022 06:57
Co-authored-by: TwiN <twin@linux.com>
Co-authored-by: TwiN <twin@linux.com>
@appleboy
Copy link
Contributor Author

appleboy commented Apr 3, 2022

@TwiN All Done.

@codecov-commenter
Copy link

codecov-commenter commented Apr 3, 2022

Codecov Report

Merging #271 (60205c1) into master (5281f80) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #271      +/-   ##
==========================================
- Coverage   83.70%   83.68%   -0.03%     
==========================================
  Files          53       53              
  Lines        3462     3476      +14     
==========================================
+ Hits         2898     2909      +11     
- Misses        439      441       +2     
- Partials      125      126       +1     
Impacted Files Coverage Δ
alerting/provider/discord/discord.go 91.78% <100.00%> (+1.95%) ⬆️
config/maintenance/maintenance.go 92.40% <0.00%> (-3.80%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5281f80...60205c1. Read the comment docs.

alerting/provider/discord/discord_test.go Outdated Show resolved Hide resolved
Co-authored-by: TwiN <twin@linux.com>
@appleboy
Copy link
Contributor Author

appleboy commented Apr 4, 2022

@TwiN Done. Please review again.

Copy link
Owner

@TwiN TwiN left a comment

Choose a reason for hiding this comment

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

My bad, I missed the notification.
Thank you for the contribution!

@TwiN TwiN added the feature New feature or request label Apr 12, 2022
@TwiN TwiN merged commit e307d1a into TwiN:master Apr 12, 2022
@appleboy appleboy deleted the discord branch April 12, 2022 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants