diff --git a/matrix_alertbot/alert.py b/matrix_alertbot/alert.py index 1374ae1..066adb2 100644 --- a/matrix_alertbot/alert.py +++ b/matrix_alertbot/alert.py @@ -55,9 +55,13 @@ class Alert: def html(self) -> str: alertname = self.labels["alertname"] - job = self.labels["job"] + + job = self.labels.get("job", "") + if job: + job = f"({job})" + description = self.annotations["description"] return ( f"[{self.emoji} {self.status.upper()}] " - f"{alertname} ({job})
{description}" + f"{alertname} {job}
{description}" )