[7.x] Expose overall status to plugins (#75503) (#75800)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Josh Dover 2020-08-24 17:03:04 -06:00 committed by GitHub
parent f4b5c30b43
commit 84da659180
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 4 deletions

View file

@ -17,4 +17,5 @@ export interface StatusServiceSetup
| Property | Type | Description |
| --- | --- | --- |
| [core$](./kibana-plugin-core-server.statusservicesetup.core_.md) | <code>Observable&lt;CoreStatus&gt;</code> | Current status for all Core services. |
| [overall$](./kibana-plugin-core-server.statusservicesetup.overall_.md) | <code>Observable&lt;ServiceStatus&gt;</code> | Overall system status for all of Kibana. |

View file

@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) &gt; [overall$](./kibana-plugin-core-server.statusservicesetup.overall_.md)
## StatusServiceSetup.overall$ property
Overall system status for all of Kibana.
<b>Signature:</b>
```typescript
overall$: Observable<ServiceStatus>;
```
## 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.

View file

@ -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,

View file

@ -178,6 +178,7 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
},
status: {
core$: deps.status.core$,
overall$: deps.status.overall$,
},
uiSettings: {
register: deps.uiSettings.register,

View file

@ -2802,6 +2802,7 @@ export type StartServicesAccessor<TPluginsStart extends object = object, TStart
// @public
export interface StatusServiceSetup {
core$: Observable<CoreStatus>;
overall$: Observable<ServiceStatus>;
}
// @public

View file

@ -39,6 +39,7 @@ const availableCoreStatus: CoreStatus = {
const createSetupContractMock = () => {
const setupContract: jest.Mocked<StatusServiceSetup> = {
core$: new BehaviorSubject(availableCoreStatus),
overall$: new BehaviorSubject(available),
};
return setupContract;

View file

@ -123,13 +123,20 @@ export interface StatusServiceSetup {
* Current status for all Core services.
*/
core$: Observable<CoreStatus>;
/**
* 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<ServiceStatus>;
}
/** @internal */
export interface InternalStatusServiceSetup extends StatusServiceSetup {
/**
* Overall system status used for HTTP API
*/
overall$: Observable<ServiceStatus>;
isStatusPageAnonymous: () => boolean;
}