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
feat(replays): add public API endpoint documentation for replays index and details #53526
Conversation
|
||
"""Return only the fields requested by the client.""" | ||
if fields: | ||
for item in response: | ||
yield {field: item[field] for field in fields} | ||
yield {field: item[field] for field in fields} # type: ignore |
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.
there may be a way to fix so we don't have to type ignore, but reading here python/mypy#7178 seems like guaranteeing dictionary key access of TypeDicts are annoying. @getsentry/python-typing anyone here have ideas?
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.
the fields
should be a list[Literal['possible', 'keys', 'here']] | None
I believe
though it feels weird to only return some of the fields like this -- are there explicit subsets that we can type directly rather than allowing any combination of fields to be sliced out?
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.
unfortunately, no. The fields returned are specified by the user via query string to the endpoint.
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.
but we can try the literal and see if that works.
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.
can we just give them everything and remove / deprecate that behaviour? what's the risk in giving everything?
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.
unfortunately some fields result in expensive clickhouse queries, and it's better to leave them off by default.
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.
maybe I'm misreading this -- but haven't they already been fetched at this point?
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.
right, yeah. we set default values below if none were returned from the query. we may be able to refactor to make a bit more type friendly/clear. thanks
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #53526 +/- ##
=======================================
Coverage 79.55% 79.56%
=======================================
Files 4942 4943 +1
Lines 208999 209085 +86
Branches 35582 35590 +8
=======================================
+ Hits 166270 166356 +86
- Misses 37652 37654 +2
+ Partials 5077 5075 -2
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
8a27efb
to
3b37945
Compare
59ab545
to
e99defc
Compare
e99defc
to
4237e43
Compare
def get(self, request: Request, organization: Organization, replay_id: str) -> Response: | ||
""" | ||
Retrieve a single replay instance. |
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.
More in line with what we have on our docs.
Retrieve a single replay instance. | |
Return details on an individual replay. |
@@ -32,7 +42,21 @@ def get_replay_filter_params(self, request, organization): | |||
|
|||
return filter_params | |||
|
|||
@extend_schema( | |||
operation_id="Query for a List of Replays", |
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.
Endpoints that return a list are usually titled List ...
(eg: List an Organization's Teams). Ideally we would do the same here, but I'm unfamiliar with how replays work. Is the returned list of replays tied to some project or something else that we can include in the title?
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.
I'll change it to something like "List an Organization's Replays" since replays are associated by org slug
def get(self, request: Request, organization: Organization) -> Response: | ||
""" | ||
Query for a list of replays using the Replays GET Request. |
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.
Similar to above, ideally this would be like the description in List a Team's Projects
Query for a list of replays using the Replays GET Request. | |
Return a list of replays ... |
Added documentation for the replays index & replays details public endpoint API.
Relates to getsentry/team-replay#112
Index:
Details: