Skip to content

Commit 9c9bfb6

Browse files
committedMar 19, 2025·
✨ feat: invoke all ticketing actions via the issue alert handlers
1 parent 52fc0c6 commit 9c9bfb6

File tree

1 file changed

+40
-7
lines changed
  • src/sentry/workflow_engine/handlers/action/notification

1 file changed

+40
-7
lines changed
 

‎src/sentry/workflow_engine/handlers/action/notification/handler.py

+40-7
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ def execute_via_group_type_registry(job: WorkflowJob, action: Action, detector:
5555

5656

5757
def execute_via_metric_alert_handler(job: WorkflowJob, action: Action, detector: Detector) -> None:
58-
# TODO(iamrajjoshi): Implement this, it should be used for the ticketing actions
59-
pass
58+
"""
59+
This exists so that all ticketing actions can use the same handler as issue alerts since thats the only way we can
60+
ensure that the same thread is used for the notification action.
61+
"""
62+
IssueAlertRegistryInvoker.handle_workflow_action(job, action, detector)
6063

6164

6265
class NotificationActionHandler(ActionHandler, ABC):
@@ -89,6 +92,36 @@ def execute(
8992
execute_via_group_type_registry(job, action, detector)
9093

9194

95+
class TicketingActionHandler(ActionHandler, ABC):
96+
config_schema = {
97+
"$schema": "https://json-schema.org/draft/2020-12/schema",
98+
"description": "The configuration schema for a Ticketing Action",
99+
"type": "object",
100+
"properties": {
101+
"target_identifier": {
102+
"type": ["null"],
103+
},
104+
"target_display": {
105+
"type": ["null"],
106+
},
107+
"target_type": {
108+
"type": ["integer"],
109+
"enum": [*ActionTarget],
110+
},
111+
},
112+
}
113+
114+
data_schema = {}
115+
116+
@staticmethod
117+
def execute(
118+
job: WorkflowJob,
119+
action: Action,
120+
detector: Detector,
121+
) -> None:
122+
execute_via_metric_alert_handler(job, action, detector)
123+
124+
92125
@action_handler_registry.register(Action.Type.DISCORD)
93126
class DiscordActionHandler(NotificationActionHandler):
94127
group = NotificationActionHandler.ActionGroup.NOTIFICATION
@@ -130,27 +163,27 @@ class PluginActionHandler(NotificationActionHandler):
130163

131164

132165
@action_handler_registry.register(Action.Type.GITHUB)
133-
class GithubActionHandler(NotificationActionHandler):
166+
class GithubActionHandler(TicketingActionHandler):
134167
group = NotificationActionHandler.ActionGroup.TICKET_CREATION
135168

136169

137170
@action_handler_registry.register(Action.Type.GITHUB_ENTERPRISE)
138-
class GithubEnterpriseActionHandler(NotificationActionHandler):
171+
class GithubEnterpriseActionHandler(TicketingActionHandler):
139172
group = NotificationActionHandler.ActionGroup.TICKET_CREATION
140173

141174

142175
@action_handler_registry.register(Action.Type.JIRA)
143-
class JiraActionHandler(NotificationActionHandler):
176+
class JiraActionHandler(TicketingActionHandler):
144177
group = NotificationActionHandler.ActionGroup.TICKET_CREATION
145178

146179

147180
@action_handler_registry.register(Action.Type.JIRA_SERVER)
148-
class JiraServerActionHandler(NotificationActionHandler):
181+
class JiraServerActionHandler(TicketingActionHandler):
149182
group = NotificationActionHandler.ActionGroup.TICKET_CREATION
150183

151184

152185
@action_handler_registry.register(Action.Type.AZURE_DEVOPS)
153-
class AzureDevopsActionHandler(NotificationActionHandler):
186+
class AzureDevopsActionHandler(TicketingActionHandler):
154187
group = NotificationActionHandler.ActionGroup.TICKET_CREATION
155188

156189

0 commit comments

Comments
 (0)
Please sign in to comment.