From e34bc249c4f7a5845e960b9e95c73900031193f4 Mon Sep 17 00:00:00 2001 From: cliffordxing Date: Wed, 12 Nov 2025 15:55:47 -0800 Subject: [PATCH 1/5] Adding new Flag for EAP Query --- src/sentry/features/temporary.py | 2 ++ .../endpoints/organization_replay_details.py | 27 +++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/sentry/features/temporary.py b/src/sentry/features/temporary.py index 10b738bebd2c79..d3c3d937aceab9 100644 --- a/src/sentry/features/temporary.py +++ b/src/sentry/features/temporary.py @@ -361,6 +361,8 @@ def register_temporary_features(manager: FeatureManager) -> None: manager.add("organizations:replay-ai-summaries-mobile", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True) # Enable replay AI summaries for web replays manager.add("organizations:replay-ai-summaries", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True) + # Enable reading replay details using EAP query + manager.add("organizations:replay-details-eap-query", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False) # Enable version 2 of release serializer manager.add("organizations:releases-serializer-v2", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True) # Enable version 2 of reprocessing (completely distinct from v1) diff --git a/src/sentry/replays/endpoints/organization_replay_details.py b/src/sentry/replays/endpoints/organization_replay_details.py index 25004500097f44..9dcef93d9f0c9e 100644 --- a/src/sentry/replays/endpoints/organization_replay_details.py +++ b/src/sentry/replays/endpoints/organization_replay_details.py @@ -159,14 +159,25 @@ def get(self, request: Request, organization: Organization, replay_id: str) -> R projects = self.get_projects(request, organization, include_all_accessible=True) project_ids = [project.id for project in projects] - snuba_response = query_replay_instance( - project_id=project_ids, - replay_id=replay_id, - start=filter_params["start"], - end=filter_params["end"], - organization=organization, - request_user_id=request.user.id, - ) + # Use EAP query if feature flag is enabled + if features.has("organizations:replay-details-eap-query", organization): + snuba_response = query_replay_instance_eap( + project_ids=project_ids, + replay_ids=[replay_id], + start=filter_params["start"], + end=filter_params["end"], + organization_id=organization.id, + request_user_id=request.user.id, + ) + else: + snuba_response = query_replay_instance( + project_id=project_ids, + replay_id=replay_id, + start=filter_params["start"], + end=filter_params["end"], + organization=organization, + request_user_id=request.user.id, + ) response = process_raw_response( snuba_response, From b16685a84587f8f0c8bb54224dfe699839cc0d67 Mon Sep 17 00:00:00 2001 From: cliffordxing Date: Thu, 13 Nov 2025 09:22:50 -0800 Subject: [PATCH 2/5] adding data field --- src/sentry/replays/endpoints/organization_replay_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/replays/endpoints/organization_replay_details.py b/src/sentry/replays/endpoints/organization_replay_details.py index 9dcef93d9f0c9e..43a33623a33277 100644 --- a/src/sentry/replays/endpoints/organization_replay_details.py +++ b/src/sentry/replays/endpoints/organization_replay_details.py @@ -168,7 +168,7 @@ def get(self, request: Request, organization: Organization, replay_id: str) -> R end=filter_params["end"], organization_id=organization.id, request_user_id=request.user.id, - ) + )["data"] else: snuba_response = query_replay_instance( project_id=project_ids, From b56871085bce118bce37037e61d41107e6e1fdbd Mon Sep 17 00:00:00 2001 From: cliffordxing Date: Thu, 13 Nov 2025 10:34:52 -0800 Subject: [PATCH 3/5] updated typing --- src/sentry/replays/endpoints/organization_replay_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/replays/endpoints/organization_replay_details.py b/src/sentry/replays/endpoints/organization_replay_details.py index 43a33623a33277..d34c980f8152e0 100644 --- a/src/sentry/replays/endpoints/organization_replay_details.py +++ b/src/sentry/replays/endpoints/organization_replay_details.py @@ -30,7 +30,7 @@ def query_replay_instance_eap( start: datetime, end: datetime, organization_id: int, - request_user_id: int, + request_user_id: int | None, referrer: str = "replays.query.details_query", ): select = [ From 5fa52f480d5348207c9c727a0db2c323a6726eca Mon Sep 17 00:00:00 2001 From: cliffordxing Date: Thu, 13 Nov 2025 12:49:38 -0800 Subject: [PATCH 4/5] request id type change --- src/sentry/replays/endpoints/organization_replay_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/replays/endpoints/organization_replay_details.py b/src/sentry/replays/endpoints/organization_replay_details.py index d34c980f8152e0..43a33623a33277 100644 --- a/src/sentry/replays/endpoints/organization_replay_details.py +++ b/src/sentry/replays/endpoints/organization_replay_details.py @@ -30,7 +30,7 @@ def query_replay_instance_eap( start: datetime, end: datetime, organization_id: int, - request_user_id: int | None, + request_user_id: int, referrer: str = "replays.query.details_query", ): select = [ From e3a3185581b40be88c3113d41f1a31c0341d9f99 Mon Sep 17 00:00:00 2001 From: cliffordxing Date: Mon, 17 Nov 2025 09:55:49 -0800 Subject: [PATCH 5/5] typing --- src/sentry/replays/endpoints/organization_replay_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/replays/endpoints/organization_replay_details.py b/src/sentry/replays/endpoints/organization_replay_details.py index 43a33623a33277..d34c980f8152e0 100644 --- a/src/sentry/replays/endpoints/organization_replay_details.py +++ b/src/sentry/replays/endpoints/organization_replay_details.py @@ -30,7 +30,7 @@ def query_replay_instance_eap( start: datetime, end: datetime, organization_id: int, - request_user_id: int, + request_user_id: int | None, referrer: str = "replays.query.details_query", ): select = [