[Performance] Add saved object load performance metric (#147324)

Adds performance metric to track saved objects load time. Also add boilerplate search journey.

Partially address https://github.com/elastic/kibana/issues/145627
This commit is contained in:
Thomas Neirynck 2022-12-27 12:33:49 -05:00 committed by GitHub
parent 86e3321c82
commit 0b6d3baf9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 32 deletions

View file

@ -290,3 +290,4 @@ enabled:
- x-pack/performance/journeys/data_stress_test_lens.ts
- x-pack/performance/journeys/ecommerce_dashboard_saved_search_only.ts
- x-pack/performance/journeys/ecommerce_dashboard_tsvb_gauge_only.ts
- x-pack/performance/journeys/dashboard_listing_page.ts

View file

@ -192,7 +192,7 @@ from performance runs and visualize the duration of events (or their breakdowns)
Run the test locally for troubleshooting purposes by running
```
node scripts/functional_test_runner --config x-pack/test/performance/journeys/$YOUR_JOURNEY_NAME/config.ts
node scripts/functional_tests --config x-pack/performance/journeys/$YOUR_JOURNEY_NAME.ts
```
#### Analyzing journey results

View file

@ -885,40 +885,46 @@ function TableListViewComp<T extends UserContentCommonSchema>({
{showFetchError && renderFetchError()}
{/* Table of items */}
<Table<T>
dispatch={dispatch}
items={items}
isFetchingItems={isFetchingItems}
searchQuery={searchQuery}
tableColumns={tableColumns}
hasUpdatedAtMetadata={hasUpdatedAtMetadata}
tableSort={tableSort}
pagination={pagination}
selectedIds={selectedIds}
entityName={entityName}
entityNamePlural={entityNamePlural}
tagsToTableItemMap={tagsToTableItemMap}
deleteItems={deleteItems}
tableCaption={tableListTitle}
onTableChange={onTableChange}
onTableSearchChange={onTableSearchChange}
onSortChange={onSortChange}
addOrRemoveIncludeTagFilter={addOrRemoveIncludeTagFilter}
addOrRemoveExcludeTagFilter={addOrRemoveExcludeTagFilter}
clearTagSelection={clearTagSelection}
/>
{/* Delete modal */}
{showDeleteModal && (
<ConfirmDeleteModal<T>
isDeletingItems={isDeletingItems}
<div
data-test-subj={
hasInitialFetchReturned && !isFetchingItems ? 'table-is-ready' : 'table-is-loading'
}
>
<Table<T>
dispatch={dispatch}
items={items}
isFetchingItems={isFetchingItems}
searchQuery={searchQuery}
tableColumns={tableColumns}
hasUpdatedAtMetadata={hasUpdatedAtMetadata}
tableSort={tableSort}
pagination={pagination}
selectedIds={selectedIds}
entityName={entityName}
entityNamePlural={entityNamePlural}
items={selectedItems}
onConfirm={deleteSelectedItems}
onCancel={() => dispatch({ type: 'onCancelDeleteItems' })}
tagsToTableItemMap={tagsToTableItemMap}
deleteItems={deleteItems}
tableCaption={tableListTitle}
onTableChange={onTableChange}
onTableSearchChange={onTableSearchChange}
onSortChange={onSortChange}
addOrRemoveIncludeTagFilter={addOrRemoveIncludeTagFilter}
addOrRemoveExcludeTagFilter={addOrRemoveExcludeTagFilter}
clearTagSelection={clearTagSelection}
/>
)}
{/* Delete modal */}
{showDeleteModal && (
<ConfirmDeleteModal<T>
isDeletingItems={isDeletingItems}
entityName={entityName}
entityNamePlural={entityNamePlural}
items={selectedItems}
onConfirm={deleteSelectedItems}
onCancel={() => dispatch({ type: 'onCancelDeleteItems' })}
/>
)}
</div>
</KibanaPageTemplate.Section>
</PageTemplate>
);

View file

@ -24,6 +24,9 @@ import type { IKbnUrlStateStorage } from '@kbn/kibana-utils-plugin/public';
import type { SavedObjectsFindOptionsReference, SimpleSavedObject } from '@kbn/core/public';
import { TableListView, type UserContentCommonSchema } from '@kbn/content-management-table-list';
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
import { SAVED_OBJECT_LOADED_TIME } from '../../dashboard_constants';
import {
getDashboardBreadcrumb,
dashboardListingTableStrings,
@ -274,6 +277,7 @@ export const DashboardListing = ({
referencesToExclude?: SavedObjectsFindOptionsReference[];
} = {}
) => {
const searchStartTime = window.performance.now();
return findDashboards
.findSavedObjects({
search: searchTerm,
@ -282,6 +286,15 @@ export const DashboardListing = ({
hasNoReference: referencesToExclude,
})
.then(({ total, hits }) => {
const searchEndTime = window.performance.now();
const searchDuration = searchEndTime - searchStartTime;
reportPerformanceMetricEvent(pluginServices.getServices().analytics, {
eventName: SAVED_OBJECT_LOADED_TIME,
duration: searchDuration,
meta: {
saved_object_type: 'dashboard',
},
});
return {
total,
hits: hits.map(toTableListViewSavedObject),

View file

@ -42,6 +42,7 @@ export function createDashboardListingFilterUrl(filter: string | undefined) {
// Telemetry & Events
// ------------------------------------------------------------------
export const DASHBOARD_LOADED_EVENT = 'dashboard_loaded';
export const SAVED_OBJECT_LOADED_TIME = 'saved_object_loaded_time';
export const DASHBOARD_UI_METRIC_ID = 'dashboard';
// ------------------------------------------------------------------

View file

@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { Journey } from '@kbn/journeys';
export const journey = new Journey({
esArchives: ['x-pack/performance/es_archives/sample_data_flights'],
kbnArchives: [
'x-pack/performance/kbn_archives/flights_no_map_dashboard',
'x-pack/performance/kbn_archives/logs_no_map_dashboard',
],
}).step('Go to Dashboards Page', async ({ page, kbnUrl }) => {
await page.goto(kbnUrl.get(`/app/dashboards`));
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
});