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

[Fleet] Migrate server-side plugin to synchronous lifecycle #90581

Closed
pgayvallet opened this issue Feb 8, 2021 · 0 comments · Fixed by #100033
Closed

[Fleet] Migrate server-side plugin to synchronous lifecycle #90581

pgayvallet opened this issue Feb 8, 2021 · 0 comments · Fixed by #100033
Assignees
Labels
Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture

Comments

@pgayvallet
Copy link
Contributor

Required for #53268

In #89562, we migrated almost all plugins to synchronous lifecycle

The server-side part of the fleet plugin was not migrated, because its start method is initializing a service asynchronously

public async start(core: CoreStart, plugins: FleetStartDeps): Promise<FleetStartContract> {
await appContextService.start({
elasticsearch: core.elasticsearch,

AppContextService.start is only asynchronous because it needs to wait for the initial config emission:

if (appContext.config$) {
this.config$ = appContext.config$;
const initialValue = await this.config$.pipe(first()).toPromise();
this.configSubject$ = new BehaviorSubject(initialValue);
this.config$.subscribe(this.configSubject$);
}

Now that we introduced a synchronous API to read a plugin's config in #88981, the service could be changed to be synchronous

Note that the only reason I didn't do it in *** is that I wasn't sure if the this.config$.subscribe(this.configSubject$); line was still making any sense now that we have synchronous config access, and wanted to let the owners decide on that one. but AFAIK the changes are trivial.

@elastic/fleet ideally, this would be done for 7.13

cc @elastic/kibana-core

@pgayvallet pgayvallet added the Team:Fleet Team label for Observability Data Collection Fleet team label Feb 8, 2021
@jen-huang jen-huang added the technical debt Improvement of the software architecture and operational architecture label Feb 8, 2021
@jen-huang jen-huang changed the title Migrate fleet server-side plugin to synchronous lifecycle [Fleet] Migrate server-side plugin to synchronous lifecycle Apr 26, 2021
@nchaulet nchaulet self-assigned this May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants