diff --git a/src/sentry/middleware/integrations/integration_control.py b/src/sentry/middleware/integrations/integration_control.py index 1f722e78da4899..bec8ef53e48f30 100644 --- a/src/sentry/middleware/integrations/integration_control.py +++ b/src/sentry/middleware/integrations/integration_control.py @@ -2,7 +2,9 @@ import logging import re -from typing import Mapping, Type +from typing import Callable, Mapping, Type + +from django.http import HttpRequest, HttpResponse from sentry.silo import SiloMode @@ -46,10 +48,10 @@ class IntegrationControlMiddleware: parser.provider: parser for parser in ACTIVE_PARSERS } - def __init__(self, get_response): + def __init__(self, get_response: Callable[[], HttpResponse]): self.get_response = get_response - def _identify_provider(self, request) -> str | None: + def _identify_provider(self, request: HttpRequest) -> str | None: """ Parses the provider out of the request path e.g. `/extensions/slack/commands/` -> `slack` @@ -65,7 +67,7 @@ def _identify_provider(self, request) -> str | None: return None return result.group(1) - def _should_operate(self, request) -> bool: + def _should_operate(self, request: HttpRequest) -> bool: """ Determines whether this middleware will operate or just pass the request along. """ @@ -74,7 +76,7 @@ def _should_operate(self, request) -> bool: is_not_setup = not request.path.endswith(self.setup_suffix) return is_correct_silo and is_integration and is_not_setup - def __call__(self, request): + def __call__(self, request: HttpRequest): if not self._should_operate(request): return self.get_response(request) diff --git a/src/sentry_plugins/bitbucket/endpoints/webhook.py b/src/sentry_plugins/bitbucket/endpoints/webhook.py index a3cc78ac82f19a..abbbcbc820f54a 100644 --- a/src/sentry_plugins/bitbucket/endpoints/webhook.py +++ b/src/sentry_plugins/bitbucket/endpoints/webhook.py @@ -77,7 +77,7 @@ def __call__(self, organization, event): pass -class BitbucketWebhookEndpoint(View): +class BitbucketPluginWebhookEndpoint(View): _handlers = {"repo:push": PushEventWebhook} def get_handler(self, event_type): @@ -91,6 +91,10 @@ def dispatch(self, request: Request, *args, **kwargs) -> HttpResponse: return super().dispatch(request, *args, **kwargs) def post(self, request: Request, organization_id): + logger.error( + "bitbucket_plugin.deprecation_check", + extra={"organization_id": organization_id, "meta": request.META}, + ) try: organization = Organization.objects.get_from_cache(id=organization_id) except Organization.DoesNotExist: diff --git a/src/sentry_plugins/bitbucket/urls.py b/src/sentry_plugins/bitbucket/urls.py index 4d33a7ee3886c7..68c84ac2217990 100644 --- a/src/sentry_plugins/bitbucket/urls.py +++ b/src/sentry_plugins/bitbucket/urls.py @@ -1,10 +1,10 @@ from django.urls import re_path -from .endpoints.webhook import BitbucketWebhookEndpoint +from .endpoints.webhook import BitbucketPluginWebhookEndpoint urlpatterns = [ re_path( r"^organizations/(?P[^\/]+)/webhook/$", - BitbucketWebhookEndpoint.as_view(), + BitbucketPluginWebhookEndpoint.as_view(), ) ] diff --git a/src/sentry_plugins/github/urls.py b/src/sentry_plugins/github/urls.py index 4b22fe4f8c14ee..1213e07f35b37b 100644 --- a/src/sentry_plugins/github/urls.py +++ b/src/sentry_plugins/github/urls.py @@ -1,14 +1,14 @@ from django.urls import re_path -from .webhooks import GithubIntegrationsWebhookEndpoint, GithubWebhookEndpoint +from .webhooks import GithubPluginIntegrationsWebhookEndpoint, GithubPluginWebhookEndpoint urlpatterns = [ re_path( r"^organizations/(?P[^\/]+)/webhook/$", - GithubWebhookEndpoint.as_view(), + GithubPluginWebhookEndpoint.as_view(), ), re_path( r"^installations/webhook/$", - GithubIntegrationsWebhookEndpoint.as_view(), + GithubPluginIntegrationsWebhookEndpoint.as_view(), ), ] diff --git a/src/sentry_plugins/github/webhooks/__init__.py b/src/sentry_plugins/github/webhooks/__init__.py index e57fe0b3bfc0fe..e5bf6b2bf8b6f7 100644 --- a/src/sentry_plugins/github/webhooks/__init__.py +++ b/src/sentry_plugins/github/webhooks/__init__.py @@ -1,7 +1,7 @@ -from .integration import GithubIntegrationsWebhookEndpoint -from .non_integration import GithubWebhookEndpoint +from .integration import GithubPluginIntegrationsWebhookEndpoint +from .non_integration import GithubPluginWebhookEndpoint __all__ = ( - "GithubIntegrationsWebhookEndpoint", - "GithubWebhookEndpoint", + "GithubPluginIntegrationsWebhookEndpoint", + "GithubPluginWebhookEndpoint", ) diff --git a/src/sentry_plugins/github/webhooks/integration.py b/src/sentry_plugins/github/webhooks/integration.py index 729a9c99078fdc..865110085c29e4 100644 --- a/src/sentry_plugins/github/webhooks/integration.py +++ b/src/sentry_plugins/github/webhooks/integration.py @@ -1,5 +1,7 @@ from __future__ import annotations +import logging + from django.http import HttpResponse from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt @@ -11,8 +13,10 @@ from .base import GithubWebhookBase from .events import InstallationEventWebhook, InstallationRepositoryEventWebhook, PushEventWebhook +logger = logging.getLogger(__name__) + -class GithubIntegrationsWebhookEndpoint(GithubWebhookBase): +class GithubPluginIntegrationsWebhookEndpoint(GithubWebhookBase): _handlers = { "push": PushEventWebhook, "installation": InstallationEventWebhook, @@ -30,4 +34,8 @@ def get_secret(self, organization: Organization) -> str | None: return options.get("github.integration-hook-secret") def post(self, request: Request) -> HttpResponse: + logger.error( + "github_plugin.install.deprecation_check", + extra={"meta": request.META}, + ) return self.handle(request) diff --git a/src/sentry_plugins/github/webhooks/non_integration.py b/src/sentry_plugins/github/webhooks/non_integration.py index 31131578defb16..99c653af01162d 100644 --- a/src/sentry_plugins/github/webhooks/non_integration.py +++ b/src/sentry_plugins/github/webhooks/non_integration.py @@ -12,7 +12,7 @@ logger = logging.getLogger("sentry.webhooks") -class GithubWebhookEndpoint(GithubWebhookBase): +class GithubPluginWebhookEndpoint(GithubWebhookBase): def get_logging_data(self, organization): return {"organization_id": organization.id} @@ -22,6 +22,10 @@ def get_secret(self, organization: Organization) -> str | None: ) def post(self, request: Request, organization_id): + logger.error( + "github_plugin.webhook.deprecation_check", + extra={"organization_id": organization_id, "meta": request.META}, + ) try: organization = Organization.objects.get_from_cache(id=organization_id) except Organization.DoesNotExist: diff --git a/src/sentry_plugins/gitlab/plugin.py b/src/sentry_plugins/gitlab/plugin.py index ce5eb31c384aed..03b9f2cf24fb2a 100644 --- a/src/sentry_plugins/gitlab/plugin.py +++ b/src/sentry_plugins/gitlab/plugin.py @@ -18,20 +18,6 @@ class GitLabPlugin(CorePluginMixin, IssuePlugin2): conf_key = "gitlab" required_field = "gitlab_url" feature_descriptions = [ - FeatureDescription( - """ - Track commits and releases (learn more - [here](https://docs.sentry.io/learn/releases/)) - """, - IntegrationFeatures.COMMITS, - ), - FeatureDescription( - """ - Resolve Sentry issues via GitLab commits and merge requests by - including `Fixes PROJ-ID` in the message - """, - IntegrationFeatures.COMMITS, - ), FeatureDescription( """ Create GitLab issues from Sentry