File tree Expand file tree Collapse file tree 4 files changed +24
-6
lines changed
shared_integrations/client
tests/sentry/integrations/slack Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 264264default_manager .add ("organizations:ds-sliding-window" , OrganizationFeature , FeatureHandlerStrategy .INTERNAL )
265265default_manager .add ("organizations:ds-sliding-window-org" , OrganizationFeature , FeatureHandlerStrategy .INTERNAL )
266266default_manager .add ("organizations:ds-org-recalibration" , OrganizationFeature , FeatureHandlerStrategy .INTERNAL )
267- default_manager .add ("organizations:slack-disable-on-broken" , OrganizationFeature , FeatureHandlerStrategy .REMOTE )
267+ default_manager .add ("organizations:slack-fatal- disable-on-broken" , OrganizationFeature , FeatureHandlerStrategy .REMOTE )
268268default_manager .add ("organizations:sourcemaps-bundle-flat-file-indexing" , OrganizationFeature , FeatureHandlerStrategy .REMOTE )
269269default_manager .add ("organizations:recap-server" , OrganizationFeature , FeatureHandlerStrategy .INTERNAL )
270270default_manager .add ("organizations:detailed-alert-logging" , OrganizationFeature , FeatureHandlerStrategy .INTERNAL )
Original file line number Diff line number Diff line change @@ -39,6 +39,25 @@ def record_fatal(self):
3939 def record_timeout (self ):
4040 self ._add ("timeout" )
4141
42+ def is_integration_fatal_broken (self ):
43+ """
44+ Integration is broken if we have a fatal error
45+ Temporary fix to release disabling slack integrations with fatal errors
46+
47+ """
48+ broken_range_days_counts = self ._get_broken_range_from_buffer ()
49+
50+ days_fatal = []
51+
52+ for day_count in broken_range_days_counts :
53+ if int (day_count .get ("fatal_count" , 0 )) > 0 :
54+ days_fatal .append (day_count )
55+
56+ if len (days_fatal ) > 0 :
57+ return True
58+
59+ return False
60+
4261 def is_integration_broken (self ):
4362 """
4463 Integration is broken if we have 7 consecutive days of errors and no successes OR have a fatal error OR have > 1000 timeouts in a day
Original file line number Diff line number Diff line change @@ -481,9 +481,9 @@ def disable_integration(self, buffer) -> None:
481481 )
482482
483483 if (
484- features .has ("organizations:slack-disable-on-broken" , org )
484+ features .has ("organizations:slack-fatal- disable-on-broken" , org )
485485 and rpc_integration .provider == "slack"
486- ):
486+ ) and buffer . is_integration_fatal_broken () :
487487 integration_service .update_integration (
488488 integration_id = rpc_integration .id , status = ObjectStatus .DISABLED
489489 )
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def tearDown(self):
4848 self .resp .__exit__ (None , None , None )
4949
5050 @responses .activate
51- @with_feature ("organizations:slack-disable-on-broken" )
51+ @with_feature ("organizations:slack-fatal- disable-on-broken" )
5252 def test_fatal_and_disable_integration (self ):
5353 """
5454 fatal fast shut off with disable flag on, integration should be broken and disabled
@@ -73,7 +73,6 @@ def test_fatal_and_disable_integration(self):
7373 assert len (buffer ._get_all_from_buffer ()) == 0
7474
7575 @responses .activate
76- @with_feature ("organizations:disable-on-broken" )
7776 def test_email (self ):
7877 client = SlackClient (integration_id = self .integration .id )
7978 with self .tasks ():
@@ -145,7 +144,7 @@ def test_error_integration(self):
145144 assert buffer .is_integration_broken () is False
146145
147146 @responses .activate
148- @with_feature ("organizations:slack-disable-on-broken" )
147+ @with_feature ("organizations:slack-fatal- disable-on-broken" )
149148 def test_slow_integration_is_not_broken_or_disabled (self ):
150149 """
151150 slow test with disable flag on
You can’t perform that action at this time.
0 commit comments