Skip to content

Commit cbbefb3

Browse files
committed
Replace @ in events to avoid notifying @mentions
When using Ansible to create Datadog monitors, the events we create here could contain @mentions meant to appear in the monitor message. That can cause teams meant to be notified when the monitor goes off to be notified when the monitor is created, because of the event containging an @mention. This replaces @mentions with (@)mentions, preventing the notification.
1 parent 39f844c commit cbbefb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

datadog_callback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _send_event(self, title, alert_type=None, text=None, tags=None, host=None, e
8282
try:
8383
datadog.api.Event.create(
8484
title=title,
85-
text=text,
85+
text=text.replace('@','(@)'), # avoid notifying @ mentions
8686
alert_type=alert_type,
8787
priority=priority,
8888
tags=tags,

0 commit comments

Comments
 (0)