Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

@cell_silo_endpoint
class OrganizationIssueMetricsEndpoint(OrganizationEndpoint):
owner = ApiOwner.REPLAY
Comment thread
cursor[bot] marked this conversation as resolved.
publish_status = {"GET": ApiPublishStatus.PRIVATE}
owner = ApiOwner.DATA_BROWSING

def get(self, request: Request, organization: Organization) -> Response:
"""Stats bucketed by time."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

@cell_silo_endpoint
class OrganizationIssueTimeSeriesEndpoint(OrganizationEndpoint):
owner = ApiOwner.REPLAY
owner = ApiOwner.DATA_BROWSING
publish_status = {"GET": ApiPublishStatus.PRIVATE}

def get(self, request: Request, organization: Organization) -> Response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class DataExportNotificationsEndpoint(Endpoint):
"""PubSub notifications endpoint."""

owner = ApiOwner.REPLAY
owner = ApiOwner.DATA_BROWSING
publish_status = {"POST": ApiPublishStatus.PRIVATE}
permission_classes = (SentryIsAuthenticated,)

Expand Down
2 changes: 0 additions & 2 deletions src/sentry/replays/endpoints/organization_replay_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from rest_framework.response import Response

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases import NoProjects
Expand Down Expand Up @@ -44,7 +43,6 @@ class OrganizationReplayCountEndpoint(OrganizationEventsEndpointBase):
then verify that they exist in the replays dataset, and return the count.
"""

owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PUBLIC,
}
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/replays/endpoints/organization_replay_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
)

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases.organization import NoProjects
Expand Down Expand Up @@ -224,7 +223,6 @@ class OrganizationReplayDetailsEndpoint(OrganizationReplayEndpoint):
organization that the user has access to.
"""

owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PUBLIC,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework.request import Request

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.models.organization import Organization
from sentry.replays.permissions import has_replay_permission
Expand All @@ -16,6 +17,8 @@ class OrganizationReplayEndpoint(OrganizationEndpoint):
role-based access control and feature flag-based access control.
"""

owner = ApiOwner.DATA_BROWSING

def check_replay_access(self, request: Request, organization: Organization) -> None:
"""
Check if the session replay feature is enabled and user has replay permissions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from rest_framework.response import Response

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases import NoProjects, OrganizationEventsEndpointBase
Expand All @@ -28,7 +27,6 @@ class OrganizationReplayEventsMetaEndpoint(OrganizationEventsEndpointBase):
This endpoint offers a narrow interface specific to the requirements of `useReplayData.tsx`
"""

owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PRIVATE,
}
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/replays/endpoints/organization_replay_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from rest_framework.request import Request
from rest_framework.response import Response

from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases.organization import NoProjects
Expand All @@ -29,7 +28,6 @@
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class OrganizationReplayIndexEndpoint(OrganizationReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PUBLIC,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
)
from snuba_sdk import Request as SnubaRequest

from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases.organization import NoProjects
Expand All @@ -35,13 +34,19 @@
from sentry.apidocs.utils import inline_sentry_response_serializer
from sentry.exceptions import InvalidSearchQuery
from sentry.models.organization import Organization
from sentry.replays.endpoints.organization_replay_endpoint import OrganizationReplayEndpoint
from sentry.replays.endpoints.organization_replay_endpoint import (
OrganizationReplayEndpoint,
)
from sentry.replays.lib.new_query.conditions import IntegerScalar
from sentry.replays.lib.new_query.fields import FieldProtocol, IntegerColumnField
from sentry.replays.lib.new_query.parsers import parse_int
from sentry.replays.query import make_pagination_values
from sentry.replays.usecases.errors import handled_snuba_exceptions
from sentry.replays.usecases.query import Paginators, handle_ordering, handle_search_filters
from sentry.replays.usecases.query import (
Paginators,
handle_ordering,
handle_search_filters,
)
from sentry.replays.validators import ReplaySelectorValidator
from sentry.utils.snuba import raw_snql_query

Expand Down Expand Up @@ -76,7 +81,6 @@ class ReplaySelectorResponse(TypedDict):
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class OrganizationReplaySelectorIndexEndpoint(OrganizationReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PUBLIC,
}
Expand Down Expand Up @@ -275,8 +279,16 @@ def query_selector_dataset(
Column("click_aria_label"),
Column("click_title"),
Column("click_component_name"),
Function("sum", parameters=[Column("click_is_dead")], alias="count_dead_clicks"),
Function("sum", parameters=[Column("click_is_rage")], alias="count_rage_clicks"),
Function(
"sum",
parameters=[Column("click_is_dead")],
alias="count_dead_clicks",
),
Function(
"sum",
parameters=[Column("click_is_rage")],
alias="count_rage_clicks",
),
],
where=where_conditions,
having=conditions,
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/replays/endpoints/project_replay_clicks_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
)
from snuba_sdk.orderby import Direction

