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

Create alertmanager.js #808

Merged
merged 8 commits into from
Aug 16, 2023
Merged

Create alertmanager.js #808

merged 8 commits into from
Aug 16, 2023

Conversation

HarHarLinks
Copy link
Contributor

@HarHarLinks HarHarLinks commented Aug 8, 2023

@HarHarLinks HarHarLinks marked this pull request as ready for review August 8, 2023 16:19
@HarHarLinks HarHarLinks requested a review from a team as a code owner August 8, 2023 16:19
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

Thanks for this one :). Just a couple of requests from me.

contrib/alertmanager.js Outdated Show resolved Hide resolved
@HarHarLinks HarHarLinks requested a review from Half-Shot August 9, 2023 10:30
@erebion
Copy link

erebion commented Aug 9, 2023

@HarHarLinks Could you please add some spaces and a slash for improved formatting?

image

This is how it looks.

image

This is how an alarm looks with spaces and a slash added.

@HarHarLinks
Copy link
Contributor Author

@erebion thanks for the screenshots.
I agree with your sentiment. However I'm not actively using this (just copy-pasted from the hookshot channel), I'm not even running Alertmanager, yet...
I think it'd be best if you could suggest changes via code review?

@erebion
Copy link

erebion commented Aug 9, 2023

@HarHarLinks Sure, I modified this slightly to look better so I can tell you what I did.

Copy link

@erebion erebion left a comment

Choose a reason for hiding this comment

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

Some small changes pls to improve formatting :)

@erebion
Copy link

erebion commented Aug 9, 2023

Screenshot_2023-08-09_19-34-16

This is how it looks like with the changes, had to purposefully crash Grafana, lol

@HarHarLinks
Copy link
Contributor Author

HarHarLinks commented Aug 11, 2023

I refactored @erebion's suggestions slightly, and kept to a bit more compact message. please resolve the review threads if you're happy with that?

Looks like:
image

Fallback looks something like:
image

Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

I'm happy, will give @erebion a bit of time to respond.

@erebion
Copy link

erebion commented Aug 14, 2023

I'm happy, will give @erebion a bit of time to respond.

Looks okay, though I'd be a bit happier with an additional line break after [WARNING - FIRING] and before the source and silence link for improved readability and accessibilty.

Many people struggle to read such messages if they are a wall of text and have a much easier time if there's a line break.

Also, I think it looks a bit better.

@HarHarLinks
Copy link
Contributor Author

HarHarLinks commented Aug 14, 2023

"formatted_body": "<p><font color='green'><b>[RESOLVED]</b></font></p><p><b>HostSystemdServiceCrashed</b>: SystemD service crashed<br/>  VALUE = 1<br/>  LABELS: map[__name__:node_systemd_unit_state instance:localhost:9100 job:host_node_exporter name:grafana.service state:failed type:simple]</p><p><a href=\"http://erebion-matrix:9090/graph?g0.expr=node_systemd_unit_state%7Bstate%3D%22failed%22%7D+%3D%3D+1&g0.tab=1\">source</a> | <a href=\"http://localhost:9093#silences/new?filter={alertname%3D%22HostSystemdServiceCrashed%22,instance%3D%22localhost%3A9100%22,job%3D%22host_node_exporter%22,name%3D%22grafana.service%22,severity%3D%22warning%22,state%3D%22failed%22,type%3D%22simple%22}\">silence</a></p>"

looks like
image

could someone who is actually running this please test if my replaceAll works properly?

convert `\n` line breaks to html `<br/>` so the upstream formatting is applied
@Half-Shot Half-Shot enabled auto-merge August 16, 2023 17:00
@Half-Shot Half-Shot added this pull request to the merge queue Aug 16, 2023
Merged via the queue into matrix-org:main with commit 57e7a84 Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants