Skip to content

Commit b32d24a

Browse files
authored
Generate unique distinction for alert groups with broken templates / unrenderable distinction (#405)
* Generate unique distinction for alert groups with broken templates * insert_demo_uuid -> insert_random_uuid
1 parent eba799a commit b32d24a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

engine/apps/alerts/models/alert.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ def render_group_data(cls, alert_receive_channel, raw_request_data, is_demo=Fals
196196
if grouping_id_template is not None:
197197
group_distinction, _ = apply_jinja_template(grouping_id_template, raw_request_data)
198198

199-
# Insert demo uuid to prevent grouping of demo alerts.
200-
if is_demo:
201-
group_distinction = cls.insert_demo_uuid(group_distinction)
199+
# Insert random uuid to prevent grouping of demo alerts or alerts with group_distinction=None
200+
if is_demo or not group_distinction:
201+
group_distinction = cls.insert_random_uuid(group_distinction)
202202

203203
if group_distinction is not None:
204204
group_distinction = hashlib.md5(str(group_distinction).encode()).hexdigest()
@@ -224,7 +224,7 @@ def render_group_data(cls, alert_receive_channel, raw_request_data, is_demo=Fals
224224
)
225225

226226
@staticmethod
227-
def insert_demo_uuid(distinction):
227+
def insert_random_uuid(distinction):
228228
if distinction is not None:
229229
distinction += str(uuid4())
230230
else:

0 commit comments

Comments
 (0)