-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 discord message fields #3821
Conversation
@yaskinny can you signoff your commits? That will fix the DCO check 🙂 |
Add Discord webhook content, avatar url and username fields Signed-off-by: yaser <yaserkalali.work@gmail.com>
Add Username Signed-off-by: yaser <yaserkalali.work@gmail.com>
3178f11
to
85d44df
Compare
hey, sorry for the delay. i was busy. I signed off my commits and pushed them again. let me know if i need to do anything else. Best Regards, |
also it might be beneficial to edit the default discord template in a way that older config version(without username/content) works without any issue after updating to newer alertmanager version. like making username/content optional in the template. since at this point, users need to rewrite their own template if they want to use username/content fields. with updating default template, it will has better UX since by default it will be included in the alerts. @grobinson-grafana let me know if you want me to work on that or not. |
I'm not sure I understand. What are you suggesting? |
I mean the default Discord template does not include the content field. alertmanager/template/default.tmpl Lines 126 to 136 in e5821b7
It would be better if the default template used the content field to allow anyone who uses the content option to utilize it without having to write their own template from scratch. However, since older versions of Alertmanager do not include the content field, we need to make it optional (use a condition in the template to check if content is set before using it). By making it optional, users won't face errors after updating to the new Alertmanager version. |
Is the suggestion to also replace the embeds with content? If not, what would the default template for |
You might also want to check out #3761 which extends the use of embeds. |
I think he meant don't touch embedded at all just to make content field configurable, atm we have it just in webhook struct but does use nowhere.
It would be really useful as for some custom solutions you would like to mention users over user_id or role_id and make sure they got notification. In current implementation of discord embedded everything that is tagged inside embedded won't trigger discord notification. |
Allow for custom username and avatar URLs to be set in discord notifications. Add `username` and `avatar_url` to discord configuration, default empty string. Re-implement prometheus#3821 Signed-off-by: Jeff Wong <awole20@gmail.com>
Allow for custom username and avatar URLs to be set in discord notifications. Add `username` and `avatar_url` to discord configuration, default empty string. Re-implement prometheus#3821 Signed-off-by: Jeff Wong <awole20@gmail.com>
* Feat(discord): Allow for custom username and avatar URLs to be set in discord notifications. Add `username` and `avatar_url` to discord configuration, default empty string. Re-implement #3821 Signed-off-by: Jeff Wong <awole20@gmail.com> * Test the new fields Signed-off-by: gotjosh <josue.abreu@gmail.com> * These are not templeatable strings Signed-off-by: gotjosh <josue.abreu@gmail.com> --------- Signed-off-by: Jeff Wong <awole20@gmail.com> Signed-off-by: gotjosh <josue.abreu@gmail.com> Co-authored-by: gotjosh <josue.abreu@gmail.com>
This PR adds some fields to Discord message like Content which is already mentioned in issue #3667.
Being able to set Content is really important to have since at this moment, there is no way to tag users in alerts. Default Discord
template embeds alerts and in Discord, ATM, tagging someone in embedded fields, does not tag them. It will just include user/role name without sending notification like when you get tagged in normal message.
Discord code already had
content
field but it's not used in the code nor config.I added other fields like avatar url and username.
Below content are example configs and result:
Alertmanager receiver config:
Template:
Prometheus alert: