-
Notifications
You must be signed in to change notification settings - Fork 968
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
Add resource ID filtering in fetch augment-vis
obj queries
#4608
Add resource ID filtering in fetch augment-vis
obj queries
#4608
Conversation
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Codecov Report
@@ Coverage Diff @@
## main #4608 +/- ##
=======================================
Coverage 66.15% 66.16%
=======================================
Files 3314 3314
Lines 63910 63911 +1
Branches 9967 9970 +3
=======================================
+ Hits 42281 42288 +7
+ Misses 19184 19179 -5
+ Partials 2445 2444 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Overall, this looks great! Could you please include unit tests (UT) to ensure quality? |
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.
@ohltyler looks great! Just need to add the new param to the jsdocs comments.
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Added in latest commit - also enforces that the |
@bandinib-amzn @joshuarrrr all checks have passed |
Description
This PR provides optimizations to the saved object loader calls made in the vis embeddable. Specifically, when fetching the saved objects, it adds arguments to the query to filter by matching plugin resource IDs, when applicable. Before, all objects were returned and post-processing filtering was done. Now, we leverage OpenSearch to handle the filtering for us.
To make this change, a new optional argument has been added to the
findAll()
function to specify the search fields. Before, it was hardcoded to name and description. Now, we want to search on thepluginResource.id
field such that we only return objects that match the input resource IDs.This fix provides massive performance improvements when rendering the View Events flyout. Specifically, it prevents
n^2 - n
objects being returned, wheren
is the number of associations. This also means an equivalent amount of prevented plugin expression function runs, any queries ran within those expression functions, etc.For example, suppose there are 10 associations to a visualization, and a user opens the View Events flyout.
Before, each visualization would be fetching all 10
augment-vis
objects, executing all 10 expression functions (which would mean fetching all 10 resources, results for each of them, etc.). Each vis (10 executions) x 10 == 100 executions.Now, each visualization only fetches the relevant
augment-vis
saved object, so only one expression function is ran. Each vis (1 execution) x 10 = 10 executions, a savings of 90%.Before this change, the time to render the view events flyout as the number of visualizations/associations grew was exponential. Now, it is linear. Example of network request savings seen on my local:
Opening flyout with 5 associations = 98 requests (before) - 58 requests (after) = 40 requests prevented = ~41% less total requests.
10 associations = 288 requests (before) - 108 requests (after) = 180 requests prevented = ~63% less total requests
For more information on plugin resource IDs and how they are used, see "The VisAugmenterEmbeddableConfig" section in #3415
Quick results on my local (top row is association count)
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr