Skip to content

Commit 662692a

Browse files
authored
Revert "feat(integration-slack): store request error counts and disable on broken (#52994)"
This reverts commit 75d6446.
1 parent e3b0973 commit 662692a

File tree

11 files changed

+9
-474
lines changed

11 files changed

+9
-474
lines changed

src/sentry/conf/server.py

-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def env(
112112
SENTRY_TRANSACTION_NAMES_REDIS_CLUSTER = "default"
113113
SENTRY_WEBHOOK_LOG_REDIS_CLUSTER = "default"
114114
SENTRY_ARTIFACT_BUNDLES_INDEXING_REDIS_CLUSTER = "default"
115-
SENTRY_INTEGRATION_ERROR_LOG_REDIS_CLUSTER = "default"
116115
SENTRY_DEBUG_FILES_REDIS_CLUSTER = "default"
117116

118117
# Hosts that are allowed to use system token authentication.
@@ -1342,8 +1341,6 @@ def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
13421341
"organizations:crons-timeline-listing-page": False,
13431342
# Enable usage of customer domains on the frontend
13441343
"organizations:customer-domains": False,
1345-
# Allow disabling integrations when broken is detected
1346-
"organizations:slack-disable-on-broken": False,
13471344
# Enable the 'discover' interface.
13481345
"organizations:discover": False,
13491346
# Enables events endpoint rate limit

src/sentry/features/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,8 @@
260260
default_manager.add("organizations:pr-comment-bot", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
261261
default_manager.add("organizations:ds-org-recalibration", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
262262
default_manager.add("organizations:slack-use-new-lookup", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
263-
default_manager.add("organizations:slack-disable-on-broken", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
264263
default_manager.add("organizations:sourcemaps-bundle-flat-file-indexing", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
265264

266-
267265
# Project scoped features
268266
default_manager.add("projects:alert-filters", ProjectFeature, FeatureHandlerStrategy.INTERNAL)
269267
default_manager.add("projects:custom-inbound-filters", ProjectFeature, FeatureHandlerStrategy.INTERNAL)

src/sentry/integrations/discord/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(
3737
org_integration_id = infer_org_integration(
3838
integration_id=integration_id, ctx_logger=logger
3939
)
40-
super().__init__(integration_id, org_integration_id, verify_ssl, logging_context)
40+
super().__init__(org_integration_id, verify_ssl, logging_context)
4141

4242
@control_silo_function
4343
def authorize_request(self, prepared_request: PreparedRequest) -> PreparedRequest:

src/sentry/integrations/request_buffer.py

-128
This file was deleted.

src/sentry/integrations/slack/client.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ def __init__(
3838
integration_id=self.integration_id, ctx_logger=logger
3939
)
4040

41-
super().__init__(
42-
org_integration_id=org_integration_id,
43-
verify_ssl=verify_ssl,
44-
integration_id=integration_id,
45-
logging_context=logging_context,
46-
)
41+
super().__init__(org_integration_id, verify_ssl, logging_context)
4742

4843
@control_silo_function
4944
def authorize_request(self, prepared_request: PreparedRequest) -> PreparedRequest:
@@ -62,19 +57,13 @@ def authorize_request(self, prepared_request: PreparedRequest) -> PreparedReques
6257
if not integration:
6358
logger.info("no_integration", extra={"path_url": prepared_request.path_url})
6459
return prepared_request
60+
6561
token = (
6662
integration.metadata.get("user_access_token") or integration.metadata["access_token"]
6763
)
6864
prepared_request.headers["Authorization"] = f"Bearer {token}"
6965
return prepared_request
7066

71-
def is_response_fatal(self, response: Response) -> bool:
72-
resp_json = response.json()
73-
if not resp_json.get("ok"):
74-
if "account_inactive" == resp_json.get("error", ""):
75-
return True
76-
return False
77-
7867
def track_response_data(
7968
self,
8069
code: Union[str, int],
@@ -85,6 +74,7 @@ def track_response_data(
8574
# if no span was passed, create a dummy to which to add data to avoid having to wrap every
8675
# span call in `if span`
8776
span = span or Span()
77+
8878
try:
8979
span.set_http_status(int(code))
9080
except ValueError:

src/sentry/integrations/slack/integration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SlackIntegration(SlackNotifyBasicMixin, IntegrationInstallation):
7777
def get_client(self) -> SlackClient:
7878
if not self.org_integration:
7979
raise IntegrationError("Organization Integration does not exist")
80-
return SlackClient(org_integration_id=self.org_integration.id, integration_id=self.model.id)
80+
return SlackClient(org_integration_id=self.org_integration.id)
8181

8282
def get_config_data(self) -> Mapping[str, str]:
8383
metadata_ = self.model.metadata

src/sentry/models/integrations/integration.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def get_provider(self) -> IntegrationProvider:
6868

6969
def delete(self, *args, **kwds):
7070
with outbox_context(
71-
transaction.atomic(using=router.db_for_write(OrganizationIntegration)), flush=False
71+
transaction.atomic(router.db_for_write(OrganizationIntegration)), flush=False
7272
):
7373
for organization_integration in self.organizationintegration_set.all():
7474
organization_integration.delete()
@@ -107,7 +107,7 @@ def add_organization(self, organization: RpcOrganization, user=None, default_aut
107107
from sentry.models import OrganizationIntegration
108108

109109
try:
110-
with transaction.atomic(using=router.db_for_write(OrganizationIntegration)):
110+
with transaction.atomic(router.db_for_write(OrganizationIntegration)):
111111
org_integration, created = OrganizationIntegration.objects.get_or_create(
112112
organization_id=organization.id,
113113
integration_id=self.id,
@@ -134,11 +134,3 @@ def add_organization(self, organization: RpcOrganization, user=None, default_aut
134134
},
135135
)
136136
return False
137-
138-
def disable(self):
139-
"""
140-
Disable this integration
141-
"""
142-
143-
self.update(status=ObjectStatus.DISABLED)
144-
self.save()

0 commit comments

Comments
 (0)