5
5
from dataclasses import asdict
6
6
from typing import Any , NotRequired , TypedDict
7
7
8
- import sentry_sdk
9
-
10
8
from sentry import features
11
9
from sentry .constants import ObjectStatus
12
10
from sentry .incidents .grouptype import MetricIssueEvidenceData
@@ -207,16 +205,13 @@ def get_rule_futures(
207
205
This method will collect the futures from the activate_downstream_actions method.
208
206
Based off of rule_processor.apply in rules/processing/processor.py
209
207
"""
210
- with sentry_sdk .start_span (
211
- op = "workflow_engine.handlers.action.notification.issue_alert.invoke_legacy_registry.activate_downstream_actions"
212
- ):
213
- if not isinstance (event_data .event , GroupEvent ):
214
- raise ValueError (
215
- f"WorkflowEventData.event expected GroupEvent, but received: { type (event_data .event ).__name__ } "
216
- )
208
+ if not isinstance (event_data .event , GroupEvent ):
209
+ raise ValueError (
210
+ f"WorkflowEventData.event expected GroupEvent, but received: { type (event_data .event ).__name__ } "
211
+ )
217
212
218
- grouped_futures = activate_downstream_actions (rule , event_data .event , notification_uuid )
219
- return grouped_futures .values ()
213
+ grouped_futures = activate_downstream_actions (rule , event_data .event , notification_uuid )
214
+ return grouped_futures .values ()
220
215
221
216
@staticmethod
222
217
def execute_futures (
@@ -229,16 +224,13 @@ def execute_futures(
229
224
This method will execute the futures.
230
225
Based off of process_rules in post_process.py
231
226
"""
232
- with sentry_sdk .start_span (
233
- op = "workflow_engine.handlers.action.notification.issue_alert.execute_futures"
234
- ):
235
- if not isinstance (event_data .event , GroupEvent ):
236
- raise ValueError (
237
- "WorkflowEventData.event is not a GroupEvent when evaluating issue alerts"
238
- )
227
+ if not isinstance (event_data .event , GroupEvent ):
228
+ raise ValueError (
229
+ "WorkflowEventData.event is not a GroupEvent when evaluating issue alerts"
230
+ )
239
231
240
- for callback , future in futures :
241
- safe_execute (callback , event_data .event , future )
232
+ for callback , future in futures :
233
+ safe_execute (callback , event_data .event , future )
242
234
243
235
@staticmethod
244
236
def send_test_notification (
@@ -256,11 +248,8 @@ def send_test_notification(
256
248
"WorkflowEventData.event is not a GroupEvent when sending test notification"
257
249
)
258
250
259
- with sentry_sdk .start_span (
260
- op = "workflow_engine.handlers.action.notification.issue_alert.execute_futures"
261
- ):
262
- for callback , future in futures :
263
- callback (event_data .event , future )
251
+ for callback , future in futures :
252
+ callback (event_data .event , future )
264
253
265
254
@classmethod
266
255
def invoke_legacy_registry (
@@ -276,38 +265,34 @@ def invoke_legacy_registry(
276
265
2. activate_downstream_actions
277
266
3. execute_futures (also in post_process process_rules)
278
267
"""
268
+ # Create a notification uuid
269
+ notification_uuid = str (uuid .uuid4 ())
279
270
280
- with sentry_sdk .start_span (
281
- op = "workflow_engine.handlers.action.notification.issue_alert.invoke_legacy_registry"
282
- ):
283
- # Create a notification uuid
284
- notification_uuid = str (uuid .uuid4 ())
285
-
286
- # Create a rule
287
- rule = cls .create_rule_instance_from_action (action , detector , event_data )
288
-
289
- logger .info (
290
- "notification_action.execute_via_issue_alert_handler" ,
291
- extra = {
292
- "action_id" : action .id ,
293
- "detector_id" : detector .id ,
294
- "event_data" : asdict (event_data ),
295
- "rule_id" : rule .id ,
296
- "rule_project_id" : rule .project .id ,
297
- "rule_environment_id" : rule .environment_id ,
298
- "rule_label" : rule .label ,
299
- "rule_data" : rule .data ,
300
- },
301
- )
302
- # Get the futures
303
- futures = cls .get_rule_futures (event_data , rule , notification_uuid )
271
+ # Create a rule
272
+ rule = cls .create_rule_instance_from_action (action , detector , event_data )
304
273
305
- # Execute the futures
306
- # If the rule id is -1, we are sending a test notification
307
- if rule .id == TEST_NOTIFICATION_ID :
308
- cls .send_test_notification (event_data , futures )
309
- else :
310
- cls .execute_futures (event_data , futures )
274
+ logger .info (
275
+ "notification_action.execute_via_issue_alert_handler" ,
276
+ extra = {
277
+ "action_id" : action .id ,
278
+ "detector_id" : detector .id ,
279
+ "event_data" : asdict (event_data ),
280
+ "rule_id" : rule .id ,
281
+ "rule_project_id" : rule .project .id ,
282
+ "rule_environment_id" : rule .environment_id ,
283
+ "rule_label" : rule .label ,
284
+ "rule_data" : rule .data ,
285
+ },
286
+ )
287
+ # Get the futures
288
+ futures = cls .get_rule_futures (event_data , rule , notification_uuid )
289
+
290
+ # Execute the futures
291
+ # If the rule id is -1, we are sending a test notification
292
+ if rule .id == TEST_NOTIFICATION_ID :
293
+ cls .send_test_notification (event_data , futures )
294
+ else :
295
+ cls .execute_futures (event_data , futures )
311
296
312
297
313
298
class TicketingIssueAlertHandler (BaseIssueAlertHandler ):
0 commit comments