mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Revert "[Reporting] Fix task manager not to run tasks before Kibana is initialized (#162364)
## Summary
This reverts commit e774ece489
.
Reporting registers tasks with Task Manager in its setup phase, but
today, it's own start phase is not guaranteed to initialize. During
initialization, Reporting injects dependencies into the objects
responsible for internal handling of tasks.
The `Kibana instance ID is undefined` error can happen when Task Manager
calls the runTask before the "execute report" object receives its
dependencies.
The `Reporting task runner has not been initialized` error can happen
when a user or a Watch trigger tries to request report generation before
internal dependencies are set. This can also happen if Reporting
attempts to retry a stuck job before the internal dependencies are set.
Initializing the task objects (execute_report, monitor_reports) is
mission-critical for Reporting internals. The tasks were register in our
setup method. That means, we need to prioritize getting the start
dependencies into the task objects in the code - it can't be blocked.
This commit is contained in:
parent
1c7eff0204
commit
e1d188287c
1 changed files with 2 additions and 15 deletions
|
@ -21,7 +21,7 @@ import type {
|
|||
StatusServiceSetup,
|
||||
UiSettingsServiceStart,
|
||||
} from '@kbn/core/server';
|
||||
import { CoreKibanaRequest, ServiceStatusLevels } from '@kbn/core/server';
|
||||
import { CoreKibanaRequest } from '@kbn/core/server';
|
||||
import type { PluginStart as DataPluginStart } from '@kbn/data-plugin/server';
|
||||
import type { DiscoverServerPluginStart } from '@kbn/discover-plugin/server';
|
||||
import type { PluginSetupContract as FeaturesPluginSetup } from '@kbn/features-plugin/server';
|
||||
|
@ -42,7 +42,7 @@ import type {
|
|||
} from '@kbn/task-manager-plugin/server';
|
||||
import type { UsageCounter } from '@kbn/usage-collection-plugin/server';
|
||||
import * as Rx from 'rxjs';
|
||||
import { filter, first, map, switchMap, take } from 'rxjs/operators';
|
||||
import { map, switchMap, take } from 'rxjs/operators';
|
||||
import type { ReportingSetup } from '.';
|
||||
import { REPORTING_REDIRECT_LOCATOR_STORE_KEY } from '../common/constants';
|
||||
import { createConfig, ReportingConfigType } from './config';
|
||||
|
@ -158,8 +158,6 @@ export class ReportingCore {
|
|||
this.pluginStart$.next(startDeps); // trigger the observer
|
||||
this.pluginStartDeps = startDeps; // cache
|
||||
|
||||
await this.assertKibanaIsAvailable();
|
||||
|
||||
const { taskManager } = startDeps;
|
||||
const { executeTask, monitorTask } = this;
|
||||
// enable this instance to generate reports and to monitor for pending reports
|
||||
|
@ -174,17 +172,6 @@ export class ReportingCore {
|
|||
return this.kibanaShuttingDown$.pipe(take(1));
|
||||
}
|
||||
|
||||
private async assertKibanaIsAvailable(): Promise<void> {
|
||||
const { status } = this.getPluginSetupDeps();
|
||||
|
||||
await status.overall$
|
||||
.pipe(
|
||||
filter((current) => current.level === ServiceStatusLevels.available),
|
||||
first()
|
||||
)
|
||||
.toPromise();
|
||||
}
|
||||
|
||||
/*
|
||||
* Blocks the caller until setup is done
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue