-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(replay): move summary log parsing to a seer rpc #99547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
907bff3
f1d62db
38c1463
e1ce781
b5a42fb
4e9d46f
d1382f4
c17e43c
0bf1a5e
f21d7e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| from sentry.api.api_publish_status import ApiPublishStatus | ||
| from sentry.api.base import region_silo_endpoint | ||
| from sentry.api.bases.project import ProjectEndpoint, ProjectPermission | ||
| from sentry.api.utils import default_start_end_dates | ||
| from sentry.models.project import Project | ||
| from sentry.net.http import connection_from_url | ||
| from sentry.replays.lib.storage import storage | ||
|
|
@@ -21,7 +22,7 @@ | |
| from sentry.replays.usecases.summarize import ( | ||
| fetch_error_details, | ||
| fetch_trace_connected_errors, | ||
| get_summary_logs, | ||
| get_summary_logs_from_segments, | ||
| ) | ||
| from sentry.seer.seer_setup import has_seer_access | ||
| from sentry.seer.signed_seer_api import make_signed_seer_api_request | ||
|
|
@@ -196,6 +197,37 @@ def post(self, request: Request, project: Project, replay_id: str) -> Response: | |
| ) | ||
| num_segments = MAX_SEGMENTS_TO_SUMMARIZE | ||
|
|
||
| if features.has( | ||
| "organizations:replay-ai-summaries-rpc", project.organization, actor=request.user | ||
| ): | ||
| start, end = default_start_end_dates() | ||
| snuba_response = query_replay_instance( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i guess i'm confused why we have this call + also the other one
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to 404 early if the replay's missing, instead of making a seer task + db entry
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Colton is working on a more efficient existence check but hope this will do til then. Can test with the FF
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ohhh ok makes sense |
||
| project_id=project.id, | ||
| replay_id=replay_id, | ||
| start=start, | ||
| end=end, | ||
| organization=project.organization, | ||
| request_user_id=request.user.id, | ||
| ) | ||
| if not snuba_response: | ||
| return self.respond( | ||
| {"detail": "Replay not found."}, | ||
| status=404, | ||
| ) | ||
|
|
||
aliu39 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return self.make_seer_request( | ||
| SEER_START_TASK_ENDPOINT_PATH, | ||
| { | ||
| "logs": [], | ||
| "use_rpc": True, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Used to toggle code paths in seer (default false) |
||
| "num_segments": num_segments, | ||
| "replay_id": replay_id, | ||
| "organization_id": project.organization.id, | ||
| "project_id": project.id, | ||
| "temperature": temperature, | ||
| }, | ||
| ) | ||
|
|
||
| # Fetch the replay's error and trace IDs from the replay_id. | ||
| snuba_response = query_replay_instance( | ||
| project_id=project.id, | ||
|
|
@@ -256,7 +288,7 @@ def post(self, request: Request, project: Project, replay_id: str) -> Response: | |
| segment_data = iter_segment_data(segment_md) | ||
|
|
||
| # Combine replay and error data and parse into logs. | ||
| logs = get_summary_logs(segment_data, error_events, project.id) | ||
| logs = get_summary_logs_from_segments(segment_data, error_events, project.id) | ||
|
|
||
| # Post to Seer to start a summary task. | ||
| # XXX: Request isn't streaming. Limitation of Seer authentication. Would be much faster if we | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deciding to not support date params, imo it's not necessary. We don't pass these in from the frontend atm