1
1
from __future__ import annotations
2
2
3
3
import abc
4
+ from collections .abc import Callable , Sequence
5
+ from typing import Any , override
6
+
7
+ import sentry_sdk
4
8
5
9
from sentry import analytics
6
10
from sentry .eventstore .models import GroupEvent
12
16
from sentry .models .organization import OrganizationStatus
13
17
from sentry .models .rule import Rule
14
18
from sentry .rules .actions import EventAction
19
+ from sentry .rules .base import CallbackFuture
20
+ from sentry .types .rules import RuleFuture
15
21
16
22
INTEGRATION_KEY = "integration"
17
23
@@ -34,6 +40,22 @@ def provider(self) -> str:
34
40
def integration_key (self ) -> str :
35
41
pass
36
42
43
+ @override
44
+ def future (
45
+ self ,
46
+ callback : Callable [[GroupEvent , Sequence [RuleFuture ]], None ],
47
+ key : str | None = None ,
48
+ ** kwargs : Any ,
49
+ ) -> CallbackFuture :
50
+ def wrapped_callback (event : GroupEvent , futures : Sequence [RuleFuture ]) -> None :
51
+ with sentry_sdk .start_span (
52
+ op = "IntegrationEventAction.future" ,
53
+ name = type (self ).__name__ ,
54
+ ):
55
+ callback (event , futures )
56
+
57
+ return super ().future (wrapped_callback , key , ** kwargs )
58
+
37
59
def is_enabled (self ) -> bool :
38
60
enabled : bool = bool (self .get_integrations ())
39
61
return enabled
0 commit comments