Skip to content

Commit

Permalink
Add link to Grafana plots in alert and success messages
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Oct 10, 2024
1 parent 7d9f60f commit d321a1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/lvmcryo/notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
from lvmcryo.handlers import LN2Handler


GRAFANA_URL = "https://lvm-grafana.lco.cl/d/ec97aef8-071f-4f9f-9cc9-2f3f206d8308/cryostat-temperatures-and-pressures?orgId=1&refresh=10s"


class NotifierConfig(BaseModel):
"""Configuration for the Notifier class."""

Expand Down Expand Up @@ -293,7 +296,7 @@ async def notify_after_fill(
slack_message = (
"Something went wrong with the LN₂ fill. "
"Please check the status of the spectrographs. "
"Grafana plots are available <https://lvm-grafana.lco.cl|here>."
"Grafana plots are available <GRAFANA_URL|here>."
)
if error_message:
if isinstance(error_message, Exception):
Expand Down Expand Up @@ -400,6 +403,7 @@ async def notify_after_fill(
error=email_error,
has_images=has_images,
valve_data=valve_data,
grafana_url=GRAFANA_URL,
lvmweb_url=lvmweb_url,
),
)
Expand Down
2 changes: 1 addition & 1 deletion src/lvmcryo/templates/alert_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1>An alert was raised during an LVM LN<sub>2</sub> fill</h1>
{% endif %}

<div style="padding: 5px 0px">
At your earliest convenience please check the status of the LVM spectrograph system. You can access Grafana plots <a href="https://lvm-grafana.lco.cl">here</a>.
At your earliest convenience please check the status of the LVM spectrograph system. You can access Grafana plots <a href="{{ grafana_url }}">here</a>.
</div>

{% if lvmweb_url %}
Expand Down
2 changes: 1 addition & 1 deletion src/lvmcryo/templates/success_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1>An LVM LN<sub>2</sub> fill was completed successfully.</h1>

{% if lvmweb_url %}
<div style="padding: 5px 0px">
Information about the fill can be found at <a href="{{ lvmweb_url }}">this link</a>.
Information about the fill can be found at <a href="{{ lvmweb_url }}">this link</a>. Grafana plots are available <a href="{{ grafana_url }}">here</a>.
</div>
{% endif %}

Expand Down

0 comments on commit d321a1e

Please sign in to comment.