Skip to content

Commit

Permalink
ref(crons): Split processing_errors into 2 modules
Browse files Browse the repository at this point in the history
Splits out the errors from the manager. Removes the
CheckinProcessErrorsManager class (which had no state) and updated the
function names to be more clear
  • Loading branch information
evanpurkhiser committed May 13, 2024
1 parent 51d0f05 commit 9a897b8
Show file tree
Hide file tree
Showing 16 changed files with 369 additions and 365 deletions.
4 changes: 2 additions & 2 deletions src/sentry/monitors/consumers/monitor_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
MonitorLimitsExceeded,
MonitorType,
)
from sentry.monitors.processing_errors import (
from sentry.monitors.processing_errors.errors import (
CheckinValidationError,
ProcessingError,
ProcessingErrorType,
handle_processing_errors,
)
from sentry.monitors.processing_errors.manager import handle_processing_errors
from sentry.monitors.types import CheckinItem
from sentry.monitors.utils import (
get_new_timeout_at,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
from sentry.apidocs.parameters import GlobalParams
from sentry.apidocs.utils import inline_sentry_response_serializer
from sentry.models.organization import Organization
from sentry.monitors.processing_errors import (
CheckinProcessErrorsManager,
CheckinProcessingErrorData,
)
from sentry.monitors.processing_errors.errors import CheckinProcessingErrorData
from sentry.monitors.processing_errors.manager import get_errors_for_projects
from sentry.utils.auth import AuthenticatedHttpRequest


Expand Down Expand Up @@ -46,9 +44,7 @@ def get(self, request: AuthenticatedHttpRequest, organization: Organization) ->
Retrieves checkin processing errors for a monitor
"""
projects = self.get_projects(request, organization)
paginator = SequencePaginator(
list(enumerate(CheckinProcessErrorsManager().get_for_projects(projects)))
)
paginator = SequencePaginator(list(enumerate(get_errors_for_projects(projects))))

return self.paginate(
request=request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
from sentry.apidocs.constants import RESPONSE_FORBIDDEN, RESPONSE_NOT_FOUND, RESPONSE_UNAUTHORIZED
from sentry.apidocs.parameters import GlobalParams, MonitorParams
from sentry.apidocs.utils import inline_sentry_response_serializer
from sentry.monitors.processing_errors import (
CheckinProcessErrorsManager,
CheckinProcessingErrorData,
)
from sentry.monitors.processing_errors.errors import CheckinProcessingErrorData
from sentry.monitors.processing_errors.manager import get_errors_for_monitor
from sentry.utils.auth import AuthenticatedHttpRequest

from .base import ProjectMonitorEndpoint
Expand Down Expand Up @@ -46,9 +44,7 @@ def get(self, request: AuthenticatedHttpRequest, project, monitor) -> Response:
"""
Retrieves checkin processing errors for a monitor
"""
paginator = SequencePaginator(
list(enumerate(CheckinProcessErrorsManager().get_for_monitor(monitor)))
)
paginator = SequencePaginator(list(enumerate(get_errors_for_monitor(monitor))))

return self.paginate(
request=request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)
from sentry.apidocs.parameters import GlobalParams, MonitorParams
from sentry.models.project import Project
from sentry.monitors.processing_errors import CheckinProcessErrorsManager, InvalidProjectError
from sentry.monitors.processing_errors.manager import InvalidProjectError, delete_error

from .base import ProjectMonitorPermission

Expand Down Expand Up @@ -55,7 +55,7 @@ def delete(self, request: Request, project: Project, uuid: str) -> Response:
except ValueError:
raise ValidationError("Invalid UUID")
try:
CheckinProcessErrorsManager().delete(project, parsed_uuid)
delete_error(project, parsed_uuid)
except InvalidProjectError:
raise ValidationError("Invalid uuid for project")
return self.respond(status=204)
248 changes: 0 additions & 248 deletions src/sentry/monitors/processing_errors.py

This file was deleted.

Loading

0 comments on commit 9a897b8

Please sign in to comment.