-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete migration of legacy status API
- Loading branch information
Showing
63 changed files
with
1,414 additions
and
2,466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-core-server.coresetup.metrics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CoreSetup](./kibana-plugin-core-server.coresetup.md) > [metrics](./kibana-plugin-core-server.coresetup.metrics.md) | ||
|
||
## CoreSetup.metrics property | ||
|
||
[MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
metrics: MetricsServiceSetup; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-core-server.metricsservicestart.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [MetricsServiceStart](./kibana-plugin-core-server.metricsservicestart.md) | ||
|
||
## MetricsServiceStart type | ||
|
||
APIs to retrieves metrics gathered and exposed by the core platform. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type MetricsServiceStart = MetricsServiceSetup; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { ServiceStatus, ServiceStatusLevels } from './types'; | ||
import { calculateLegacyStatus } from './legacy_status'; | ||
|
||
const available: ServiceStatus = { level: ServiceStatusLevels.available, summary: 'Available' }; | ||
const degraded: ServiceStatus = { | ||
level: ServiceStatusLevels.degraded, | ||
summary: 'This is degraded!', | ||
}; | ||
const unavailable: ServiceStatus = { | ||
level: ServiceStatusLevels.unavailable, | ||
summary: 'This is unavailable!', | ||
}; | ||
const critical: ServiceStatus = { | ||
level: ServiceStatusLevels.critical, | ||
summary: 'This is critical!', | ||
}; | ||
|
||
describe('calculateLegacyStatus', () => { | ||
it('translates the overall status to the legacy format', () => { | ||
const legacyStatus = calculateLegacyStatus({ | ||
overall: available, | ||
core: {} as any, | ||
plugins: {}, | ||
versionWithoutSnapshot: '1.1.1', | ||
}); | ||
|
||
expect(legacyStatus.overall).toEqual({ | ||
state: 'green', | ||
title: 'Green', | ||
nickname: 'Looking good', | ||
icon: 'success', | ||
uiColor: 'secondary', | ||
since: expect.any(String), | ||
}); | ||
}); | ||
|
||
it('combines core and plugins statuses into statuses array in legacy format', () => { | ||
const legacyStatus = calculateLegacyStatus({ | ||
overall: available, | ||
core: { | ||
elasticsearch: degraded, | ||
savedObjects: critical, | ||
}, | ||
plugins: { | ||
a: available, | ||
b: unavailable, | ||
c: degraded, | ||
}, | ||
versionWithoutSnapshot: '1.1.1', | ||
}); | ||
|
||
expect(legacyStatus.statuses).toEqual([ | ||
{ | ||
icon: 'warning', | ||
id: 'core:[email protected]', | ||
message: 'This is degraded!', | ||
since: expect.any(String), | ||
state: 'yellow', | ||
uiColor: 'warning', | ||
}, | ||
{ | ||
icon: 'danger', | ||
id: 'core:[email protected]', | ||
message: 'This is critical!', | ||
since: expect.any(String), | ||
state: 'red', | ||
uiColor: 'danger', | ||
}, | ||
{ | ||
icon: 'success', | ||
id: 'plugin:[email protected]', | ||
message: 'Available', | ||
since: expect.any(String), | ||
state: 'green', | ||
uiColor: 'secondary', | ||
}, | ||
{ | ||
icon: 'danger', | ||
id: 'plugin:[email protected]', | ||
message: 'This is unavailable!', | ||
since: expect.any(String), | ||
state: 'red', | ||
uiColor: 'danger', | ||
}, | ||
{ | ||
icon: 'warning', | ||
id: 'plugin:[email protected]', | ||
message: 'This is degraded!', | ||
since: expect.any(String), | ||
state: 'yellow', | ||
uiColor: 'warning', | ||
}, | ||
]); | ||
}); | ||
}); |
Oops, something went wrong.