Skip to content
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

[Discover] Makes caching dataset options optional #8799

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

ashwin-pc
Copy link
Member

Description

Makes caching dataset options optional. Enables it only for s3 since its metadtata calls are slower.

Additinal fix: When caching was no longer optional, qury assist api calls held the Clusters menu in a perpetual loading state causing the menu to not load. This fixes that by timing out only the is enabled queries to not prevent that menu from loading.

Issues Resolved

Screenshot

Testing the changes

See unit test.

Or for Manual testing:

  • Open Discover
  • Open the advanced data selector
  • Select index patterns, the menu shoud always fire a network request
  • Select Indices, the menu should always fire a network request
  • Select S3, the menu should only fire the query oince

Changelog

  • fix: [Discover] Makes cachign dataset options optional and configurable by the dataset type

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

kavilla
kavilla previously approved these changes Nov 4, 2024
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 60.78%. Comparing base (5829303) to head (707527b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ry/query_string/dataset_service/dataset_service.ts 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8799      +/-   ##
==========================================
+ Coverage   60.77%   60.78%   +0.01%     
==========================================
  Files        3798     3798              
  Lines       90695    90701       +6     
  Branches    14279    14284       +5     
==========================================
+ Hits        55121    55135      +14     
+ Misses      32075    32067       -8     
  Partials     3499     3499              
Flag Coverage Δ
Linux_1 29.05% <0.00%> (-0.01%) ⬇️
Linux_2 56.39% <ø> (ø)
Linux_3 37.65% <85.71%> (+0.01%) ⬆️
Linux_4 29.82% <46.15%> (+<0.01%) ⬆️
Windows_1 29.06% <0.00%> (-0.01%) ⬇️
Windows_2 56.34% <ø> (ø)
Windows_3 37.65% <85.71%> (+0.02%) ⬆️
Windows_4 29.82% <46.15%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
@@ -36,6 +36,8 @@ export interface DatasetTypeConfig {
supportsTimeFilter?: boolean;
/** Optional isFieldLoadAsync determines if field loads are async */
isFieldLoadAsync?: boolean;
/** Optional cacheOptions determines if the data structure is cacheable. Defaults to false */
cacheOptions?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we just name it cacheable since it is a boolean.

const isEnabled = await getAvailableLanguagesForDataSource(http, dataSourceId).then(
(languages) => languages.length > 0
);
// [TODO] - The timmeout exists because the loading of the Datasource menu is prevented until this request completes. This if a single cluster is down the request holds the whole menu level in a loading state. We should make this call non blocking and load the datasource meta in the background.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// [TODO] - The timmeout exists because the loading of the Datasource menu is prevented until this request completes. This if a single cluster is down the request holds the whole menu level in a loading state. We should make this call non blocking and load the datasource meta in the background.
// [TODO] - The timeout exists because the loading of the Datasource menu is prevented until this request completes. Then if a single cluster is down the request holds the whole menu level in a loading state. We should make this call non blocking and load the datasource meta in the background.

@SuZhou-Joe SuZhou-Joe merged commit 005a83a into opensearch-project:main Nov 4, 2024
67 of 69 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-8799-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 005a83a4091d912649283f79ab0b5d617066955d
# Push it to GitHub
git push --set-upstream origin backport/backport-8799-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-8799-to-2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants