mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[ML] Add new performance journey for Index data visualizer (#164787)
## Summary This PR adds a performance journey test for the Index data visualizer, using the Kibana TSDB logs. To run test: ``` node scripts/run_performance.js --journey-path x-pack/performance/journeys/tsdb_logs_data_visualizer.ts --skip-warmup ``` ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Walter Rafelsberger <walter.rafelsberger@elastic.co> Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
This commit is contained in:
parent
0f9b0fd613
commit
4eb45e67c0
9 changed files with 63 additions and 11 deletions
|
@ -417,6 +417,7 @@ enabled:
|
|||
- x-pack/performance/journeys/many_fields_discover.ts
|
||||
- x-pack/performance/journeys/many_fields_lens_editor.ts
|
||||
- x-pack/performance/journeys/many_fields_transform.ts
|
||||
- x-pack/performance/journeys/tsdb_logs_data_visualizer.ts
|
||||
- x-pack/performance/journeys/promotion_tracking_dashboard.ts
|
||||
- x-pack/performance/journeys/web_logs_dashboard.ts
|
||||
- x-pack/performance/journeys/data_stress_test_lens.ts
|
||||
|
|
32
x-pack/performance/journeys/tsdb_logs_data_visualizer.ts
Normal file
32
x-pack/performance/journeys/tsdb_logs_data_visualizer.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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';
|
||||
import { subj } from '@kbn/test-subj-selector';
|
||||
|
||||
export const journey = new Journey({
|
||||
kbnArchives: ['test/functional/fixtures/kbn_archiver/kibana_sample_data_logs_tsdb'],
|
||||
esArchives: ['test/functional/fixtures/es_archiver/kibana_sample_data_logs_tsdb'],
|
||||
})
|
||||
.step('Go to Data Visualizer', async ({ page, kbnUrl, kibanaPage }) => {
|
||||
await page.goto(kbnUrl.get(`app/ml/datavisualizer`));
|
||||
await kibanaPage.waitForHeader();
|
||||
await page.waitForSelector(subj('mlDataVisualizerCardIndexData'));
|
||||
await page.waitForSelector(subj('globalLoadingIndicator-hidden'));
|
||||
})
|
||||
.step('Go to data view selection', async ({ page }) => {
|
||||
const createButtons = page.locator(subj('mlDataVisualizerSelectIndexButton'));
|
||||
await createButtons.first().click();
|
||||
await page.waitForSelector(subj('savedObjectsFinderTable'));
|
||||
})
|
||||
.step('Go to Index data visualizer', async ({ page, kibanaPage }) => {
|
||||
await page.click(subj('savedObjectTitlekibana_sample_data_logstsdb'));
|
||||
await page.click(subj('mlDatePickerButtonUseFullData'));
|
||||
await kibanaPage.waitForHeader();
|
||||
await page.waitForSelector(subj('dataVisualizerTable-loaded'), { timeout: 60000 });
|
||||
await page.waitForSelector(subj('globalLoadingIndicator-hidden'), { timeout: 60000 });
|
||||
});
|
|
@ -485,7 +485,7 @@ export const DataVisualizerTable = <T extends DataVisualizerTableItem>({
|
|||
itemIdToExpandedRowMap={itemIdToExpandedRowMap}
|
||||
isSelectable={false}
|
||||
onTableChange={onTableChange}
|
||||
data-test-subj={'dataVisualizerTable'}
|
||||
data-test-subj={`dataVisualizerTable-${loading ? 'loading' : 'loaded'}`}
|
||||
rowProps={(item) => ({
|
||||
'data-test-subj': `dataVisualizerRow row-${item.fieldName}`,
|
||||
})}
|
||||
|
|
|
@ -19,6 +19,7 @@ import { mlTimefilterRefresh$, useTimefilter } from '@kbn/ml-date-picker';
|
|||
import useObservable from 'react-use/lib/useObservable';
|
||||
import type { KibanaExecutionContext } from '@kbn/core-execution-context-common';
|
||||
import { useExecutionContext } from '@kbn/kibana-react-plugin/public';
|
||||
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
|
||||
import { useTimeBuckets } from '../../common/hooks/use_time_buckets';
|
||||
import { DATA_VISUALIZER_GRID_EMBEDDABLE_TYPE } from '../embeddables/grid_embeddable/constants';
|
||||
import { filterFields } from '../../common/components/fields_stats_grid/filter_fields';
|
||||
|
@ -61,8 +62,9 @@ export const useDataVisualizerGridData = (
|
|||
savedRandomSamplerPreference?: RandomSamplerOption,
|
||||
onUpdate?: (params: Dictionary<unknown>) => void
|
||||
) => {
|
||||
const loadIndexDataStartTime = useRef<number | undefined>(window.performance.now());
|
||||
const { services } = useDataVisualizerKibana();
|
||||
const { uiSettings, data, security, executionContext } = services;
|
||||
const { uiSettings, data, security, executionContext, analytics } = services;
|
||||
|
||||
const parentExecutionContext = useObservable(executionContext?.context$);
|
||||
|
||||
|
@ -499,6 +501,21 @@ export const useDataVisualizerGridData = (
|
|||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [overallStats, showEmptyFields]);
|
||||
|
||||
useEffect(() => {
|
||||
if (combinedProgress === 100 && loadIndexDataStartTime.current !== undefined) {
|
||||
const loadIndexDataDuration = window.performance.now() - loadIndexDataStartTime.current;
|
||||
|
||||
// Set this to undefined so reporting the metric gets triggered only once.
|
||||
loadIndexDataStartTime.current = undefined;
|
||||
|
||||
reportPerformanceMetricEvent(analytics, {
|
||||
eventName: 'dataVisualizerDataLoaded',
|
||||
duration: loadIndexDataDuration,
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [combinedProgress]);
|
||||
|
||||
const configs = useMemo(
|
||||
() => {
|
||||
const fieldStats = strategyResponse.fieldStats;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart } from '@kbn/core/public';
|
||||
import type { AnalyticsServiceStart, CoreSetup, CoreStart } from '@kbn/core/public';
|
||||
import { ChartsPluginStart } from '@kbn/charts-plugin/public';
|
||||
import type { CloudStart } from '@kbn/cloud-plugin/public';
|
||||
import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public';
|
||||
|
@ -42,6 +42,7 @@ export interface DataVisualizerSetupDependencies {
|
|||
discover: DiscoverSetup;
|
||||
}
|
||||
export interface DataVisualizerStartDependencies {
|
||||
analytics: AnalyticsServiceStart;
|
||||
data: DataPublicPluginStart;
|
||||
unifiedSearch: UnifiedSearchPublicPluginStart;
|
||||
fileUpload: FileUploadPluginStart;
|
||||
|
|
|
@ -68,7 +68,8 @@
|
|||
"@kbn/ml-string-hash",
|
||||
"@kbn/ml-random-sampler-utils",
|
||||
"@kbn/data-service",
|
||||
"@kbn/core-notifications-browser"
|
||||
"@kbn/core-notifications-browser",
|
||||
"@kbn/ebt-tools"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
|
@ -246,7 +246,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
|
|||
lensMetricField.fieldName,
|
||||
'legacyMtrVis'
|
||||
);
|
||||
await ml.navigation.browserBackTo('dataVisualizerTable');
|
||||
await ml.navigation.browserBackTo('dataVisualizerTableContainer');
|
||||
}
|
||||
const lensNonMetricField = testData.expected.nonMetricFields?.find(
|
||||
(f) => f.type === ML_JOB_FIELD_TYPES.KEYWORD
|
||||
|
@ -257,7 +257,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
|
|||
lensNonMetricField.fieldName,
|
||||
'legacyMtrVis'
|
||||
);
|
||||
await ml.navigation.browserBackTo('dataVisualizerTable');
|
||||
await ml.navigation.browserBackTo('dataVisualizerTableContainer');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -136,7 +136,7 @@ export function MachineLearningDataVisualizerIndexBasedProvider({
|
|||
|
||||
async assertDataVisualizerTableExist() {
|
||||
await retry.tryForTime(5000, async () => {
|
||||
await testSubjects.existOrFail(`dataVisualizerTable`);
|
||||
await testSubjects.existOrFail(`~dataVisualizerTable-loaded`);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ export function MachineLearningDataVisualizerTableProvider(
|
|||
|
||||
return new (class DataVisualizerTable {
|
||||
public async parseDataVisualizerTable() {
|
||||
const table = await testSubjects.find('~dataVisualizerTable');
|
||||
const table = await testSubjects.find('~dataVisualizerTable-loaded');
|
||||
const $ = await table.parseDomContent();
|
||||
const rows = [];
|
||||
|
||||
|
@ -74,7 +74,7 @@ export function MachineLearningDataVisualizerTableProvider(
|
|||
}
|
||||
|
||||
public rowSelector(fieldName: string, subSelector?: string) {
|
||||
const row = `~dataVisualizerTable > ~row-${fieldName}`;
|
||||
const row = `~dataVisualizerTableContainer > ~row-${fieldName}`;
|
||||
return !subSelector ? row : `${row} > ${subSelector}`;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ export function MachineLearningDataVisualizerTableProvider(
|
|||
}
|
||||
|
||||
public detailsSelector(fieldName: string, subSelector?: string) {
|
||||
const row = `~dataVisualizerTable > ~dataVisualizerFieldExpandedRow-${fieldName}`;
|
||||
const row = `~dataVisualizerTableContainer > ~dataVisualizerFieldExpandedRow-${fieldName}`;
|
||||
return !subSelector ? row : `${row} > ${subSelector}`;
|
||||
}
|
||||
|
||||
|
@ -566,7 +566,7 @@ export function MachineLearningDataVisualizerTableProvider(
|
|||
}
|
||||
|
||||
public async ensureNumRowsPerPage(n: 10 | 25 | 50) {
|
||||
const paginationButton = 'dataVisualizerTable > tablePaginationPopoverButton';
|
||||
const paginationButton = 'dataVisualizerTableContainer > tablePaginationPopoverButton';
|
||||
await retry.tryForTime(10000, async () => {
|
||||
await testSubjects.existOrFail(paginationButton);
|
||||
await testSubjects.click(paginationButton);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue