Skip to content

Commit 3875ba1

Browse files
committed
Allow disabling the note for connecting Holmes
1 parent 5cdf45f commit 3875ba1

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/robusta/core/sinks/slack/slack_sink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ class SlackSink(SinkBase):
1111
params: SlackSinkParams
1212

1313
def __init__(self, sink_config: SlackSinkConfigWrapper, registry, is_preview=False):
14-
slack_sink_params = sink_config.get_params()
14+
slack_sink_params: SlackSinkParams = sink_config.get_params()
1515
super().__init__(slack_sink_params, registry)
1616
self.slack_channel = slack_sink_params.slack_channel
1717
self.api_key = slack_sink_params.api_key
1818
self.slack_sender = slack_module.SlackSender(
19-
self.api_key, self.account_id, self.cluster_name, self.signing_key, self.slack_channel, registry, is_preview
19+
self.api_key, self.account_id, self.cluster_name, self.signing_key, self.slack_channel, registry, is_preview, slack_sink_params.disable_holmes_note
2020
)
2121
self.registry.subscribe("replace_callback_with_string", self)
2222

src/robusta/core/sinks/slack/slack_sink_params.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class SlackSinkParams(SinkBaseParams):
1212
channel_override: Optional[str] = None
1313
max_log_file_limit_kb: int = 1000
1414
investigate_link: bool = True
15+
disable_holmes_note: bool = False
1516

1617
@classmethod
1718
def _supports_grouping(cls):

src/robusta/integrations/slack/sender.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SlackSender:
6161
verified_api_tokens: Set[str] = set()
6262
channel_name_to_id = {}
6363

64-
def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing_key: str, slack_channel: str, registry, is_preview: bool = False):
64+
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):
6565
"""
6666
Connect to Slack and verify that the Slack token is valid.
6767
Return True on success, False on failure
@@ -84,6 +84,7 @@ def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing
8484
self.account_id = account_id
8585
self.cluster_name = cluster_name
8686
self.is_preview = is_preview
87+
self.disable_holmes_note = disable_holmes_note
8788

8889
if slack_token not in self.verified_api_tokens:
8990
try:
@@ -743,9 +744,10 @@ def __send_finding_to_slack(
743744
blocks.append(DividerBlock())
744745

745746
is_holmes_slackbot_enabled = self.__is_holmes_slackbot_enabled()
746-
holmes_block = self.get_holmes_block(platform_enabled, is_holmes_slackbot_enabled)
747-
if holmes_block:
748-
blocks.append(holmes_block)
747+
if not self.disable_holmes_note:
748+
holmes_block = self.get_holmes_block(platform_enabled, is_holmes_slackbot_enabled)
749+
if holmes_block:
750+
blocks.append(holmes_block)
749751

750752

751753
if len(attachment_blocks):

0 commit comments

Comments
 (0)