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

[Lens] Add lens editor performance metrics #163089

Merged
merged 14 commits into from
Aug 7, 2023

Conversation

drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Aug 3, 2023

Summary

This PR instruments the code to track a few key editor performance metrics. This is to prepare for adding a Lens editor performance journey.

Metrics

  • initial load of main chart
    • time to load data
    • time to render
  • time to initially load and render all suggestions

For this PR, each metric is reported to the console (commented out to pass the linter). When the journey is added, the console statements will be converted to analytics service calls so that they show up as metrics in the journey dashboard.

I made a few changes to increase the accuracy of the metrics.

@drewdaemon drewdaemon changed the title Add lens editor performance metrics [Lens] Add lens editor performance metrics Aug 3, 2023
Comment on lines +703 to +706
const onRenderHandler = useCallback(() => {
setIsRenderComplete(true);
onRender$();
}, [setIsRenderComplete, onRender$]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Important to memoize—multiple subscriptions in useExpressionRenderer hook were being created which led to multiple calls to onRender$.

@drewdaemon drewdaemon added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens performance labels Aug 3, 2023
Comment on lines +375 to +378
// console.log(
// 'time to fetch data and perform initial render for all suggestions',
// performance.now() - startTime.current
// );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

uncomment for review

@@ -138,6 +138,10 @@ export const WorkspacePanel = React.memo(function WorkspacePanel(props: Workspac
);
});

const log = (...messages: Array<string | number>) => {
// console.log(...messages);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

uncomment for review

@elastic elastic deleted a comment from kibana-ci Aug 3, 2023
@drewdaemon drewdaemon marked this pull request as ready for review August 4, 2023 01:08
@drewdaemon drewdaemon requested review from a team as code owners August 4, 2023 01:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations)

@drewdaemon drewdaemon added the release_note:skip Skip the PR/issue when compiling release notes label Aug 4, 2023
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

This looks great Drew, LGTM!

Copy link
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

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

Amazing work! That's a great start, thanks!

@drewdaemon drewdaemon removed the request for review from a team August 7, 2023 16:12
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
expressionGauge 18.7KB 18.8KB +38.0B
expressionHeatmap 26.5KB 26.6KB +38.0B
expressionMetricVis 4.6KB 4.6KB +38.0B
expressionPartitionVis 31.2KB 31.2KB +36.0B
expressionTagcloud 15.1KB 15.2KB +38.0B
expressionXY 121.6KB 121.6KB +38.0B
lens 1.4MB 1.4MB +614.0B
total +840.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
lens 15 16 +1

Total ESLint disabled count

id before after diff
lens 16 17 +1

History

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

@mistic mistic merged commit c6df737 into elastic:main Aug 7, 2023
@kibanamachine kibanamachine added v8.10.0 backport:skip This commit does not require backporting labels Aug 7, 2023
@ninoslavmiskovic
Copy link
Contributor

This is great 👍 can't wait to see the performance and set a baseline.

bryce-b pushed a commit to bryce-b/kibana that referenced this pull request Aug 9, 2023
## Summary
This PR instruments the code to track a few key editor performance
metrics. This is to prepare for adding a Lens editor performance
journey.

Metrics
- initial load of main chart
  - time to load data
  - time to render
- time to initially load and render all suggestions

For this PR, each metric is reported to the console (commented out to
pass the linter). When the journey is added, the console statements will
be converted to analytics service calls so that they show up as metrics
in the journey dashboard.

I made a few changes to increase the accuracy of the metrics.
- wrapping render-complete callbacks in `requestAnimationFrame` calls as
a temporary solution to
elastic/elastic-charts#2124
- fixing a multiple-subscription issue in the workspace panel

---------

Co-authored-by: Stratoula Kalafateli <[email protected]>
dmlemeshko added a commit that referenced this pull request Aug 17, 2023
…zation and suggestions panel (#163412)

## Summary

Related to #163089

Adding the first performance journey for the Lens Editor. It simulated
loading existing Lens visualisation with data view having 10k fields.

We collect the following metrics:
- `fetchFieldsExistenceInfo` reports time it takes to fetch fields in
Data Panel
- `lensVisualizationRenderTime` reports both time it takes to fetch the
data (`time_to_data`) and render the main visualization
(`time_to_render`)
- `lensSuggestionsRenderTime` reports time it takes to render
suggestions panel

Metrics consistency

<img width="568" alt="image"
src="https://github.com/elastic/kibana/assets/10977896/3384bb8e-6152-4bae-93dc-4f7f4167ed07">

Run locally with 
```
node scripts/functional_tests --config x-pack/performance/journeys/many_fields_lens_editor.ts
```

Metrics will be available here 

https://telemetry-v2-staging.elastic.dev/s/kibana-performance/app/dashboards#/view/dd0473ac-826f-5621-9a10-25319700326e?_g=h@61c5ac8

---------

Co-authored-by: Drew Tate <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 17, 2023
…zation and suggestions panel (elastic#163412)

## Summary

Related to elastic#163089

Adding the first performance journey for the Lens Editor. It simulated
loading existing Lens visualisation with data view having 10k fields.

We collect the following metrics:
- `fetchFieldsExistenceInfo` reports time it takes to fetch fields in
Data Panel
- `lensVisualizationRenderTime` reports both time it takes to fetch the
data (`time_to_data`) and render the main visualization
(`time_to_render`)
- `lensSuggestionsRenderTime` reports time it takes to render
suggestions panel

Metrics consistency

<img width="568" alt="image"
src="https://github.com/elastic/kibana/assets/10977896/3384bb8e-6152-4bae-93dc-4f7f4167ed07">

Run locally with
```
node scripts/functional_tests --config x-pack/performance/journeys/many_fields_lens_editor.ts
```

Metrics will be available here

https://telemetry-v2-staging.elastic.dev/s/kibana-performance/app/dashboards#/view/dd0473ac-826f-5621-9a10-25319700326e?_g=h@61c5ac8

---------

Co-authored-by: Drew Tate <[email protected]>
(cherry picked from commit 15b118c)
kibanamachine added a commit that referenced this pull request Aug 17, 2023
…visualization and suggestions panel (#163412) (#164153)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Lens] add performance journey to track rendering time for XY
visualization and suggestions panel
(#163412)](#163412)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-17T10:01:03Z","message":"[Lens]
add performance journey to track rendering time for XY visualization and
suggestions panel (#163412)\n\n## Summary\r\n\r\nRelated to
#163089\r\n\r\nAdding the first performance journey for the Lens Editor.
It simulated\r\nloading existing Lens visualisation with data view
having 10k fields.\r\n\r\nWe collect the following metrics:\r\n-
`fetchFieldsExistenceInfo` reports time it takes to fetch fields
in\r\nData Panel\r\n- `lensVisualizationRenderTime` reports both time it
takes to fetch the\r\ndata (`time_to_data`) and render the main
visualization\r\n(`time_to_render`)\r\n- `lensSuggestionsRenderTime`
reports time it takes to render\r\nsuggestions panel\r\n\r\nMetrics
consistency\r\n\r\n<img width=\"568\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/10977896/3384bb8e-6152-4bae-93dc-4f7f4167ed07\">\r\n\r\nRun
locally with \r\n```\r\nnode scripts/functional_tests --config
x-pack/performance/journeys/many_fields_lens_editor.ts\r\n```\r\n\r\nMetrics
will be available here
\r\n\r\nhttps://telemetry-v2-staging.elastic.dev/s/kibana-performance/app/dashboards#/view/dd0473ac-826f-5621-9a10-25319700326e?_g=h@61c5ac8\r\n\r\n---------\r\n\r\nCo-authored-by:
Drew Tate
<[email protected]>","sha":"15b118c724d174d1482ae9a31f9e87dccfe2a66c","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["performance","release_note:skip","v8.10.0","v8.11.0"],"number":163412,"url":"https://github.com/elastic/kibana/pull/163412","mergeCommit":{"message":"[Lens]
add performance journey to track rendering time for XY visualization and
suggestions panel (#163412)\n\n## Summary\r\n\r\nRelated to
#163089\r\n\r\nAdding the first performance journey for the Lens Editor.
It simulated\r\nloading existing Lens visualisation with data view
having 10k fields.\r\n\r\nWe collect the following metrics:\r\n-
`fetchFieldsExistenceInfo` reports time it takes to fetch fields
in\r\nData Panel\r\n- `lensVisualizationRenderTime` reports both time it
takes to fetch the\r\ndata (`time_to_data`) and render the main
visualization\r\n(`time_to_render`)\r\n- `lensSuggestionsRenderTime`
reports time it takes to render\r\nsuggestions panel\r\n\r\nMetrics
consistency\r\n\r\n<img width=\"568\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/10977896/3384bb8e-6152-4bae-93dc-4f7f4167ed07\">\r\n\r\nRun
locally with \r\n```\r\nnode scripts/functional_tests --config
x-pack/performance/journeys/many_fields_lens_editor.ts\r\n```\r\n\r\nMetrics
will be available here
\r\n\r\nhttps://telemetry-v2-staging.elastic.dev/s/kibana-performance/app/dashboards#/view/dd0473ac-826f-5621-9a10-25319700326e?_g=h@61c5ac8\r\n\r\n---------\r\n\r\nCo-authored-by:
Drew Tate
<[email protected]>","sha":"15b118c724d174d1482ae9a31f9e87dccfe2a66c"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163412","number":163412,"mergeCommit":{"message":"[Lens]
add performance journey to track rendering time for XY visualization and
suggestions panel (#163412)\n\n## Summary\r\n\r\nRelated to
#163089\r\n\r\nAdding the first performance journey for the Lens Editor.
It simulated\r\nloading existing Lens visualisation with data view
having 10k fields.\r\n\r\nWe collect the following metrics:\r\n-
`fetchFieldsExistenceInfo` reports time it takes to fetch fields
in\r\nData Panel\r\n- `lensVisualizationRenderTime` reports both time it
takes to fetch the\r\ndata (`time_to_data`) and render the main
visualization\r\n(`time_to_render`)\r\n- `lensSuggestionsRenderTime`
reports time it takes to render\r\nsuggestions panel\r\n\r\nMetrics
consistency\r\n\r\n<img width=\"568\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/10977896/3384bb8e-6152-4bae-93dc-4f7f4167ed07\">\r\n\r\nRun
locally with \r\n```\r\nnode scripts/functional_tests --config
x-pack/performance/journeys/many_fields_lens_editor.ts\r\n```\r\n\r\nMetrics
will be available here
\r\n\r\nhttps://telemetry-v2-staging.elastic.dev/s/kibana-performance/app/dashboards#/view/dd0473ac-826f-5621-9a10-25319700326e?_g=h@61c5ac8\r\n\r\n---------\r\n\r\nCo-authored-by:
Drew Tate
<[email protected]>","sha":"15b118c724d174d1482ae9a31f9e87dccfe2a66c"}},{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <[email protected]>
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 Feature:Lens performance release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants