Skip to content

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

@pgayvallet

Description

@pgayvallet

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

Metadata

Metadata

Assignees

Labels

Team:FleetTeam label for Observability Data Collection Fleet teamtechnical debtImprovement of the software architecture and operational architecture

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions