diff --git a/chaos_genius/alerts/email_templates/common.html b/chaos_genius/alerts/email_templates/common.html
index 27e8d5680..98402fc16 100644
--- a/chaos_genius/alerts/email_templates/common.html
+++ b/chaos_genius/alerts/email_templates/common.html
@@ -216,7 +216,7 @@
{%- endif %}
{%- endif %}{% if point.relevant_subdims is not none -%}
+ -->{% if point.relevant_subdims -%}
-
Reasons for change:
diff --git a/chaos_genius/alerts/email_templates/email_alert.html b/chaos_genius/alerts/email_templates/email_alert.html
index 973dc0d84..dfd3f29a4 100644
--- a/chaos_genius/alerts/email_templates/email_alert.html
+++ b/chaos_genius/alerts/email_templates/email_alert.html
@@ -40,7 +40,7 @@
Anomalies
{% endif %}
-{% if data.include_subdims %}
+{% if data.include_subdims and data.top_subdim_points %}
Sub-dimensional anomalies
{% for point in data.top_subdim_points %}
diff --git a/chaos_genius/alerts/slack.py b/chaos_genius/alerts/slack.py
index 28fe0cdd2..150a93f35 100644
--- a/chaos_genius/alerts/slack.py
+++ b/chaos_genius/alerts/slack.py
@@ -28,7 +28,6 @@ def anomaly_alert_slack(
Returns an empty string if successful or the error as a string if not.
"""
- # TODO: Fix this implementation to use AlertsIndividualData
client = get_webhook_client()
response = client.send(
blocks=[
@@ -109,40 +108,40 @@ def alert_digest_slack_formatted(data: "AlertsReportData") -> str:
raise Exception("Slack not configured properly.")
blocks = [
- {
- "type": "header",
- "text": {
- "type": "plain_text",
- "text": f"Daily Alerts Report ({data.report_date_formatted()})",
- "emoji": True,
- },
- },
- {
- "type": "divider",
- },
- {
- "type": "header",
- "text": {
- "type": "plain_text",
- "text": "Top Anomalies",
- "emoji": True,
- },
+ {
+ "type": "header",
+ "text": {
+ "type": "plain_text",
+ "text": f"Daily Alerts Report ({data.report_date_formatted()})",
+ "emoji": True,
},
- *_display_anomalies_digest(data),
- *_display_anomalies_digest(data, subdim=True),
- {
- "type": "actions",
- "elements": [
- {
- "type": "button",
- "text": {"type": "plain_text", "text": "Alerts Dashboard"},
- "url": data.alert_dashboard_link(),
- "action_id": "alert_dashboard",
- "style": "primary",
- }
- ],
+ },
+ {
+ "type": "divider",
+ },
+ {
+ "type": "header",
+ "text": {
+ "type": "plain_text",
+ "text": "Top Anomalies",
+ "emoji": True,
},
- ]
+ },
+ *_display_anomalies_digest(data),
+ *_display_anomalies_digest(data, subdim=True),
+ {
+ "type": "actions",
+ "elements": [
+ {
+ "type": "button",
+ "text": {"type": "plain_text", "text": "Alerts Dashboard"},
+ "url": data.alert_dashboard_link(),
+ "action_id": "alert_dashboard",
+ "style": "primary",
+ }
+ ],
+ },
+ ]
response = client.send(blocks=blocks)
@@ -157,10 +156,7 @@ def _display_anomalies_individual(anomaly_data, subdim: bool = False):
sections: List[Dict[str, Any]] = []
section = {
"type": "section",
- "text": {
- "type": "mrkdwn",
- "text": ""
- },
+ "text": {"type": "mrkdwn", "text": ""},
}
if not subdim:
@@ -172,7 +168,7 @@ def _display_anomalies_individual(anomaly_data, subdim: bool = False):
section["text"]["text"] += point_formatted
sections.append(section)
else:
- if anomaly_data.include_subdims:
+ if anomaly_data.include_subdims and anomaly_data.top_subdim_points:
header_section = {
"type": "header",
"text": {
@@ -199,10 +195,7 @@ def _display_anomalies_digest(anomaly_data, subdim: bool = False):
def _new_text_section() -> Dict[str, Any]:
section = {
"type": "section",
- "text": {
- "type": "mrkdwn",
- "text": ""
- },
+ "text": {"type": "mrkdwn", "text": ""},
}
sections.append(section)
return section
@@ -259,14 +252,10 @@ def subdim_name_link(point, value_only: bool = False):
"""Creates subdim name with link to respective subdim anomaly page."""
if value_only:
subdim_link = (
- f"<{point.subdim_link()}"
- + f"|{point.subdim_formatted_value_only()}>"
+ f"<{point.subdim_link()}" + f"|{point.subdim_formatted_value_only()}>"
)
else:
- subdim_link = (
- f"<{point.subdim_link()}"
- + f"|{point.subdim_formatted()}>"
- )
+ subdim_link = f"<{point.subdim_link()}" + f"|{point.subdim_formatted()}>"
return subdim_link
@@ -331,7 +320,7 @@ def anomaly_point_formatting(
+ f" to {point.anomaly_time_only}"
)
- if point.relevant_subdims is not None:
+ if point.relevant_subdims:
out += "\n - Reasons for change: "
for point in point.top_relevant_subdims() or []:
out += f"{subdim_name_link(point, value_only=True)}, "
diff --git a/chaos_genius/controllers/digest_controller.py b/chaos_genius/controllers/digest_controller.py
index 63fecf087..5226932ae 100644
--- a/chaos_genius/controllers/digest_controller.py
+++ b/chaos_genius/controllers/digest_controller.py
@@ -243,22 +243,27 @@ def extract_anomaly_points_from_triggered_alerts(
"Error in extracting an anomaly point from triggered alert",
exc_info=e,
)
- anomaly_points.extend(
- AnomalyPointFormatted.from_points(
- trig_alert_points,
- time_series_frequency=getattr(
- kpi_cache.get(triggered_alert.kpi_id), "anomaly_params", {}
- ).get("frequency"),
- kpi_id=triggered_alert.kpi_id,
- kpi_name=triggered_alert.kpi_name,
- alert_id=triggered_alert.alert_conf_id,
- alert_name=triggered_alert.alert_name,
- alert_channel=triggered_alert.alert_channel,
- alert_channel_conf=triggered_alert.alert_channel_conf,
- include_subdims=triggered_alert.include_subdims,
- )
+
+ anomaly_params = getattr(
+ kpi_cache.get(triggered_alert.kpi_id), "anomaly_params", {}
)
+ # consider only KPIs which have anomaly enabled
+ if anomaly_params is not None:
+ anomaly_points.extend(
+ AnomalyPointFormatted.from_points(
+ trig_alert_points,
+ time_series_frequency=anomaly_params.get("frequency"),
+ kpi_id=triggered_alert.kpi_id,
+ kpi_name=triggered_alert.kpi_name,
+ alert_id=triggered_alert.alert_conf_id,
+ alert_name=triggered_alert.alert_name,
+ alert_channel=triggered_alert.alert_channel,
+ alert_channel_conf=triggered_alert.alert_channel_conf,
+ include_subdims=triggered_alert.include_subdims,
+ )
+ )
+
return anomaly_points
diff --git a/chaos_genius/settings.py b/chaos_genius/settings.py
index 064e88577..b7e5e5b0a 100644
--- a/chaos_genius/settings.py
+++ b/chaos_genius/settings.py
@@ -149,7 +149,7 @@ def _make_bool(val: Union[str, bool]) -> bool:
TASK_CHECKPOINT_LIMIT: int = int(os.getenv("TASK_CHECKPOINT_LIMIT", 1000))
"""Number of last checkpoints to retrieve in Task Monitor"""
-CHAOSGENIUS_VERSION_MAIN = os.getenv("CHAOSGENIUS_VERSION_MAIN", "0.9.0")
+CHAOSGENIUS_VERSION_MAIN = os.getenv("CHAOSGENIUS_VERSION_MAIN", "0.9.1")
"""ChaosGenius version - semver part only"""
CHAOSGENIUS_VERSION_POSTFIX = os.getenv("CHAOSGENIUS_VERSION_POSTFIX", "git")
"""ChaosGenius version - postfix to identify deployment"""
diff --git a/docker-compose.thirdparty.yml b/docker-compose.thirdparty.yml
index d265c49d5..a40d74dc8 100644
--- a/docker-compose.thirdparty.yml
+++ b/docker-compose.thirdparty.yml
@@ -38,7 +38,7 @@ services:
chaosgenius-server:
container_name: chaosgenius-server
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: sh setup/run-backend-docker.sh
restart: unless-stopped
volumes:
@@ -97,7 +97,7 @@ services:
chaosgenius-webapp:
container_name: chaosgenius-webapp
- image: chaosgenius/chaosgenius-webapp:0.9.0
+ image: chaosgenius/chaosgenius-webapp:0.9.1
command: >
sh -c "npx react-inject-env set -d ./ &&
nginx -g 'daemon off;'"
@@ -138,7 +138,7 @@ services:
chaosgenius-scheduler:
container_name: chaosgenius-scheduler
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: celery -A run.celery beat --loglevel=DEBUG
restart: unless-stopped
environment:
@@ -175,7 +175,7 @@ services:
chaosgenius-worker-analytics:
container_name: chaosgenius-worker-analytics
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: celery -A run.celery worker --loglevel=INFO --concurrency=2 -P processes -Q anomaly-rca
restart: unless-stopped
environment:
@@ -229,7 +229,7 @@ services:
chaosgenius-worker-alerts:
container_name: chaosgenius-worker-alerts
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: celery -A run.celery worker --loglevel=INFO --concurrency=2 -P processes -Q alerts
restart: unless-stopped
environment:
diff --git a/docker-compose.yml b/docker-compose.yml
index ccb91b948..f93266fb3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -12,7 +12,7 @@ x-version:
services:
chaosgenius-server:
container_name: chaosgenius-server
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: sh setup/run-backend-docker.sh
restart: unless-stopped
volumes:
@@ -70,7 +70,7 @@ services:
chaosgenius-webapp:
container_name: chaosgenius-webapp
- image: chaosgenius/chaosgenius-webapp:0.9.0
+ image: chaosgenius/chaosgenius-webapp:0.9.1
command: >
sh -c "npx react-inject-env set -d ./ &&
nginx -g 'daemon off;'"
@@ -109,7 +109,7 @@ services:
chaosgenius-scheduler:
container_name: chaosgenius-scheduler
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: celery -A run.celery beat --loglevel=DEBUG
restart: unless-stopped
environment:
@@ -146,7 +146,7 @@ services:
chaosgenius-worker-analytics:
container_name: chaosgenius-worker-analytics
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: celery -A run.celery worker --loglevel=INFO --concurrency=2 -P processes -Q anomaly-rca
restart: unless-stopped
environment:
@@ -200,7 +200,7 @@ services:
chaosgenius-worker-alerts:
container_name: chaosgenius-worker-alerts
- image: chaosgenius/chaosgenius-server:0.9.0
+ image: chaosgenius/chaosgenius-server:0.9.1
command: celery -A run.celery worker --loglevel=INFO --concurrency=2 -P processes -Q alerts
restart: unless-stopped
environment:
diff --git a/frontend/src/components/KpiAlertConfigurationForm/index.jsx b/frontend/src/components/KpiAlertConfigurationForm/index.jsx
index 4f54892fc..b51e56595 100644
--- a/frontend/src/components/KpiAlertConfigurationForm/index.jsx
+++ b/frontend/src/components/KpiAlertConfigurationForm/index.jsx
@@ -627,7 +627,9 @@ const KpiAlertConfigurationForm = ({
)}
-