from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.event_search import ParenExpression, QueryToken, SearchFilter, parse_search_query
Expand Down Expand Up @@ -58,7 +57,6 @@ class ReplayClickResponse(TypedDict):
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class ProjectReplayClicksIndexEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PUBLIC,
}
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/replays/endpoints/project_replay_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from rest_framework.response import Response

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases.project import ProjectPermission
Expand All @@ -31,7 +30,6 @@ class ReplayDetailsPermission(ProjectPermission):
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class ProjectReplayDetailsEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"DELETE": ApiPublishStatus.PUBLIC,
"GET": ApiPublishStatus.PRIVATE,
Expand Down
3 changes: 3 additions & 0 deletions src/sentry/replays/endpoints/project_replay_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework.request import Request

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.bases.project import ProjectEndpoint
from sentry.models.project import Project
from sentry.replays.permissions import has_replay_permission
Expand All @@ -16,6 +17,8 @@ class ProjectReplayEndpoint(ProjectEndpoint):
role-based access control and feature flag-based access control.
"""

owner = ApiOwner.DATA_BROWSING

def check_replay_access(self, request: Request, project: Project) -> None:
"""
Check if the session replay feature is enabled and user has replay permissions.
Expand Down
7 changes: 4 additions & 3 deletions src/sentry/replays/endpoints/project_replay_jobs_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ReplayDeletionJobCreateSerializer(serializers.Serializer):

@cell_silo_endpoint
class ProjectReplayDeletionJobsIndexEndpoint(ProjectEndpoint):
owner = ApiOwner.REPLAY
owner = ApiOwner.DATA_BROWSING
publish_status = {
"GET": ApiPublishStatus.PRIVATE,
"POST": ApiPublishStatus.PRIVATE,
Expand Down Expand Up @@ -133,7 +133,6 @@ def post(self, request: Request, project) -> Response:

@cell_silo_endpoint
class ProjectReplayDeletionJobDetailEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PRIVATE,
}
Expand All @@ -147,7 +146,9 @@ def get(self, request: Request, project, job_id: int) -> Response:

try:
job = ReplayDeletionJobModel.objects.get(
id=job_id, organization_id=project.organization_id, project_id=project.id
id=job_id,
organization_id=project.organization_id,
project_id=project.id,
)
except ReplayDeletionJobModel.DoesNotExist:
raise ResourceDoesNotExist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from drf_spectacular.utils import extend_schema
from rest_framework.request import Request

from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.apidocs.constants import RESPONSE_BAD_REQUEST, RESPONSE_FORBIDDEN, RESPONSE_NOT_FOUND
Expand All @@ -22,7 +21,6 @@
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class ProjectReplayRecordingSegmentDetailsEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PUBLIC,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from rest_framework.request import Request
from rest_framework.response import Response

from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.paginator import GenericOffsetPaginator
Expand All @@ -22,7 +21,6 @@
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class ProjectReplayRecordingSegmentIndexEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.PUBLIC,
}
Expand Down
14 changes: 9 additions & 5 deletions src/sentry/replays/endpoints/project_replay_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from rest_framework.response import Response

from sentry import features, options
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases.project import ProjectPermission
Expand Down Expand Up @@ -49,7 +48,6 @@ class ReplaySummaryPermission(ProjectPermission):
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class ProjectReplaySummaryEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.EXPERIMENTAL,
"POST": ApiPublishStatus.EXPERIMENTAL,
Expand All @@ -68,7 +66,9 @@ def __init__(self, **kw) -> None:
super().__init__(**kw)

def _make_seer_start_request(
self, body: ReplaySummaryStartRequest, viewer_context: SeerViewerContext | None = None
self,
body: ReplaySummaryStartRequest,
viewer_context: SeerViewerContext | None = None,
) -> Response:
"""Make a start-summary request to Seer with error handling."""
serialized = orjson.dumps(body)
Expand Down Expand Up @@ -112,7 +112,9 @@ def _make_seer_start_request(
return Response(data=response.json(), status=response.status)

def _make_seer_state_request(
self, body: ReplaySummaryStateRequest, viewer_context: SeerViewerContext | None = None
self,
body: ReplaySummaryStateRequest,
viewer_context: SeerViewerContext | None = None,
) -> Response:
"""Make a poll-state request to Seer with error handling."""
try:
Expand Down Expand Up @@ -146,7 +148,9 @@ def has_replay_summary_access(self, project: Project, request: Request) -> bool:
return (
features.has("organizations:session-replay", project.organization, actor=request.user)
and features.has(
"organizations:replay-ai-summaries", project.organization, actor=request.user
"organizations:replay-ai-summaries",
project.organization,
actor=request.user,
)
and has_seer_access(project.organization, actor=request.user)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from drf_spectacular.utils import extend_schema
from rest_framework.request import Request

from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.apidocs.constants import RESPONSE_BAD_REQUEST, RESPONSE_FORBIDDEN, RESPONSE_NOT_FOUND
Expand All @@ -32,7 +31,6 @@
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class ProjectReplayVideoDetailsEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.EXPERIMENTAL,
}
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/replays/endpoints/project_replay_viewed_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from rest_framework.request import Request
from rest_framework.response import Response

from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import cell_silo_endpoint
from sentry.api.bases.project import ProjectEventPermission
Expand Down Expand Up @@ -34,7 +33,6 @@ class ReplayViewedByResponse(TypedDict):
@cell_silo_endpoint
@extend_schema(tags=["Replays"])
class ProjectReplayViewedByEndpoint(ProjectReplayEndpoint):
owner = ApiOwner.REPLAY
publish_status = {"GET": ApiPublishStatus.PUBLIC, "POST": ApiPublishStatus.PRIVATE}
permission_classes = (ProjectEventPermission,)

Expand Down
Loading