-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alerting stack-monitoring PoC (#135365)
* Rate to counts * Adjusting titles * /s/units/unit * Uncommenting completely unrelated commented out code * More titles thrashing * wip * fix tests * fix api integration test to not take in consideration the formating * Adding technical preview badge * Renaming "Overdue Rules" to "Queued Rules" on the Kibana overview page * Updating tests, adding missed technicalPreview to metric * More snapshots being updated Co-authored-by: Xavier Mouligneau <[email protected]>
- Loading branch information
Showing
15 changed files
with
1,932 additions
and
384 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/monitoring/public/components/chart/get_technical_preview.js
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,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { chain } from 'lodash'; | ||
|
||
/* | ||
* Chart titles are taken from `metric.title` or `metric.label` fields in the series data. | ||
* Use title if found, otherwise use label | ||
*/ | ||
export function getTechnicalPreview(series = []) { | ||
return chain( | ||
series.map((s) => { | ||
return Boolean(s.metric.technicalPreview); | ||
}) | ||
) | ||
.first() | ||
.value(); | ||
} |
32 changes: 32 additions & 0 deletions
32
x-pack/plugins/monitoring/public/components/chart/get_technical_preview.test.js
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,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { getTechnicalPreview } from './get_technical_preview'; | ||
|
||
describe('getTechnicalPreview', function () { | ||
it('with metric.technicalPreview undefined', () => { | ||
const series = [{ metric: {} }, { metric: { technicalPreview: true } }]; | ||
expect(getTechnicalPreview(series)).to.be(false); | ||
}); | ||
|
||
it('with metric.technicalPreview false', () => { | ||
const series = [ | ||
{ metric: { technicalPreview: false } }, | ||
{ metric: { technicalPreview: true } }, | ||
]; | ||
expect(getTechnicalPreview(series)).to.be(false); | ||
}); | ||
|
||
it('with metric.technicalPreview true', () => { | ||
const series = [ | ||
{ metric: { technicalPreview: true } }, | ||
{ metric: { technicalPreview: false } }, | ||
]; | ||
expect(getTechnicalPreview(series)).to.be(true); | ||
}); | ||
}); |
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
6 changes: 6 additions & 0 deletions
6
x-pack/plugins/monitoring/server/lib/details/__snapshots__/get_metrics.test.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
22 changes: 22 additions & 0 deletions
22
...oring/server/lib/elasticsearch/nodes/get_nodes/__snapshots__/handle_response.test.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.