Skip to content

Commit

Permalink
ref: remove monitor checkin attachments backend
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile-sentry committed Jan 3, 2025
1 parent 7604cde commit f0917c1
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 537 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ module = [
"sentry.middleware.superuser",
"sentry.monitors.consumers.monitor_consumer",
"sentry.monitors.endpoints.base",
"sentry.monitors.endpoints.monitor_ingest_checkin_attachment",
"sentry.monitors.endpoints.organization_monitor_index",
"sentry.net.http",
"sentry.net.socket",
Expand Down
27 changes: 1 addition & 26 deletions src/sentry/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
from sentry.api.endpoints.source_map_debug_blue_thunder_edition import (
SourceMapDebugBlueThunderEditionEndpoint,
)
from sentry.api.utils import method_dispatch
from sentry.data_export.endpoints.data_export import DataExportEndpoint
from sentry.data_export.endpoints.data_export_details import DataExportDetailsEndpoint
from sentry.data_secrecy.api.waive_data_secrecy import WaiveDataSecrecyEndpoint
Expand Down Expand Up @@ -198,12 +197,6 @@
SourceMapDebugEndpoint,
TeamGroupsOldEndpoint,
)
from sentry.monitors.endpoints.monitor_ingest_checkin_attachment import (
MonitorIngestCheckinAttachmentEndpoint,
)
from sentry.monitors.endpoints.organization_monitor_checkin_attachment import (
OrganizationMonitorCheckInAttachmentEndpoint,
)
from sentry.monitors.endpoints.organization_monitor_checkin_index import (
OrganizationMonitorCheckInIndexEndpoint,
)
Expand All @@ -224,9 +217,6 @@
OrganizationMonitorScheduleSampleDataEndpoint,
)
from sentry.monitors.endpoints.organization_monitor_stats import OrganizationMonitorStatsEndpoint
from sentry.monitors.endpoints.project_monitor_checkin_attachment import (
ProjectMonitorCheckInAttachmentEndpoint,
)
from sentry.monitors.endpoints.project_monitor_checkin_index import (
ProjectMonitorCheckInIndexEndpoint,
)
Expand Down Expand Up @@ -1124,7 +1114,7 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
),
]

ORGANIZATION_URLS = [
ORGANIZATION_URLS: list[URLPattern | URLResolver] = [
re_path(
r"^$",
OrganizationIndexEndpoint.as_view(),
Expand Down Expand Up @@ -1716,16 +1706,6 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
OrganizationMonitorCheckInIndexEndpoint.as_view(),
name="sentry-api-0-organization-monitor-check-in-index",
),
re_path(
r"^(?P<organization_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/(?P<checkin_id>[^\/]+)/attachment/$",
method_dispatch(
GET=OrganizationMonitorCheckInAttachmentEndpoint.as_view(),
OPTIONS=OrganizationMonitorCheckInAttachmentEndpoint.as_view(),
POST=MonitorIngestCheckinAttachmentEndpoint.as_view(), # Legacy ingest endpoint
csrf_exempt=True,
),
name="sentry-api-0-organization-monitor-check-in-attachment",
),
re_path(
r"^(?P<organization_id_or_slug>[^\/]+)/group-search-views/$",
OrganizationGroupSearchViewsEndpoint.as_view(),
Expand Down Expand Up @@ -2741,11 +2721,6 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
ProjectStatisticalDetectors.as_view(),
name="sentry-api-0-project-statistical-detector",
),
re_path(
r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/(?P<checkin_id>[^\/]+)/attachment/$",
ProjectMonitorCheckInAttachmentEndpoint.as_view(),
name="sentry-api-0-project-monitor-check-in-attachment",
),
re_path(
r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/$",
ProjectMonitorDetailsEndpoint.as_view(),
Expand Down
27 changes: 1 addition & 26 deletions src/sentry/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

import sentry_sdk
from django.conf import settings
from django.http import HttpRequest, HttpResponseNotAllowed
from django.http import HttpRequest
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from rest_framework.exceptions import APIException, ParseError
from rest_framework.request import Request
from sentry_sdk import Scope
Expand Down Expand Up @@ -309,30 +308,6 @@ def generate_region_url(region_name: str | None = None) -> str:
return region_url_template.replace("{region}", region_name)


def method_dispatch(**dispatch_mapping):
"""
Dispatches an incoming request to a different handler based on the HTTP method
>>> re_path('^foo$', method_dispatch(POST = post_handler, GET = get_handler)))
"""

def invalid_method(request, *args, **kwargs):
return HttpResponseNotAllowed(dispatch_mapping.keys())

def dispatcher(request, *args, **kwargs):
handler = dispatch_mapping.get(request.method, invalid_method)
return handler(request, *args, **kwargs)

# This allows us to surface the mapping when iterating through the URL patterns
# Check `test_id_or_slug_path_params.py` for usage
dispatcher.dispatch_mapping = dispatch_mapping # type: ignore[attr-defined]

if dispatch_mapping.get("csrf_exempt"):
return csrf_exempt(dispatcher)

return dispatcher


def print_and_capture_handler_exception(
exception: Exception,
handler_context: Mapping[str, Any] | None = None,
Expand Down
45 changes: 0 additions & 45 deletions src/sentry/monitors/endpoints/base_monitor_checkin_attachment.py

This file was deleted.

186 changes: 0 additions & 186 deletions src/sentry/monitors/endpoints/monitor_ingest_checkin_attachment.py

This file was deleted.

This file was deleted.

Loading

0 comments on commit f0917c1

Please sign in to comment.