Skip to content

Commit 4ef7cd4

Browse files
Merge branch 'master' into vm-integration-update
2 parents 03e31b4 + 7ed76b5 commit 4ef7cd4

6 files changed

Lines changed: 47 additions & 22 deletions

File tree

docs/configuration/holmesgpt/toolsets/aws.rst

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,7 @@ Configuration
7474

7575
.. md-tab-item:: Robusta Helm Chart
7676

77-
.. code-block:: yaml
78-
79-
holmes:
80-
additionalEnvVars:
81-
- name: AWS_ACCESS_KEY_ID
82-
value: AKIXDDDSDSdSA
83-
- name: AWS_SECRET_ACCESS_KEY
84-
value: =wJalrXUtnFEMI/KNG/bPxRfiCYEXAMPLEKEY
85-
- name: AWS_DEFAULT_REGION
86-
value: us-west-2
87-
toolsets:
88-
aws/rds:
89-
enabled: true
90-
91-
.. include:: ./_toolset_configuration.inc.rst
77+
This builtin toolset is currently only available in HolmesGPT CLI.
9278

9379
.. md-tab-item:: Holmes CLI
9480

docs/playbook-reference/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
automatic-remediation-examples/index
1313
prometheus-examples/index
1414
kubernetes-examples/index
15-
logs-triggers/index
15+
Log Based Alerting <logs-triggers/index>

docs/playbook-reference/logs-triggers/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
Automate Responses to Application Logs
2-
==========================================
1+
:hide-toc:
2+
3+
Log-based alerting and auto-remediation with fluentbit, prometheus, and robusta
4+
==================================================================================
35

46
This tutorial walks you through building an automation that detects specific patterns in Kubernetes pod logs and responds automatically.
57

src/robusta/integrations/slack/sender.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
import ssl
44
import tempfile
5+
import re
56
from datetime import datetime, timedelta
67
from itertools import chain
78
from typing import Any, Dict, List, Optional, Set
@@ -52,6 +53,7 @@
5253
ACTION_LINK = "link"
5354
SlackBlock = Dict[str, Any]
5455
MAX_BLOCK_CHARS = 3000
56+
MENTION_PATTERN = re.compile(r"<[^>]+>")
5557

5658

5759
class SlackSender:
@@ -407,10 +409,25 @@ def __create_holmes_callback(self, finding: Finding) -> CallbackBlock:
407409
}
408410
)
409411

412+
@staticmethod
413+
def extract_mentions(title) -> (str, str):
414+
mentions = MENTION_PATTERN.findall(title)
415+
416+
mention = ""
417+
if mentions:
418+
mention = " " + " ".join(mentions)
419+
title = MENTION_PATTERN.sub("", title).strip()
420+
421+
return title, mention
422+
423+
410424
def __create_finding_header(
411425
self, finding: Finding, status: FindingStatus, platform_enabled: bool, include_investigate_link: bool
412426
) -> MarkdownBlock:
413427
title = finding.title.removeprefix("[RESOLVED] ")
428+
429+
title, mention = self.extract_mentions(title)
430+
414431
sev = finding.severity
415432
if finding.source == FindingSource.PROMETHEUS:
416433
status_name: str = (
@@ -426,7 +443,7 @@ def __create_finding_header(
426443
title = f"<{finding.get_investigate_uri(self.account_id, self.cluster_name)}|*{title}*>"
427444
return MarkdownBlock(
428445
f"""{status_name} {sev.to_emoji()} *{sev.name.capitalize()}*
429-
{title}"""
446+
{title}{mention}"""
430447
)
431448

432449
def __create_links(

src/robusta/runner/telemetry_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def __init__(self, endpoint: str, periodic_time_sec: float, registry: Registry):
3434
try:
3535
sentry_sdk.init(
3636
SENTRY_DSN,
37-
enable_tracing=True,
38-
traces_sample_rate=0.01,
39-
profiles_sample_rate=0.01,
37+
enable_tracing=False,
38+
traces_sample_rate=0,
39+
profiles_sample_rate=0,
4040
release=RUNNER_VERSION,
4141
integrations=[
4242
ThreadingIntegration(propagate_scope=True),

tests/slack/test_slack_mentions.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from robusta.integrations.slack import SlackSender
2+
3+
4+
def test_title_without_mentions():
5+
title = "Title with no mentions"
6+
new_title, mention = SlackSender.extract_mentions(title)
7+
assert new_title == title
8+
assert mention == ""
9+
10+
def test_title_with_single_mention():
11+
title = "Title with single mention <@U024BE7LH>"
12+
new_title, mention = SlackSender.extract_mentions(title)
13+
assert new_title == "Title with single mention"
14+
assert mention == " <@U024BE7LH>"
15+
16+
def test_title_with_two_mentions():
17+
title = "Title with <@U024BE7LG> two mentions <@U024BE7LH>"
18+
new_title, mention = SlackSender.extract_mentions(title)
19+
assert new_title == "Title with two mentions"
20+
assert mention == " <@U024BE7LG> <@U024BE7LH>"

0 commit comments

Comments
 (0)