Skip to content

Conversation

@aliu39
Copy link
Member

@aliu39 aliu39 commented Nov 12, 2025

Supports replay ID prefix -> full ID lookup, for Seer explorer tools. This filter doesn't make use of the replay_id index and isn't very efficient. However we

  • only select the first row and return its full ID
  • use the 14d sliding window approach we're doing for trace
  • only plan to use it for explorer for now (low volume, unreleased UI feature)

The agent is instructed to always provide the full ID and/or project ID when known, which improves performance.

--(Outdated, used to do the prefix filter on the aggregate query)--

Tested a 14d range in snuba admin for sentry prod (project id 11276). Execution time < 60ms, quota_used":167443648,"quota_unit":"bytes"

MATCH (replays) SELECT anyIf(environment, notEmpty(environment)) AS `agg_environment`,
anyIf(project_id, equals(segment_id, 0)) AS `agg_project_id`,
max(timestamp) AS `finished_at`, 
ifNull(max(is_archived), 0) AS `isArchived`
BY replay_id 
WHERE project_id IN array(11276)
AND startsWith(toString(replay_id), '83527f1f') = 1
AND timestamp >= toDateTime('2025-10-29T19:44:48.827974') 
AND timestamp < toDateTime('2025-11-12T21:44:48.827974') 
HAVING min(segment_id) = 0
LIMIT 1 
GRANULARITY 3600

@aliu39 aliu39 requested review from a team as code owners November 12, 2025 21:55
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 12, 2025
Copy link
Member

@roaga roaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ai stuff looks fine to me, defer to replay team on queries

@codecov
Copy link

codecov bot commented Nov 12, 2025

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
29634 5 29629 243
View the top 3 failed test(s) by shortest run time
tests.sentry.seer.explorer.test_tools.TestGetIssueDetails::test_get_issue_details_success_short_id
Stack Traces | 15.8s run time
#x1B[1m#x1B[.../seer/explorer/test_tools.py#x1B[0m:747: in test_get_issue_details_success_short_id
    self._test_get_issue_details_success(use_short_id=True)
#x1B[1m#x1B[.../hostedtoolcache/Python/3.13.1.../x64/lib/python3.13/unittest/mock.py#x1B[0m:1424: in patched
    return func(*newargs, **newkeywargs)
#x1B[1m#x1B[.../seer/explorer/test_tools.py#x1B[0m:713: in _test_get_issue_details_success
    self._IssueMetadata.parse_obj(result["issue"])
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:532: in pydantic.main.BaseModel.parse_obj
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:345: in pydantic.main.BaseModel.__init__
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:1080: in pydantic.main.validate_model
    ???
#x1B[1m#x1B[31mpydantic/fields.py#x1B[0m:857: in pydantic.fields.ModelField.validate
    ???
#x1B[1m#x1B[31mE   pydantic.errors.ConfigError: field "project" not yet prepared so type is still a ForwardRef, you might need to call _IssueMetadata.update_forward_refs().#x1B[0m
tests.sentry.seer.explorer.test_tools.TestGetIssueDetails::test_get_issue_details_with_assigned_user
Stack Traces | 16.1s run time
#x1B[1m#x1B[.../seer/explorer/test_tools.py#x1B[0m:852: in test_get_issue_details_with_assigned_user
    md = self._IssueMetadata.parse_obj(result["issue"])
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:532: in pydantic.main.BaseModel.parse_obj
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:345: in pydantic.main.BaseModel.__init__
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:1080: in pydantic.main.validate_model
    ???
#x1B[1m#x1B[31mpydantic/fields.py#x1B[0m:857: in pydantic.fields.ModelField.validate
    ???
#x1B[1m#x1B[31mE   pydantic.errors.ConfigError: field "project" not yet prepared so type is still a ForwardRef, you might need to call _IssueMetadata.update_forward_refs().#x1B[0m
tests.sentry.seer.explorer.test_tools.TestGetIssueDetails::test_get_issue_details_with_assigned_team
Stack Traces | 18.1s run time
#x1B[1m#x1B[.../seer/explorer/test_tools.py#x1B[0m:880: in test_get_issue_details_with_assigned_team
    md = self._IssueMetadata.parse_obj(result["issue"])
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:532: in pydantic.main.BaseModel.parse_obj
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:345: in pydantic.main.BaseModel.__init__
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:1080: in pydantic.main.validate_model
    ???
#x1B[1m#x1B[31mpydantic/fields.py#x1B[0m:857: in pydantic.fields.ModelField.validate
    ???
#x1B[1m#x1B[31mE   pydantic.errors.ConfigError: field "project" not yet prepared so type is still a ForwardRef, you might need to call _IssueMetadata.update_forward_refs().#x1B[0m
tests.sentry.seer.explorer.test_tools.TestGetIssueDetails::test_get_issue_details_success_int_id
Stack Traces | 19.2s run time
#x1B[1m#x1B[.../seer/explorer/test_tools.py#x1B[0m:744: in test_get_issue_details_success_int_id
    self._test_get_issue_details_success(use_short_id=False)
#x1B[1m#x1B[.../hostedtoolcache/Python/3.13.1.../x64/lib/python3.13/unittest/mock.py#x1B[0m:1424: in patched
    return func(*newargs, **newkeywargs)
#x1B[1m#x1B[.../seer/explorer/test_tools.py#x1B[0m:713: in _test_get_issue_details_success
    self._IssueMetadata.parse_obj(result["issue"])
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:532: in pydantic.main.BaseModel.parse_obj
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:345: in pydantic.main.BaseModel.__init__
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:1080: in pydantic.main.validate_model
    ???
#x1B[1m#x1B[31mpydantic/fields.py#x1B[0m:857: in pydantic.fields.ModelField.validate
    ???
#x1B[1m#x1B[31mE   pydantic.errors.ConfigError: field "project" not yet prepared so type is still a ForwardRef, you might need to call _IssueMetadata.update_forward_refs().#x1B[0m
tests.sentry.seer.explorer.test_tools.TestGetIssueDetails::test_get_issue_details_tags_exception
Stack Traces | 19.7s run time
#x1B[1m#x1B[.../seer/explorer/test_tools.py#x1B[0m:825: in test_get_issue_details_tags_exception
    self._IssueMetadata.parse_obj(result.get("issue", {}))
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:532: in pydantic.main.BaseModel.parse_obj
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:345: in pydantic.main.BaseModel.__init__
    ???
#x1B[1m#x1B[31mpydantic/main.py#x1B[0m:1080: in pydantic.main.validate_model
    ???
#x1B[1m#x1B[31mpydantic/fields.py#x1B[0m:857: in pydantic.fields.ModelField.validate
    ???
#x1B[1m#x1B[31mE   pydantic.errors.ConfigError: field "project" not yet prepared so type is still a ForwardRef, you might need to call _IssueMetadata.update_forward_refs().#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Member

@JoshFerge JoshFerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's try and figure out a way to pass in the full ID -- ideally we could avoid this complexity


select = select_from_fields(fields, user_id=request_user_id)

return Query(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we potentially do a pre-query to only look at the replay id? but no worries if you want to leave it as is

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah makes sense we can! in fact I could refactor this so the util is just a short ID lookup, don't want people calling the inefficient aggregate query

Copy link
Member

@JoshFerge JoshFerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a big TODO on this one and the trace one to optimize and/or figure out how to pass in full ids! :D

@aliu39 aliu39 merged commit dce7ce2 into master Nov 14, 2025
66 checks passed
@aliu39 aliu39 deleted the aliu/replay-shortid branch November 14, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants