-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Lens] add performance journey to track rendering time for XY visualization and suggestions panel #163412
[Lens] add performance journey to track rendering time for XY visualization and suggestions panel #163412
Changes from 7 commits
61c89d1
3d1a134
5895bd4
4aab3bd
bb0fc89
9b3f7b0
fef081a
9c66c7d
7fa7f99
d679929
fae400e
9e07ad4
e770337
7364cff
3e88562
d8dc8f6
3485fc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import type { AggregateQuery, EsQueryConfig, Filter, Query } from '@kbn/es-query | |
import { type DataPublicPluginStart } from '@kbn/data-plugin/public'; | ||
import type { DataView, DataViewsContract } from '@kbn/data-views-plugin/common'; | ||
import { getEsQueryConfig } from '@kbn/data-service/src/es_query'; | ||
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools'; | ||
import { loadFieldExisting } from '../services/field_existing'; | ||
import { ExistenceFetchStatus } from '../types'; | ||
|
||
|
@@ -35,7 +36,7 @@ export interface ExistingFieldsFetcherParams { | |
query: Query | AggregateQuery | undefined; | ||
filters: Filter[] | undefined; | ||
services: { | ||
core: Pick<CoreStart, 'uiSettings'>; | ||
core: Pick<CoreStart, 'uiSettings' | 'analytics'>; | ||
data: DataPublicPluginStart; | ||
dataViews: DataViewsContract; | ||
}; | ||
|
@@ -178,6 +179,8 @@ export const useExistingFieldsFetcher = ( | |
const dataViewsHash = getDataViewsHash(params.dataViews); | ||
const refetchFieldsExistenceInfo = useCallback( | ||
async (dataViewId?: string) => { | ||
const startTime = window.performance.now(); | ||
const metricEventName = 'fetchFieldsExistenceInfo'; | ||
const fetchId = generateId(); | ||
lastFetchId = fetchId; | ||
|
||
|
@@ -192,6 +195,11 @@ export const useExistingFieldsFetcher = ( | |
...options, | ||
dataViewId, | ||
}); | ||
reportPerformanceMetricEvent(params.services.core.analytics, { | ||
eventName: metricEventName, | ||
duration: window.performance.now() - startTime, | ||
meta: { dataViewId }, | ||
}); | ||
return; | ||
} | ||
// refetch for all mentioned data views | ||
|
@@ -203,6 +211,11 @@ export const useExistingFieldsFetcher = ( | |
}) | ||
) | ||
); | ||
reportPerformanceMetricEvent(params.services.core.analytics, { | ||
eventName: metricEventName, | ||
duration: window.performance.now() - startTime, | ||
meta: { dataViews: params.dataViews.map((v) => v.name) }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to track data view name or data view id to apply the same in both places?
vs
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jughosta good catch! Probably name is easier to understand but I'm curious if from development perspective it is better to have id? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how we would use this meta info. Another idea: store only data views count. |
||
}); | ||
}, | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
[ | ||
|
@@ -212,6 +225,7 @@ export const useExistingFieldsFetcher = ( | |
params.filters, | ||
params.fromDate, | ||
params.toDate, | ||
params.services.core, | ||
] | ||
); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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: ['x-pack/performance/kbn_archives/lens_many_fields'], | ||
esArchives: ['test/functional/fixtures/es_archiver/stress_test'], | ||
}) | ||
.step('Go to Visualize Library', async ({ page, kbnUrl }) => { | ||
await page.goto( | ||
kbnUrl.get( | ||
`/app/visualize#/?_g=(filters:!(),time:(from:'2022-09-07T10:53:30.262Z',to:'2022-09-07T10:55:09.280Z'))` | ||
) | ||
); | ||
await page.waitForSelector(subj('table-is-ready')); | ||
}) | ||
.step('Open existing Lens', async ({ page, kibanaPage }) => { | ||
await page.click(subj('visListingTitleLink-Lens-Stress-Test')); | ||
await kibanaPage.waitForCharts(6); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,277 @@ | ||
{ | ||
"attributes":{ | ||
"fieldAttrs":"{\"field0\":{\"count\":3}}", | ||
"fieldFormatMap":"{}", | ||
"fields":"[]", | ||
"name":"stresstest", | ||
"runtimeFieldMap":"{}", | ||
"sourceFilters":"[]", | ||
"title":"stresstest", | ||
"typeMeta":"{}" | ||
}, | ||
"coreMigrationVersion":"8.8.0", | ||
"created_at":"2023-08-08T12:58:09.530Z", | ||
"id":"6244bd06-f711-44db-b756-bc25e4a32a60", | ||
"managed":false, | ||
"references":[], | ||
"type":"index-pattern", | ||
"typeMigrationVersion":"8.0.0", | ||
"updated_at":"2023-08-08T13:00:00.888Z", | ||
"version":"WzYyLDFd" | ||
} | ||
|
||
{ | ||
"attributes":{ | ||
"description":"", | ||
"state":{ | ||
"adHocDataViews":{}, | ||
"datasourceStates":{ | ||
"formBased":{ | ||
"layers":{ | ||
"591b8a11-31f9-41e5-87ba-f0b6f5face08":{ | ||
"columnOrder":[ | ||
"fed7a521-30ac-4696-bf2d-85a26ba6db58", | ||
"5bcdbfd2-c4c0-4b27-891e-d848ea468cbe", | ||
"532742da-8bea-4357-a5e1-9319111a61e7", | ||
"4707670e-1c99-4e86-a09c-7801490131a1", | ||
"e822b0fa-1c95-44fa-8a5a-06c339f841ca", | ||
"881198db-8a3d-497b-b662-d7f5835775af", | ||
"fc484025-c6c3-47e5-8a2d-428d6d6e3dbb", | ||
"9a616aee-4712-4492-97fa-511f7697c40d", | ||
"01bc80c1-f4fb-4913-a394-c0b7ffc206d4", | ||
"f2bcf29f-624d-4d24-80ad-c73f297b6fff" | ||
], | ||
"columns":{ | ||
"01bc80c1-f4fb-4913-a394-c0b7ffc206d4":{ | ||
"dataType":"number", | ||
"isBucketed":false, | ||
"label":"Differences of Count of records", | ||
"operationType":"differences", | ||
"references":[ | ||
"f2bcf29f-624d-4d24-80ad-c73f297b6fff" | ||
], | ||
"scale":"ratio" | ||
}, | ||
"4707670e-1c99-4e86-a09c-7801490131a1":{ | ||
"dataType":"number", | ||
"isBucketed":false, | ||
"label":"Moving average of Unique count of field0", | ||
"operationType":"moving_average", | ||
"params":{ | ||
"window":5 | ||
}, | ||
"references":[ | ||
"e822b0fa-1c95-44fa-8a5a-06c339f841ca" | ||
], | ||
"scale":"ratio" | ||
}, | ||
"532742da-8bea-4357-a5e1-9319111a61e7":{ | ||
"dataType":"number", | ||
"isBucketed":false, | ||
"label":"Count of records", | ||
"operationType":"count", | ||
"params":{ | ||
"emptyAsNull":true | ||
}, | ||
"scale":"ratio", | ||
"sourceField":"___records___" | ||
}, | ||
"5bcdbfd2-c4c0-4b27-891e-d848ea468cbe":{ | ||
"dataType":"date", | ||
"isBucketed":true, | ||
"label":"@timestamp", | ||
"operationType":"date_histogram", | ||
"params":{ | ||
"dropPartials":false, | ||
"includeEmptyRows":true, | ||
"interval":"ms" | ||
}, | ||
"scale":"interval", | ||
"sourceField":"@timestamp" | ||
}, | ||
"881198db-8a3d-497b-b662-d7f5835775af":{ | ||
"dataType":"number", | ||
"isBucketed":false, | ||
"label":"Cumulative sum of Records", | ||
"operationType":"cumulative_sum", | ||
"references":[ | ||
"fc484025-c6c3-47e5-8a2d-428d6d6e3dbb" | ||
], | ||
"scale":"ratio" | ||
}, | ||
"9a616aee-4712-4492-97fa-511f7697c40d":{ | ||
"dataType":"number", | ||
"filter":{ | ||
"language":"kuery", | ||
"query":"NOT (field0 :\"DYL\" )" | ||
}, | ||
"isBucketed":false, | ||
"label":"Unique count of field0", | ||
"operationType":"unique_count", | ||
"params":{ | ||
"emptyAsNull":true | ||
}, | ||
"scale":"ratio", | ||
"sourceField":"field0" | ||
}, | ||
"e822b0fa-1c95-44fa-8a5a-06c339f841ca":{ | ||
"dataType":"number", | ||
"isBucketed":false, | ||
"label":"Unique count of field0", | ||
"operationType":"unique_count", | ||
"params":{ | ||
"emptyAsNull":true | ||
}, | ||
"scale":"ratio", | ||
"sourceField":"field0" | ||
}, | ||
"f2bcf29f-624d-4d24-80ad-c73f297b6fff":{ | ||
"dataType":"number", | ||
"isBucketed":false, | ||
"label":"Count of records", | ||
"operationType":"count", | ||
"params":{ | ||
"emptyAsNull":true | ||
}, | ||
"scale":"ratio", | ||
"sourceField":"___records___" | ||
}, | ||
"fc484025-c6c3-47e5-8a2d-428d6d6e3dbb":{ | ||
"dataType":"number", | ||
"isBucketed":false, | ||
"label":"Count of records", | ||
"operationType":"count", | ||
"params":{ | ||
"emptyAsNull":true | ||
}, | ||
"scale":"ratio", | ||
"sourceField":"___records___" | ||
}, | ||
"fed7a521-30ac-4696-bf2d-85a26ba6db58":{ | ||
"dataType":"string", | ||
"isBucketed":true, | ||
"label":"Top 1000 values of field0", | ||
"operationType":"terms", | ||
"params":{ | ||
"missingBucket":false, | ||
"orderBy":{ | ||
"columnId":"532742da-8bea-4357-a5e1-9319111a61e7", | ||
"type":"column" | ||
}, | ||
"orderDirection":"desc", | ||
"otherBucket":false, | ||
"parentFormat":{ | ||
"id":"terms" | ||
}, | ||
"size":1000 | ||
}, | ||
"scale":"ordinal", | ||
"sourceField":"field0" | ||
} | ||
}, | ||
"incompleteColumns":{} | ||
} | ||
} | ||
} | ||
}, | ||
"filters":[], | ||
"internalReferences":[], | ||
"query":{ | ||
"language":"kuery", | ||
"query":"" | ||
}, | ||
"visualization":{ | ||
"axisTitlesVisibilitySettings":{ | ||
"x":true, | ||
"yLeft":true, | ||
"yRight":true | ||
}, | ||
"fittingFunction":"None", | ||
"gridlinesVisibilitySettings":{ | ||
"x":true, | ||
"yLeft":true, | ||
"yRight":true | ||
}, | ||
"labelsOrientation":{ | ||
"x":0, | ||
"yLeft":0, | ||
"yRight":0 | ||
}, | ||
"layers":[ | ||
{ | ||
"accessors":[ | ||
"532742da-8bea-4357-a5e1-9319111a61e7", | ||
"4707670e-1c99-4e86-a09c-7801490131a1", | ||
"881198db-8a3d-497b-b662-d7f5835775af", | ||
"9a616aee-4712-4492-97fa-511f7697c40d", | ||
"01bc80c1-f4fb-4913-a394-c0b7ffc206d4" | ||
], | ||
"layerId":"591b8a11-31f9-41e5-87ba-f0b6f5face08", | ||
"layerType":"data", | ||
"position":"top", | ||
"seriesType":"bar_stacked", | ||
"showGridlines":false, | ||
"splitAccessor":"fed7a521-30ac-4696-bf2d-85a26ba6db58", | ||
"xAccessor":"5bcdbfd2-c4c0-4b27-891e-d848ea468cbe" | ||
}, | ||
{ | ||
"annotations":[ | ||
{ | ||
"color":"#F04E98", | ||
"id":"f731d18b-b2cc-4b20-8af8-d2bba8f53de2", | ||
"key":{ | ||
"timestamp":"2022-09-07T10:54:25.755Z", | ||
"type":"point_in_time" | ||
}, | ||
"label":"Event", | ||
"type":"manual" | ||
} | ||
], | ||
"ignoreGlobalFilters":true, | ||
"layerId":"9b0e1783-70b2-4235-b4d1-a623b32e5238", | ||
"layerType":"annotations", | ||
"persistanceType":"byValue", | ||
"seriesType":"bar_stacked" | ||
} | ||
], | ||
"legend":{ | ||
"isVisible":true, | ||
"legendSize":"auto", | ||
"position":"right" | ||
}, | ||
"preferredSeriesType":"bar_stacked", | ||
"tickLabelsVisibilitySettings":{ | ||
"x":true, | ||
"yLeft":true, | ||
"yRight":true | ||
}, | ||
"valueLabels":"hide" | ||
} | ||
}, | ||
"title":"Lens Stress Test", | ||
"visualizationType":"lnsXY" | ||
}, | ||
"coreMigrationVersion":"8.8.0", | ||
"created_at":"2023-08-08T13:05:46.124Z", | ||
"id":"c7787800-2c9e-11ee-b1db-6df582ca24e0", | ||
"managed":false, | ||
"references":[ | ||
{ | ||
"id":"6244bd06-f711-44db-b756-bc25e4a32a60", | ||
"name":"indexpattern-datasource-layer-591b8a11-31f9-41e5-87ba-f0b6f5face08", | ||
"type":"index-pattern" | ||
}, | ||
{ | ||
"id":"6244bd06-f711-44db-b756-bc25e4a32a60", | ||
"name":"xy-visualization-layer-9b0e1783-70b2-4235-b4d1-a623b32e5238", | ||
"type":"index-pattern" | ||
} | ||
], | ||
"timeTo": "2022-09-07T10:55:09.280Z", | ||
"timeFrom": "2022-09-07T10:53:30.262Z", | ||
"timeRestore": true, | ||
"type":"lens", | ||
"typeMigrationVersion":"8.9.0", | ||
"updated_at":"2023-08-08T13:05:46.124Z", | ||
"version":"WzgyLDFd" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jughosta does the way we're thinking of measuring field list loading make sense to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drewdaemon Yes, currently we get fields from dataView class and make this additional call to separate "Empty" fields in the sidebar. As long as we specify that it's
fetchFieldsExistenceInfo
request metrics, it's correct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculations for grouping logic are happening in
packages/kbn-unified-field-list/src/hooks/use_grouped_fields.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what we're really going for the total time it takes to load the field list in Lens.
It sounds like you're saying we can assume that the fields are already present on the client so this existence check is the only network call we need to account for. Is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drewdaemon Yes, right now it's the only request we make for the field list. But it will change in the future. @mattkime is working on RFC to load fields async and separately from data view info. Once we apply this change, we can sum both loading durations.