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

[shared-ui-deps] use a single global version of lodash #78100

Merged
merged 11 commits into from
Sep 24, 2020

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Sep 22, 2020

Now that we have a unified lodash version thanks to #69868 we can share lodash from the ui-shared-deps without any functional issues. This reduces the page load asset size dramatically, and lowers all the other metrics too (a good thing).

This means that every bit of front-end code that imports lodash will be forced to use the shared version of lodash, currently 4.17.20.

I don't expect this to last forever, or even for long. Lodash is one of those packages that is used so widely that maybe it's impractical to try and stop using it. lodash v5 is a possible issue that we may have to deal with sooner rather than later, but maybe we'll get lucky and be able to ship a single copy of lodash v4 forever.

To attempt to at least make it clear when we're slipping back I've implemented two checks in the kbn/pm bootstrap command. The first validates that there is only a single version of lodash v4 in the yarn.lock file. If multiple are detected then all will be removed from the file and an error will be printed instructing the user to re-bootstrap to trigger an update of all lodash versions.

image

The second check crawls through all the production dependencies (including transitive dependencies) of the kibana and x-pack projects as defined in the yarn.lock file. If there are any lodash v3 versions in the discovered dependencies an error will be logged instructing the user to either use a new dependency or to chat with the operations team about other options.

image

@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.10.0 labels Sep 22, 2020
@spalger
Copy link
Contributor Author

spalger commented Sep 22, 2020

@elasticmachine merge upstream

@spalger spalger force-pushed the share/lodash branch 2 times, most recently from 8fe3186 to d3bc307 Compare September 22, 2020 07:01
@spalger spalger marked this pull request as ready for review September 22, 2020 17:44
@spalger spalger requested a review from a team as a code owner September 22, 2020 17:44
@elasticmachine
Copy link
Contributor

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

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics

@kbn/optimizer bundle module count

id value diff baseline
advancedSettings 50 -3 53
apm 1251 -1 1252
beatsManagement 302 -2 304
canvas 1133 -1 1134
charts 31 -3 34
console 160 -3 163
core 561 -1 562
crossClusterReplication 159 -1 160
dashboard 171 -1 172
dashboardEnhanced 26 -3 29
dashboardMode 4 -3 7
data 567 -1 568
dataEnhanced 17 -3 20
devTools 17 -3 20
discover 251 -3 254
embeddable 91 -3 94
esUiShared 227 -2 229
expressions 107 -2 109
fileUpload 24 -3 27
graph 180 -1 181
grokdebugger 75 -1 76
home 211 -2 213
indexLifecycleManagement 204 -1 205
indexManagement 503 -1 504
indexPatternManagement 211 -3 214
infra 1123 -1 1124
inputControlVis 41 -3 44
inspector 62 -3 65
kibanaLegacy 122 -2 124
kibanaReact 289 -1 290
kibanaUtils 189 -1 190
lens 463 -2 465
logstash 193 -2 195
management 43 -3 46
maps 694 -1 695
mapsLegacy 139 -1 140
ml 1407 -1 1408
monitoring 624 -2 626
navigation 23 -3 26
observability 87 -3 90
painlessLab 40 -3 43
regionMap 14 -3 17
remoteClusters 141 -1 142
reporting 45 -1 46
rollup 179 -1 180
savedObjects 43 -3 46
savedObjectsManagement 135 -2 137
searchprofiler 73 -3 76
security 454 -1 455
securitySolution 1968 -3 1971
snapshotRestore 168 -3 171
spaces 224 -3 227
tileMap 20 -3 23
timelion 102 -3 105
triggers_actions_ui 253 -8 261
uiActions 31 -3 34
upgradeAssistant 117 -2 119
uptime 512 -1 513
visDefaultEditor 238 -2 240
visTypeMetric 25 -3 28
visTypeTable 42 -3 45
visTypeTimelion 45 -3 48
visTypeTimeseries 465 -1 466
visTypeVega 78 -2 80
visTypeVislib 275 -1 276
visualizations 133 -2 135
visualize 207 -2 209
watcher 222 -2 224
total -148

async chunks size

id value diff baseline
advancedSettings 63.8KB +72.0B 63.8KB
apm 4.1MB -137.4KB 4.2MB
beatsManagement 408.6KB +598.0B 408.0KB
canvas 1.4MB +2.5KB 1.4MB
console 993.8KB -140.4KB 1.1MB
crossClusterReplication 461.7KB +595.0B 461.1KB
discover 438.6KB +1.3KB 437.2KB
fileUpload 576.8KB -142.7KB 719.6KB
graph 1.3MB -142.2KB 1.4MB
grokdebugger 568.8KB -142.3KB 711.0KB
home 425.5KB -142.5KB 568.1KB
indexLifecycleManagement 229.2KB +691.0B 228.5KB
indexManagement 1.6MB +924.0B 1.6MB
indexPatternManagement 664.5KB -142.7KB 807.2KB
infra 4.2MB +7.3KB 4.2MB
kibanaReact 389.0KB +384.0B 388.6KB
lens 33.1KB +163.0B 32.9KB
logstash 217.1KB +209.0B 216.9KB
management 33.8KB -143.0KB 176.8KB
maps 3.3MB +4.7KB 3.3MB
ml 8.1MB +4.8KB 8.1MB
monitoring 1.2MB +4.4KB 1.2MB
observability 155.1KB -142.9KB 298.0KB
painlessLab 38.7KB -143.3KB 182.0KB
remoteClusters 231.7KB -142.4KB 374.0KB
rollup 330.1KB +859.0B 329.2KB
savedObjectsManagement 204.7KB +425.0B 204.2KB
searchprofiler 572.1KB -142.8KB 714.9KB
security 1.0MB +773.0B 1.0MB
securitySolution 10.2MB +45.6KB 10.2MB
snapshotRestore 620.3KB -143.2KB 763.5KB
timelion 455.5KB -141.8KB 597.3KB
triggers_actions_ui 893.3KB -85.2KB 978.6KB
upgradeAssistant 179.8KB -142.6KB 322.3KB
uptime 1.5MB -142.3KB 1.6MB
visTypeTable 6.7KB +48.0B 6.6KB
visTypeTimeseries 1.8MB +3.7KB 1.8MB
visTypeVega 1.4MB +586.0B 1.4MB
visualize 269.1KB -142.5KB 411.6KB
watcher 461.5KB -141.0KB 602.5KB
total -2.5MB

page load bundle size

id value diff baseline
advancedSettings 838.5KB -142.9KB 981.4KB
apm 44.1KB +66.0B 44.0KB
beatsManagement 439.1KB -142.5KB 581.6KB
canvas 1.2MB -140.0KB 1.3MB
charts 344.2KB -142.4KB 486.6KB
console 30.4KB +66.0B 30.3KB
core 1.1MB -141.6KB 1.2MB
crossClusterReplication 49.2KB -142.9KB 192.1KB
dashboard 567.8KB -141.5KB 709.3KB
dashboardEnhanced 43.1KB -142.8KB 185.9KB
dashboardMode 7.5KB -142.9KB 150.4KB
data 1.3MB -134.6KB 1.5MB
dataEnhanced 34.5KB -142.7KB 177.2KB
devTools 23.2KB -142.9KB 166.1KB
discover 87.2KB -142.9KB 230.0KB
embeddable 288.2KB -142.8KB 431.0KB
esUiShared 851.6KB -142.6KB 994.2KB
expressions 204.1KB -142.5KB 346.6KB
fileUpload 9.5KB +66.0B 9.4KB
graph 15.8KB +66.0B 15.8KB
grokdebugger 11.5KB +66.0B 11.4KB
home 26.7KB +66.0B 26.7KB
indexLifecycleManagement 89.3KB -142.8KB 232.1KB
indexManagement 120.3KB -142.9KB 263.2KB
indexPatternManagement 136.1KB +66.0B 136.0KB
infra 134.5KB -142.8KB 277.3KB
inputControlVis 154.1KB -142.1KB 296.2KB
inspector 134.6KB -142.9KB 277.4KB
kibanaLegacy 90.5KB -142.1KB 232.6KB
kibanaReact 124.0KB -142.6KB 266.7KB
kibanaUtils 177.0KB -141.9KB 318.9KB
lens 1009.7KB -141.7KB 1.1MB
logstash 37.6KB -142.4KB 180.1KB
management 30.4KB +26.0B 30.4KB
maps 158.8KB -142.8KB 301.6KB
mapsLegacy 816.2KB -141.7KB 957.9KB
ml 731.2KB -142.3KB 873.6KB
monitoring 160.1KB -142.5KB 302.6KB
navigation 21.9KB -142.8KB 164.7KB
observability 52.4KB +66.0B 52.3KB
painlessLab 161.0KB +26.0B 161.0KB
regionMap 302.9KB -142.7KB 445.6KB
remoteClusters 35.5KB +66.0B 35.4KB
reporting 162.3KB -142.1KB 304.3KB
rollup 80.3KB -142.8KB 223.1KB
savedObjects 93.2KB -142.6KB 235.8KB
savedObjectsManagement 83.5KB -142.7KB 226.2KB
searchprofiler 50.9KB +66.0B 50.8KB
security 163.3KB -142.3KB 305.7KB
securitySolution 585.0KB -225.6KB 810.6KB
snapshotRestore 62.7KB +26.0B 62.6KB
spaces 346.9KB -142.8KB 489.6KB
tileMap 314.7KB -142.5KB 457.2KB
timelion 14.6KB +66.0B 14.5KB
triggers_actions_ui 145.3KB -142.9KB 288.2KB
uiActions 80.7KB -142.8KB 223.5KB
upgradeAssistant 64.6KB +66.0B 64.5KB
uptime 25.2KB +66.0B 25.2KB
visDefaultEditor 397.8KB -141.7KB 539.5KB
visTypeMetric 51.3KB -142.8KB 194.1KB
visTypeTable 78.0KB -142.6KB 220.6KB
visTypeTimelion 183.4KB -142.3KB 325.7KB
visTypeTimeseries 136.9KB -142.8KB 279.7KB
visTypeVega 134.6KB -142.8KB 277.5KB
visTypeVislib 812.2KB -139.0KB 951.1KB
visualizations 271.2KB -141.2KB 412.4KB
visualize 41.4KB +66.0B 41.3KB
total -7.0MB

distributable file count

id value diff baseline
default 45869 -15 45884
oss 26612 -3 26615
total -18

History

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

log,
})!;

const xpackDeps = resolveDepsForProject({
Copy link
Member

Choose a reason for hiding this comment

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

@spalger once we move into a single package.json that one could be removed 🤓

Copy link
Member

@mistic mistic left a comment

Choose a reason for hiding this comment

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

That LGTM

@spalger spalger merged commit ece2e6f into elastic:master Sep 24, 2020
@spalger spalger deleted the share/lodash branch September 24, 2020 16:45
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