-
Notifications
You must be signed in to change notification settings - Fork 28
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
bundle analysis: add a paginated option to retrieve assets #798
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time. ❌ Failed Test Results:Completed 2277 tests with View the full list of failed testspytest
|
❌ 5 Tests Failed:
View the top 3 failed tests by shortest run time
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #798 +/- ##
================================================
+ Coverage 96.14000 96.15000 +0.01000
================================================
Files 812 812
Lines 18527 18576 +49
================================================
+ Hits 17813 17862 +49
Misses 714 714
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
before: Optional[str] = None, | ||
) -> Dict[str, object]: | ||
# All filtered assets before pagination | ||
assets = list( |
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.
A non-ideal way to perform pagination. It is still fetching all the assets (minus the ones filtered out) from the report and then return the requested blocks. Since fetching all assets is trivial for a given report we will live with this non optimized way. The major reason we want to paginate assets is because each asset object contains timeseries measurement data which is what's causing 99% of the load time. Paginating the assets mean we can lazy load the timeseries data on the UI. Note that fetching all assets in the first step doesn't begin the computation of the measurements data which means its fine.
def resolve_assets_paginated( | ||
bundle_report: BundleReport, | ||
info: GraphQLResolveInfo, | ||
ordering: AssetOrdering = AssetOrdering.SIZE, |
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.
should this and ordering_direction be optional as well since we're defaulting a value?
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.
yes, good catch
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.
wait I think it is currently ok, right now it should mean that ordering
is of type AssetOrdering
, but if that param is not passed in to the call it would be defaulted to AssetOrdering.SIZE
. It should never be the case that ordering
is null.
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.
Fair enough, I can appreciate the defensive nature of having a fallback value here
|
||
# Slice edges by return size | ||
if first is not None and first >= 0: | ||
if len(assets) > first: |
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.
nit: we can use total_count var instead of len(assets) for all these references to len(assets) right?
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.
total_count might not equal to len(assets) at this point of the code path. assets could have gotten sliced by the after/before if statements. total_count is for the grand total of results after filtering.
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.
ahhh okay yeah I totally missed that previously, makes sense
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.
looks good 👌
Add a
assetsPaginated
field toBundleReport
that allows pagination of asset retrieval. This is done primarily to speed up asset trend retrieval.New GQL schema:
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.