From ba1ba0cb5e018004b3ec3f343a42e279073bdbc4 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Mon, 24 Aug 2020 11:41:47 -0600 Subject: [PATCH] Expose overall status to plugins (#75503) Co-authored-by: Elastic Machine --- ...a-plugin-core-server.statusservicesetup.md | 1 + ...core-server.statusservicesetup.overall_.md | 20 +++++++++++++++++++ src/core/server/legacy/legacy_service.ts | 1 + src/core/server/plugins/plugin_context.ts | 1 + src/core/server/server.api.md | 1 + src/core/server/status/status_service.mock.ts | 1 + src/core/server/status/types.ts | 15 ++++++++++---- 7 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 docs/development/core/server/kibana-plugin-core-server.statusservicesetup.overall_.md diff --git a/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md index 0551a217520ad7..3d3b73ccda25f8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md @@ -17,4 +17,5 @@ export interface StatusServiceSetup | Property | Type | Description | | --- | --- | --- | | [core$](./kibana-plugin-core-server.statusservicesetup.core_.md) | Observable<CoreStatus> | Current status for all Core services. | +| [overall$](./kibana-plugin-core-server.statusservicesetup.overall_.md) | Observable<ServiceStatus> | Overall system status for all of Kibana. | diff --git a/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.overall_.md b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.overall_.md new file mode 100644 index 00000000000000..bb7c31311d5200 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.overall_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) > [overall$](./kibana-plugin-core-server.statusservicesetup.overall_.md) + +## StatusServiceSetup.overall$ property + +Overall system status for all of Kibana. + +Signature: + +```typescript +overall$: Observable; +``` + +## Remarks + +The level of the overall status will reflect the most severe status of any core service or plugin. + +Exposed only for reporting purposes to outside systems and should not be used by plugins. Instead, plugins should only depend on the statuses of [Core](./kibana-plugin-core-server.statusservicesetup.core_.md) or their dependencies. + diff --git a/src/core/server/legacy/legacy_service.ts b/src/core/server/legacy/legacy_service.ts index 0c1e8562a1deb9..f39282a6f9cb0c 100644 --- a/src/core/server/legacy/legacy_service.ts +++ b/src/core/server/legacy/legacy_service.ts @@ -322,6 +322,7 @@ export class LegacyService implements CoreService { }, status: { core$: setupDeps.core.status.core$, + overall$: setupDeps.core.status.overall$, }, uiSettings: { register: setupDeps.core.uiSettings.register, diff --git a/src/core/server/plugins/plugin_context.ts b/src/core/server/plugins/plugin_context.ts index 5235f3ee6d580d..62058f6d478e7b 100644 --- a/src/core/server/plugins/plugin_context.ts +++ b/src/core/server/plugins/plugin_context.ts @@ -178,6 +178,7 @@ export function createPluginSetupContext( }, status: { core$: deps.status.core$, + overall$: deps.status.overall$, }, uiSettings: { register: deps.uiSettings.register, diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index afc71d39d4a624..cd7f4973f886c0 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -2802,6 +2802,7 @@ export type StartServicesAccessor; + overall$: Observable; } // @public diff --git a/src/core/server/status/status_service.mock.ts b/src/core/server/status/status_service.mock.ts index c6eb11be6967c7..47ef8659b40796 100644 --- a/src/core/server/status/status_service.mock.ts +++ b/src/core/server/status/status_service.mock.ts @@ -39,6 +39,7 @@ const availableCoreStatus: CoreStatus = { const createSetupContractMock = () => { const setupContract: jest.Mocked = { core$: new BehaviorSubject(availableCoreStatus), + overall$: new BehaviorSubject(available), }; return setupContract; diff --git a/src/core/server/status/types.ts b/src/core/server/status/types.ts index b04c25a1eee933..2ecf11deb2960e 100644 --- a/src/core/server/status/types.ts +++ b/src/core/server/status/types.ts @@ -123,13 +123,20 @@ export interface StatusServiceSetup { * Current status for all Core services. */ core$: Observable; -} -/** @internal */ -export interface InternalStatusServiceSetup extends StatusServiceSetup { /** - * Overall system status used for HTTP API + * Overall system status for all of Kibana. + * + * @remarks + * The level of the overall status will reflect the most severe status of any core service or plugin. + * + * Exposed only for reporting purposes to outside systems and should not be used by plugins. Instead, plugins should + * only depend on the statuses of {@link StatusServiceSetup.core$ | Core} or their dependencies. */ overall$: Observable; +} + +/** @internal */ +export interface InternalStatusServiceSetup extends StatusServiceSetup { isStatusPageAnonymous: () => boolean; }