diff --git a/src/robusta/core/sinks/slack/slack_sink.py b/src/robusta/core/sinks/slack/slack_sink.py index 9c8bc4d27..2891a3578 100644 --- a/src/robusta/core/sinks/slack/slack_sink.py +++ b/src/robusta/core/sinks/slack/slack_sink.py @@ -11,12 +11,12 @@ class SlackSink(SinkBase): params: SlackSinkParams def __init__(self, sink_config: SlackSinkConfigWrapper, registry, is_preview=False): - slack_sink_params = sink_config.get_params() + slack_sink_params: SlackSinkParams = sink_config.get_params() super().__init__(slack_sink_params, registry) self.slack_channel = slack_sink_params.slack_channel self.api_key = slack_sink_params.api_key self.slack_sender = slack_module.SlackSender( - self.api_key, self.account_id, self.cluster_name, self.signing_key, self.slack_channel, registry, is_preview + self.api_key, self.account_id, self.cluster_name, self.signing_key, self.slack_channel, registry, is_preview, slack_sink_params.disable_holmes_note ) self.registry.subscribe("replace_callback_with_string", self) diff --git a/src/robusta/core/sinks/slack/slack_sink_params.py b/src/robusta/core/sinks/slack/slack_sink_params.py index 2badde2a6..ddaedf3a0 100644 --- a/src/robusta/core/sinks/slack/slack_sink_params.py +++ b/src/robusta/core/sinks/slack/slack_sink_params.py @@ -12,6 +12,7 @@ class SlackSinkParams(SinkBaseParams): channel_override: Optional[str] = None max_log_file_limit_kb: int = 1000 investigate_link: bool = True + disable_holmes_note: bool = False @classmethod def _supports_grouping(cls): diff --git a/src/robusta/integrations/slack/sender.py b/src/robusta/integrations/slack/sender.py index 5316a943b..ad757cb3c 100644 --- a/src/robusta/integrations/slack/sender.py +++ b/src/robusta/integrations/slack/sender.py @@ -61,7 +61,7 @@ class SlackSender: verified_api_tokens: Set[str] = set() channel_name_to_id = {} - def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing_key: str, slack_channel: str, registry, is_preview: bool = False): + def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing_key: str, slack_channel: str, registry, is_preview: bool = False, disable_holmes_note: bool = False): """ Connect to Slack and verify that the Slack token is valid. Return True on success, False on failure @@ -84,6 +84,7 @@ def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing self.account_id = account_id self.cluster_name = cluster_name self.is_preview = is_preview + self.disable_holmes_note = disable_holmes_note if slack_token not in self.verified_api_tokens: try: @@ -743,9 +744,10 @@ def __send_finding_to_slack( blocks.append(DividerBlock()) is_holmes_slackbot_enabled = self.__is_holmes_slackbot_enabled() - holmes_block = self.get_holmes_block(platform_enabled, is_holmes_slackbot_enabled) - if holmes_block: - blocks.append(holmes_block) + if not self.disable_holmes_note: + holmes_block = self.get_holmes_block(platform_enabled, is_holmes_slackbot_enabled) + if holmes_block: + blocks.append(holmes_block) if len(attachment_blocks):