-
-
Notifications
You must be signed in to change notification settings - Fork 630
feat(alerting): Support extra labels in email alerts #1191
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
Conversation
- Add support for including extra labels in email alert messages if present - Update tests to cover cases with and without extra labels in alert emails Signed-off-by: Bo-Yi Wu <[email protected]>
TwiN
left a comment
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.
Well, that's an unexpected little bonus of having the extra labels at the endpoint level!
|
@appleboy just out of curiosity, did you use an AI agent to create the PR? If so, which model are you using? |
TwiN
left a comment
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.
Looks like there's a failing test
Claude 4 Sonnet in AWS Bedrock. I just asked AI to help summarize the content of this fix. |
I will take it. |
|
@TwiN please help approve the workflow |
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/twin/gatus](https://github.com/TwiN/gatus) | minor | `v5.22.0` -> `v5.23.1` | --- ### Release Notes <details> <summary>TwiN/gatus (ghcr.io/twin/gatus)</summary> ### [`v5.23.1`](https://github.com/TwiN/gatus/releases/tag/v5.23.1) [Compare Source](TwiN/gatus@v5.23.0...v5.23.1) #### What's Changed - fix(ui): Update endpoints in-place instead of reloading every time by [@​TwiN](https://github.com/TwiN) in TwiN/gatus#1209 - docs: improve `extra-labels` description by [@​salim-b](https://github.com/salim-b) in TwiN/gatus#1208 **Full Changelog**: TwiN/gatus@v5.23.0...v5.23.1 ### [`v5.23.0`](https://github.com/TwiN/gatus/releases/tag/v5.23.0) [Compare Source](TwiN/gatus@v5.22.0...v5.23.0) This is a big one, and for the occasion, I'll highlight the two big changes: - **New UI**: That's right, a brand new modern UI. This was long overdue. I hope you like it. - **Announcements**: Want to update your users/customers about an outage? You can, now.  Thoughts on the UI & announcements? Just like any healthy relationship, communicate with me on [TwiN/gatus#1206](TwiN/gatus#1206) #### What's Changed - feat(ui): New status page UI by [@​TwiN](https://github.com/TwiN) in TwiN/gatus#1198 - feat: Implement announcements by [@​TwiN](https://github.com/TwiN) in TwiN/gatus#1204 - feat(alerting): Support extra labels in email alerts by [@​appleboy](https://github.com/appleboy) in TwiN/gatus#1191 - fix(ui): Replace filter value "nothing" by "none" by [@​TwiN](https://github.com/TwiN) in TwiN/gatus#1202 - docs: tweak `minimum-reminder-interval` description by [@​salim-b](https://github.com/salim-b) in TwiN/gatus#1194 **Full Changelog**: TwiN/gatus@v5.22.0...v5.23.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4zNS4wIiwidXBkYXRlZEluVmVyIjoiNDEuMS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbWFnZSJdfQ==--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/1241 Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Email Provider ExtraLabels Test Implementation Summary
Objective
Added comprehensive test coverage for the
extraLabelsfunctionality in thebuildMessageSubjectAndBodyfunction withinalerting/provider/email/email_test.goto ensure the Email Template displays extra labels correctly.Key Changes
1. Test Structure Enhancement
TestAlertProvider_buildRequestBodyfunction by adding anEndpointfield to the test scenario structuretriggeredandresolved) to use the new structure for better endpoint-specific testing2. New Test Cases Added
Added 3 new comprehensive test cases to cover
extraLabelsfunctionality:triggered-with-single-extra-label{"environment": "production"}resolved-with-single-extra-label{"service": "api"}triggered-with-no-extra-labelsmap[string]string{}3. Test Coverage
✅ Extra Labels Display Format
Verifies that extra labels are properly formatted in email content:
Design Decisions
Single Label Testing: Used single labels to avoid Go map iteration order non-determinism issues
Comprehensive Coverage: Included both positive cases (with labels) and negative cases (without labels)
Backward Compatibility: Maintained existing test architecture integrity
Test Results
Impact
This implementation ensures that:
Commit Log
Checklist
README.md, if applicable.