diff --git a/src/robusta/integrations/slack/sender.py b/src/robusta/integrations/slack/sender.py index cc4e1d63d..e5ca9636c 100644 --- a/src/robusta/integrations/slack/sender.py +++ b/src/robusta/integrations/slack/sender.py @@ -1,6 +1,7 @@ import logging import ssl import tempfile +import time from datetime import datetime from itertools import chain from typing import Any, Dict, List, Set, Tuple @@ -415,15 +416,16 @@ def send_or_update_summary_message( ): """Create or update a summary message with tabular information about the amount of events fired/resolved and a header describing the event group that this information concerns.""" - # TODO investigate button + now_ts = time.time() + rows = [] + n_total_alerts = 0 for key, value in sorted(summary_table.items()): # key is a tuple of attribute names; value is a 2-element list with - # the number of firing and resolved events. + # the number of firing and resolved notifications. row = list(str(e) for e in chain(key, value)) rows.append(row) - - now_ts = time.time() + n_total_alerts += value[0] + value[1] # count firing and resolved notifications table_block = TableBlock(headers=finding_summary_header + ["Fired", "Resolved"], rows=rows) summary_start_utc_dt = datetime.fromtimestamp(summary_start).astimezone(tz.UTC) @@ -434,8 +436,11 @@ def send_or_update_summary_message( f"*Group time range:* " f" to " ) + group_by_criteria_str = ", ".join(f"`header`" for header in group_by_classification_header) blocks = [ - MarkdownBlock("👀 Group summary for " + ", ".join(group_by_classification_header)), + MarkdownBlock("👀 Alert summary"), + MarkdownBlock(f"Total alerts: {n_total_alerts}"), + MarkdownBlock(f"Matching criteria: {group_by_criteria_str}"), LinksBlock( links=[ LinkProp(