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

dataviews.clearCache cleanup #136256

Merged
merged 2 commits into from
Jul 18, 2022
Merged

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Jul 13, 2022

Summary

dataviews.clearCache(id?: string) was cleaned up, before it cleaned the data view saved objects cache as well as data view instance cache. The method was split into two methods:

  • clearCache() which clears data view saved object cache
  • clearInstanceCache(id?: string): which clears the data view instance cache

for apps that used to clear whole instance cache (discover) unified search data view selector was updated to refresh the field list on data view change and discover also refreshes the field list of a data view on load to make sure user always gets the recent field list.

Checklist

Delete any items that are not applicable to this PR.

@ppisljar ppisljar requested a review from a team as a code owner July 13, 2022 09:10
@ppisljar ppisljar added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v8.4.0 labels Jul 13, 2022
@ppisljar ppisljar changed the title [dataviews] clear only data view saved object cache dataviews.clearCache cleanup Jul 13, 2022
if (id) {
this.dataViewCache.clear(id);
} else {
if (full) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this code had some undesirable functional overlap to begin with. the savedObjectsCache is really a list of data views whereas the dataViewCache actually stores DataView instances. They'd be cleared in slightly different situations, whether you're getting a fresh list or fresh DataView instance. What are the needs and intentions of the api consumer code? I think this gets lost when clearCache always clears the data view list cache and optionally clears the dataView cache. Determining api consumers intentions might be more work than the code changes in which case perhaps we should deprecate this method and replace it with two new methods.

@ppisljar ppisljar force-pushed the adhocdataviews/cache branch from cfe91bb to 01e579f Compare July 18, 2022 06:44
@ppisljar ppisljar requested a review from a team as a code owner July 18, 2022 06:44
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #15 / Status page Status Page "before all" hook for "allows user to navigate without authentication"

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
data 2402 2404 +2
dataViews 199 202 +3
total +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dataViewManagement 143.6KB 143.6KB +8.0B
discover 492.4KB 492.5KB +35.0B
total +43.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dataViews 40.7KB 40.7KB +39.0B
unifiedSearch 44.0KB 44.1KB +74.0B
total +113.0B
Unknown metric groups

API count

id before after diff
data 3075 3077 +2
dataViews 938 942 +4
total +6

History

  • 💔 Build #58081 failed cfe91bbe0d989dcc9e8b310103d0b6d57c6b8a4e
  • 💔 Build #57741 failed 6d69a86d501f33d1dcdc7f34ffbe5912a7ca8191
  • 💔 Build #57665 failed ff7920ec3966e0c5f11c20c8bee6200648c237db
  • 💔 Build #57362 failed d1b8b3ecf67af1e0e1183de978a2e2dbbc75d70c
  • 💔 Build #57283 failed f84d9ca294a72897d9b262f612a237c2f56c9481

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

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

changes lgtm, nice work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants