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

[kbn/optimizer] report sizes of assets produced by optimizer #71319

Merged
merged 18 commits into from
Jul 15, 2020

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jul 9, 2020

In #66224 we attempted to capture the file size of all assets which are loaded when you access any page in Kibana. This includes styles, font, images, js, and async js chunks which are consistently loaded simply by visiting any page of Kibana. We did this by creating a custom FTR config which started Kibana with some basic data, then using Puppeteer and the Chrome DevTools protocol to load up a handful of pages and inspecting the network requests which happen on all of the pages. It turns out the CDP does not have a mechanism for getting the uncompressed sizes of assets loaded in the browser (compression is surprisingly non-deterministic) and the mechanism we ended up using seems to rely on events that don't get delivered reliably enough.

This PR reverts #66224 and replaces it with simple analysis of the files produced by the optimizer. It doesn't track assets like the size of EUI styles, images, fonts, etc. But it does track three new metrics:

  1. page load bundle size, the size of the "entry" bundle for each plugin, this will always be loaded on every page by the platform/server and includes all code that is synchronously imported from the public/index file of a plugin
  2. async chunks size, the sum size of all the asynchronously loaded chunks that a bundle creates by using async import() statements in their code. It's unknown which of these chunks load when, and that can change at any moment, but it can generally be assumed that the page load bundle size + async chunks size represents the total JS produced by a single plugin.
  3. miscellaneous assets size, this represents the sum size of other assets created by a bundle which aren't simply TS/JS and can include images, fonts, or other assets which are configured at the import site. We don't have much visibility into these assets but it is assumed that plugins will load them at some time so we want to keep an eye on how their size changes over time.

@spalger spalger added Team:Operations Team label for Operations Team v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.9.0 labels Jul 9, 2020
@spalger spalger marked this pull request as ready for review July 10, 2020 19:19
@spalger spalger requested a review from a team as a code owner July 10, 2020 19:19
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@spalger
Copy link
Contributor Author

spalger commented Jul 14, 2020

@elasticmachine merge upstream

@spalger spalger requested a review from tylersmalley July 14, 2020 17:01
@spalger spalger requested a review from mshustov July 14, 2020 17:01
@spalger
Copy link
Contributor Author

spalger commented Jul 14, 2020

@elasticmachine merge upstream

@tylersmalley
Copy link
Contributor

LGTM

I can't recall if we currently do any filtering to the Build metrics comment output. We're only including log lines when they differ from the baseline, correct?

@spalger
Copy link
Contributor Author

spalger commented Jul 14, 2020

That's correct

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
advancedSettings 89.0KB +89.0KB -
apm 5.2MB +5.2MB -
beats_management 535.6KB +535.6KB -
canvas 2.1MB +2.1MB -
charts 73.9KB +73.9KB -
console 1.6MB +1.6MB -
crossClusterReplication 586.7KB +586.7KB -
devTools 9.6KB +9.6KB -
discover 612.0KB +612.0KB -
enterpriseSearch 207.4KB +207.4KB -
graph 2.0MB +2.0MB -
grokdebugger 1001.4KB +1001.4KB -
home 714.0KB +714.0KB -
indexLifecycleManagement 359.4KB +359.4KB -
indexManagement 2.0MB +2.0MB -
indexPatternManagement 973.4KB +973.4KB -
infra 4.7MB +4.7MB -
ingestManager 1.5MB +1.5MB -
ingestPipelines 759.0KB +759.0KB -
kibanaLegacy 189.4KB +189.4KB -
lens 35.8KB +35.8KB -
licenseManagement 226.1KB +226.1KB -
logstash 297.5KB +297.5KB -
management 255.3KB +255.3KB -
maps 5.2MB +5.2MB -
ml 20.9KB +20.9KB -
monitoring 1.5MB +1.5MB -
observability 440.9KB +440.9KB -
painlessLab 263.0KB +263.0KB -
regionMap 73.9KB +73.9KB -
remoteClusters 514.0KB +514.0KB -
rollup 436.2KB +436.2KB -
savedObjectsManagement 207.6KB +207.6KB -
searchprofiler 1.0MB +1.0MB -
security 1.4MB +1.4MB -
securitySolution 9.0MB +9.0MB -
snapshotRestore 947.7KB +947.7KB -
spaces 63.9KB +63.9KB -
tileMap 73.9KB +73.9KB -
timelion 840.2KB +840.2KB -
transform 947.4KB +947.4KB -
triggers_actions_ui 917.1KB +917.1KB -
upgradeAssistant 420.8KB +420.8KB -
uptime 838.2KB +838.2KB -
visTypeMarkdown 67.4KB +67.4KB -
visTypeMetric 64.4KB +64.4KB -
visTypeTable 74.4KB +74.4KB -
visTypeTagcloud 64.4KB +64.4KB -
visTypeTimelion 64.4KB +64.4KB -
visTypeTimeseries 2.4MB +2.4MB -
visTypeVega 2.1MB +2.1MB -
visTypeVislib 64.4KB +64.4KB -
visualize 933.8KB +933.8KB -
watcher 770.5KB +770.5KB -
total - +57.3MB -

miscellaneous assets size

id value diff baseline
advancedSettings 402.2KB +402.2KB -
alerts 33.7KB +33.7KB -
apm 210.8KB +210.8KB -
apmOss 2.3KB +2.3KB -
beats_management 219.0KB +219.0KB -
bfetch 11.4KB +11.4KB -
canvas 515.6KB +515.6KB -
charts 346.6KB +346.6KB -
cloud 3.7KB +3.7KB -
console 12.7KB +12.7KB -
core 458.7KB +458.7KB -
crossClusterReplication 84.3KB +84.3KB -
dashboard 255.5KB +255.5KB -
dashboardEnhanced 79.3KB +79.3KB -
dashboardMode 69.1KB +69.1KB -
data 395.2KB +395.2KB -
dataEnhanced 78.2KB +78.2KB -
devTools 76.3KB +76.3KB -
discover 99.0KB +99.0KB -
discoverEnhanced 9.6KB +9.6KB -
embeddable 131.2KB +131.2KB -
embeddableEnhanced 9.7KB +9.7KB -
enterpriseSearch 576.3KB +576.3KB -
esUiShared 389.6KB +389.6KB -
expressions 129.4KB +129.4KB -
features 4.7KB +4.7KB -
fileUpload 297.3KB +297.3KB -
globalSearch 11.7KB +11.7KB -
globalSearchProviders 5.5KB +5.5KB -
graph 8.3KB +8.3KB -
grokdebugger 6.6KB +6.6KB -
home 11.1KB +11.1KB -
indexLifecycleManagement 95.0KB +95.0KB -
indexManagement 99.5KB +99.5KB -
indexPatternManagement 33.4KB +33.4KB -
infra 118.0KB +118.0KB -
ingestManager 155.5KB +155.5KB -
ingestPipelines 10.7KB +10.7KB -
inputControlVis 105.6KB +105.6KB -
inspector 104.6KB +104.6KB -
kibanaLegacy 1.0MB +1.0MB -
kibanaReact 259.8KB +259.8KB -
kibanaUtils 214.3KB +214.3KB -
lens 270.2KB +270.2KB -
licenseManagement 12.7KB +12.7KB -
licensing 10.0KB +10.0KB -
lists 54.4KB +54.4KB -
logstash 79.9KB +79.9KB -
management 11.7KB +11.7KB -
maps 1.3MB +1.3MB -
mapsLegacy 429.6KB +429.6KB -
mapsLegacyLicensing 2.3KB +2.3KB -
ml 1.2MB +1.2MB -
monitoring 104.2KB +104.2KB -
navigation 74.2KB +74.2KB -
newsfeed 10.1KB +10.1KB -
observability 17.7KB +17.7KB -
painlessLab 82.6KB +82.6KB -
regionMap 333.7KB +333.7KB -
remoteClusters 15.3KB +15.3KB -
reporting 121.4KB +121.4KB -
rollup 98.5KB +98.5KB -
savedObjects 95.8KB +95.8KB -
savedObjectsManagement 88.4KB +88.4KB -
searchprofiler 15.9KB +15.9KB -
security 107.2KB +107.2KB -
securitySolution 654.2KB +654.2KB -
share 32.8KB +32.8KB -
snapshotRestore 19.7KB +19.7KB -
spaces 133.3KB +133.3KB -
statusPage 2.2KB +2.2KB -
telemetry 28.4KB +28.4KB -
telemetryManagementSection 9.7KB +9.7KB -
tileMap 339.2KB +339.2KB -
timelion 7.8KB +7.8KB -
transform 10.4KB +10.4KB -
triggers_actions_ui 103.8KB +103.8KB -
uiActions 86.4KB +86.4KB -
uiActionsEnhanced 40.3KB +40.3KB -
upgradeAssistant 22.6KB +22.6KB -
uptime 180.0KB +180.0KB -
usageCollection 10.6KB +10.6KB -
visTypeMarkdown 198.8KB +198.8KB -
visTypeMetric 206.4KB +206.4KB -
visTypeTable 223.5KB +223.5KB -
visTypeTagcloud 338.6KB +338.6KB -
visTypeTimelion 262.7KB +262.7KB -
visTypeTimeseries 107.7KB +107.7KB -
visTypeVega 228.1KB +228.1KB -
visTypeVislib 500.1KB +500.1KB -
visTypeXy 3.1KB +3.1KB -
visualizations 138.6KB +138.6KB -
visualize 16.6KB +16.6KB -
watcher 15.6KB +15.6KB -
total - +15.3MB -

page load bundle size

