Skip to content

Commit

Permalink
Merge pull request #1031 from chaos-genius/release-0.9.1
Browse files Browse the repository at this point in the history
release: v0.9.1
  • Loading branch information
Samyak2 committed Jul 12, 2022
2 parents 6c64762 + ba9292b commit eb057a5
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 78 deletions.
2 changes: 1 addition & 1 deletion chaos_genius/alerts/email_templates/common.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
{%- endif %}
{%- endif %}<!--
-->{% if point.relevant_subdims is not none -%}
-->{% if point.relevant_subdims -%}
<ul>
<li>
<span style="{{ non_important_text }}">Reasons for change:</span>
Expand Down
2 changes: 1 addition & 1 deletion chaos_genius/alerts/email_templates/email_alert.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3 style="{{ common.main_text }}">Anomalies</h3>
</ul>
{% endif %}

{% if data.include_subdims %}
{% if data.include_subdims and data.top_subdim_points %}
<h3 style="{{ common.main_text }}">Sub-dimensional anomalies</h3>
<ul>
{% for point in data.top_subdim_points %}
Expand Down
87 changes: 38 additions & 49 deletions chaos_genius/alerts/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand Down Expand Up @@ -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)

Expand All @@ -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:
Expand All @@ -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": {
Expand All @@ -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
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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)}, "
Expand Down
33 changes: 19 additions & 14 deletions chaos_genius/controllers/digest_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion chaos_genius/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.thirdparty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;'"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;'"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/KpiAlertConfigurationForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,9 @@ const KpiAlertConfigurationForm = ({
</div>
)}
</div>
<div className="form-check check-box" key="include-subdims">
<div
className="form-check check-box kpialertconfig"
key="include-subdims">
<input
className="form-check-input"
name="include-subdims"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@
}
}
}
.form-check.check-box {
.form-check.check-box.kpialertconfig {
margin-bottom: 0px;
}

0 comments on commit eb057a5

Please sign in to comment.