elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.51k stars 8.06k forks source link

Stricter Setup / Start API separation #66366

Open mshustov opened 4 years ago

mshustov commented 4 years ago

From the very beginning Kibana platform uses a notion of lifecycles to separate runtime process into different stages:

However, all the stages exist merely as a convention. This has led to the fact that plugins (and the platform itself) mix functionality up and provide runtime API from setup phase. As a result, when the platform decided to refactor public contracts we have realized it cannot be done due to the number of existing external dependencies. Not the full list of the blocked tasks:

To prevent problems in the future, we are going to reinforce the separation of the lifecycle stages. Otherwise, we have to add defensive checks in the code that API can be called, which is an error-prone approach. By default API exposed from start lifecycle stage unless it's crucial to move it to the setup stage

Suggestions:

Child tasks:

elasticmachine commented 4 years ago

Pinging @elastic/kibana-platform (Team:Platform)

mshustov commented 4 years ago

a preliminary list of changes on the server side to understand the magnitude of refactoring:

joshdover commented 4 years ago

context service API

I believe this one should still be in setup since it is used to expose a context provider registry to other plugins.

pgayvallet commented 4 years ago

all the http API except create router

We even want to move to start the lifecycle hook registrations such as registerOnPreAuth ?

mshustov commented 2 years ago

We are going to start with logging a warning whenever lifecycle API is called outside of the current lifecycle timeframe https://github.com/elastic/kibana/issues/124039