id value diff baseline
advancedSettings 981.0KB +981.0KB -
alerts 89.5KB +89.5KB -
apm 257.7KB +257.7KB -
apmOss 4.2KB +4.2KB -
beats_management 562.8KB +562.8KB -
bfetch 28.7KB +28.7KB -
canvas 1.4MB +1.4MB -
charts 875.9KB +875.9KB -
cloud 6.2KB +6.2KB -
console 37.3KB +37.3KB -
core 1.2MB +1.2MB -
crossClusterReplication 192.3KB +192.3KB -
dashboard 688.6KB +688.6KB -
dashboardEnhanced 183.8KB +183.8KB -
dashboardMode 149.6KB +149.6KB -
data 1.4MB +1.4MB -
dataEnhanced 177.3KB +177.3KB -
devTools 168.5KB +168.5KB -
discover 229.7KB +229.7KB -
discoverEnhanced 27.9KB +27.9KB -
embeddable 446.8KB +446.8KB -
embeddableEnhanced 26.3KB +26.3KB -
enterpriseSearch 17.3KB +17.3KB -
esUiShared 988.8KB +988.8KB -
expressions 347.1KB +347.1KB -
features 13.4KB +13.4KB -
fileUpload 728.3KB +728.3KB -
globalSearch 29.0KB +29.0KB -
globalSearchProviders 9.7KB +9.7KB -
graph 15.3KB +15.3KB -
grokdebugger 11.2KB +11.2KB -
home 26.5KB +26.5KB -
indexLifecycleManagement 243.4KB +243.4KB -
indexManagement 256.0KB +256.0KB -
indexPatternManagement 138.2KB +138.2KB -
infra 296.5KB +296.5KB -
ingestManager 458.8KB +458.8KB -
ingestPipelines 30.7KB +30.7KB -
inputControlVis 300.4KB +300.4KB -
inspector 281.2KB +281.2KB -
kibanaLegacy 215.6KB +215.6KB -
kibanaReact 632.0KB +632.0KB -
kibanaUtils 471.3KB +471.3KB -
lens 863.8KB +863.8KB -
licenseManagement 27.4KB +27.4KB -
licensing 21.6KB +21.6KB -
lists 262.5KB +262.5KB -
logstash 181.7KB +181.7KB -
management 30.3KB +30.3KB -
maps 301.5KB +301.5KB -
mapsLegacy 959.9KB +959.9KB -
mapsLegacyLicensing 3.9KB +3.9KB -
ml 4.3MB +4.3MB -
monitoring 295.9KB +295.9KB -
navigation 164.3KB +164.3KB -
newsfeed 22.7KB +22.7KB -
observability 48.7KB +48.7KB -
painlessLab 161.6KB +161.6KB -
regionMap 834.5KB +834.5KB -
remoteClusters 35.2KB +35.2KB -
reporting 295.6KB +295.6KB -
rollup 224.2KB +224.2KB -
savedObjects 238.0KB +238.0KB -
savedObjectsManagement 216.6KB +216.6KB -
searchprofiler 66.1KB +66.1KB -
security 288.1KB +288.1KB -
securitySolution 867.8KB +867.8KB -
share 81.8KB +81.8KB -
snapshotRestore 62.9KB +62.9KB -
spaces 419.0KB +419.0KB -
statusPage 3.6KB +3.6KB -
telemetry 77.0KB +77.0KB -
telemetryManagementSection 27.5KB +27.5KB -
tileMap 847.7KB +847.7KB -
timelion 14.4KB +14.4KB -
transform 25.4KB +25.4KB -
triggers_actions_ui 265.1KB +265.1KB -
uiActions 203.6KB +203.6KB -
uiActionsEnhanced 132.1KB +132.1KB -
upgradeAssistant 50.9KB +50.9KB -
uptime 493.0KB +493.0KB -
usageCollection 24.5KB +24.5KB -
visTypeMarkdown 554.9KB +554.9KB -
visTypeMetric 581.8KB +581.8KB -
visTypeTable 610.6KB +610.6KB -
visTypeTagcloud 839.7KB +839.7KB -
visTypeTimelion 721.7KB +721.7KB -
visTypeTimeseries 320.3KB +320.3KB -
visTypeVega 631.4KB +631.4KB -
visTypeVislib 1.3MB +1.3MB -
visTypeXy 5.1KB +5.1KB -
visualizations 403.8KB +403.8KB -
visualize 30.8KB +30.8KB -
watcher 37.3KB +37.3KB -
total - +33.6MB -

History

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

@spalger spalger merged commit a0f7dce into elastic:master Jul 15, 2020
spalger pushed a commit to spalger/kibana that referenced this pull request Jul 15, 2020
…#71319)

* Revert "Report page load asset size (elastic#66224)"

This reverts commit 6f57fa0.

* [kbn/optimizer] report sizes of assets produced by optimizer

* coalese the fast-glob versions we're using to prevent additional installs

* update kbn/pm dist

* Revert "update kbn/pm dist"

This reverts commit 68e24f0.

* Revert "coalese the fast-glob versions we're using to prevent additional installs"

This reverts commit 4201fb6.

* remove fast-glob, just recursivly call readdirSync()

* update integration tests to use new chunk filename

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts
#	yarn.lock
spalger added a commit that referenced this pull request Jul 15, 2020
…71319) (#71878)

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@spalger spalger added v7.10.0 and removed v7.9.0 labels Jul 28, 2020
@spalger spalger deleted the implement/asset-size-metrics branch August 18, 2020 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants