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

Prefer DataView client over SavedObjects client when possible #136694

Merged
merged 5 commits into from
Jul 22, 2022

Conversation

sorenlouv
Copy link
Member

@sorenlouv sorenlouv commented Jul 19, 2022

Closes #135972
Closes #131368

This PR removes usages of savedObjectsClient where dataViews client can be used instead. Custom logic is also replaced with built-in methods provided by the dataViews client.

isCachable: true,
});

return services.dataViews.create({ title: res.apmDataViewTitle });
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously the endpoint returned a fake data view. Now it only returns the data view index pattern (aka title) which is used to build a real (non-persisted) data view.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great if we can just have one hook / endpoint instead of having a static and a dynamic data view. Now that we use the dataViews services it is more straightforward to do so.

}
)
);
name: 'APM UI',
Copy link
Member Author

Choose a reason for hiding this comment

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

This is pretty neat. It's now possible to set a human readable title for a data view.

Before:

After (I've manually added the names for the other Observability apps):


// if the existing data view does not matches the new one, force an update
return existingDataView.attributes.title !== apmDataViewTitle;
const existingDataView = await dataViewService.get(APM_STATIC_DATA_VIEW_ID);
Copy link
Member Author

Choose a reason for hiding this comment

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

Replaces savedObjectsClient.get with dataViewService.get

defaultMessage:
'An APM data view is required for some features in the APM UI.',
}
),
Copy link
Member Author

@sorenlouv sorenlouv Jul 20, 2022

Choose a reason for hiding this comment

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

For the tutorials it is currently possible to create a data view directly by clicking a button. I've removed this feature because:

  • It is only supported via the legacy saved object calls
  • it no longer adds any value, since the data view is automatically generated when opening APM UI

@sorenlouv sorenlouv added release_note:enhancement backport:skip This commit does not require backporting v8.4.0 labels Jul 20, 2022
@sorenlouv sorenlouv marked this pull request as ready for review July 20, 2022 06:14
@sorenlouv sorenlouv requested a review from a team as a code owner July 20, 2022 06:14
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Jul 20, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

savedObjectsClient.create(
'index-pattern',
getApmDataViewAttributes(apmDataViewTitle),
await withApmSpan('create_index_pattern_saved_object', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await withApmSpan('create_index_pattern_saved_object', async () => {
await withApmSpan('create_data_view', async () => {

@sorenlouv sorenlouv requested a review from a team as a code owner July 20, 2022 23:41
@botelastic botelastic bot added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Jul 20, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@sorenlouv sorenlouv force-pushed the prefer-data-view-apis branch 2 times, most recently from 4eea34d to a1adc93 Compare July 21, 2022 13:06
Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

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

UX changes LGTM, tested this locally running as an admin and it seems fine. We've also uncovered that the dashboard seems broken for readonly users, that's tracked in a separate ticket.

Copy link
Contributor

@gbamparop gbamparop left a comment

Choose a reason for hiding this comment

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

LGTM! It looks cleaner now as well!

@sorenlouv sorenlouv force-pushed the prefer-data-view-apis branch from a1adc93 to 2bcdc41 Compare July 22, 2022 11:48
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1306 1301 -5

Async chunks

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

id before after diff
apm 3.0MB 3.0MB -875.0B
ux 164.0KB 163.8KB -173.0B
total -1.0KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
apm 55 54 -1

Page load bundle

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

id before after diff
apm 28.2KB 28.3KB +141.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
apm 88 87 -1

Total ESLint disabled count

id before after diff
apm 102 101 -1

History

  • 💛 Build #59483 was flaky a1adc939b9f947bd547a60b543bfd1e4df75570c
  • 💔 Build #59326 failed dc528ff3b5eb286d142b25efd30b6671e1c15b4b
  • 💔 Build #59305 failed 5054e30900cd6fb040b672b1638a7beb4a02d49b
  • 💔 Build #59091 failed df380839271f5f12ad11ad81d279451e2a5e730b
  • 💔 Build #58981 failed 53bd8d21f15f74e8821414c52d89ac5daa131fa6
  • 💔 Build #58939 failed 7cc0172ce06facd2e72ed58541e93646351138c9

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

@sorenlouv sorenlouv merged commit c3649b8 into elastic:main Jul 22, 2022
@sorenlouv sorenlouv deleted the prefer-data-view-apis branch July 22, 2022 17:46
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:enhancement Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only use Data Views API to load data views [APM] Use index pattern service to load index patterns
6 participants