-
-
- There is no data for the current selections.
-
+
+ There is no data for the current selections.
`;
diff --git a/public/pages/CreateMonitor/components/VisualGraph/utils/helpers.test.js b/public/pages/CreateMonitor/components/VisualGraph/utils/helpers.test.js
index e4588a058..d899abd23 100644
--- a/public/pages/CreateMonitor/components/VisualGraph/utils/helpers.test.js
+++ b/public/pages/CreateMonitor/components/VisualGraph/utils/helpers.test.js
@@ -40,12 +40,13 @@ import {
} from './helpers';
import { DEFAULT_MARK_SIZE } from './constants';
import { FORMIK_INITIAL_VALUES } from '../../../containers/CreateMonitor/utils/constants';
+import { MONITOR_TYPE } from '../../../../../utils/constants';
describe('getYTitle', () => {
test('returns count when empty array, undefined, or null', () => {
- expect(getYTitle([])).toBe('count');
- expect(getYTitle(undefined)).toBe('count');
- expect(getYTitle(null)).toBe('count');
+ expect(getYTitle([])).toBe('doc_count');
+ expect(getYTitle(undefined)).toBe('doc_count');
+ expect(getYTitle(null)).toBe('doc_count');
});
});
@@ -154,24 +155,6 @@ describe('getMarkData', () => {
});
});
-describe('getAggregationTitle', () => {
- test('gets count aggregation type title', () => {
- const formikValues = _.cloneDeep(FORMIK_INITIAL_VALUES);
- expect(getAggregationTitle(formikValues)).toBe(
- 'WHEN count() OVER all documents FOR THE LAST 1 hour(s)'
- );
- });
-
- test('gets avg aggregation type title', () => {
- const formikValues = _.cloneDeep(FORMIK_INITIAL_VALUES);
- formikValues.aggregationType = 'avg';
- formikValues.fieldName = [{ label: 'bytes' }];
- expect(getAggregationTitle(formikValues)).toBe(
- 'WHEN average() OF bytes OVER all documents FOR THE LAST 1 hour(s)'
- );
- });
-});
-
describe('getDataFromResponse', () => {
test('gets empty array when no response', () => {
expect(getDataFromResponse(null)).toEqual([]);
@@ -188,67 +171,67 @@ describe('getDataFromResponse', () => {
from_as_string: '2018-10-31T18:00:00.000-07:00',
key: 1541034000000,
doc_count: 32,
- when: { value: 5705.40625 },
+ metric: { value: 5705.40625 },
},
{
key_as_string: '2018-10-31T19:00:00.000-07:00',
from_as_string: '2018-10-31T19:00:00.000-07:00',
key: 1541037600000,
doc_count: 67,
- when: { value: 6185.373134328358 },
+ metric: { value: 6185.373134328358 },
},
{
key_as_string: '2018-10-31T20:00:00.000-07:00',
from_as_string: '2018-10-31T20:00:00.000-07:00',
key: 1541041200000,
doc_count: 79,
- when: { value: -2439.9367088607596 },
+ metric: { value: -2439.9367088607596 },
},
{
key_as_string: '2018-10-31T21:00:00.000-07:00',
from_as_string: '2018-10-31T21:00:00.000-07:00',
key: 1541044800000,
doc_count: 31,
- when: { value: null },
+ metric: { value: null },
},
{
key_as_string: '2018-10-31T22:00:00.000-07:00',
from_as_string: '2018-10-31T22:00:00.000-07:00',
key: 1541048400000,
doc_count: 18,
- when: { value: 4651.5 },
+ metric: { value: 4651.5 },
},
{
key_as_string: '2018-10-31T23:00:00.000-07:00',
from_as_string: '2018-10-31T23:00:00.000-07:00',
key: 1541052000000,
doc_count: 3,
- when: { value: 4410.666666666667 },
+ metric: { value: 4410.666666666667 },
},
],
},
},
};
- expect(getDataFromResponse(response)).toEqual([
+ expect(getDataFromResponse(response, 'metric', MONITOR_TYPE.QUERY_LEVEL)).toEqual([
{
x: new Date(response.aggregations.over.buckets[0].from_as_string),
- y: response.aggregations.over.buckets[0].when.value,
+ y: response.aggregations.over.buckets[0].metric.value,
},
{
x: new Date(response.aggregations.over.buckets[1].from_as_string),
- y: response.aggregations.over.buckets[1].when.value,
+ y: response.aggregations.over.buckets[1].metric.value,
},
{
x: new Date(response.aggregations.over.buckets[2].from_as_string),
- y: response.aggregations.over.buckets[2].when.value,
+ y: response.aggregations.over.buckets[2].metric.value,
},
{
x: new Date(response.aggregations.over.buckets[4].from_as_string),
- y: response.aggregations.over.buckets[4].when.value,
+ y: response.aggregations.over.buckets[4].metric.value,
},
{
x: new Date(response.aggregations.over.buckets[5].from_as_string),
- y: response.aggregations.over.buckets[5].when.value,
+ y: response.aggregations.over.buckets[5].metric.value,
},
]);
});
@@ -261,11 +244,11 @@ describe('getXYValues', () => {
from_as_string: '2018-10-31T18:00:00.000-07:00',
key: 1541034000000,
doc_count: 32,
- when: { value: 5705.40625 },
+ metric: { value: 5705.40625 },
};
expect(getXYValues(whenBucket)).toEqual({
x: new Date(whenBucket.from_as_string),
- y: whenBucket.when.value,
+ y: whenBucket.metric.value,
});
});
diff --git a/public/pages/CreateMonitor/containers/AnomalyDetectors/__tests__/__snapshots__/AnomalyDetector.test.js.snap b/public/pages/CreateMonitor/containers/AnomalyDetectors/__tests__/__snapshots__/AnomalyDetector.test.js.snap
index a89b72633..741d3566c 100644
--- a/public/pages/CreateMonitor/containers/AnomalyDetectors/__tests__/__snapshots__/AnomalyDetector.test.js.snap
+++ b/public/pages/CreateMonitor/containers/AnomalyDetectors/__tests__/__snapshots__/AnomalyDetector.test.js.snap
@@ -5,6 +5,7 @@ exports[`AnomalyDetectors renders 1`] = `
initialValues={
Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -13,9 +14,16 @@ exports[`AnomalyDetectors renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -59,6 +67,7 @@ exports[`AnomalyDetectors renders 1`] = `
values={
Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -67,9 +76,16 @@ exports[`AnomalyDetectors renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -174,6 +190,7 @@ exports[`AnomalyDetectors renders 1`] = `
"initialTouched": Object {},
"initialValues": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -182,9 +199,16 @@ exports[`AnomalyDetectors renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -247,6 +271,7 @@ exports[`AnomalyDetectors renders 1`] = `
"validateOnMount": false,
"values": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -255,9 +280,16 @@ exports[`AnomalyDetectors renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -368,6 +400,7 @@ exports[`AnomalyDetectors renders 1`] = `
"initialTouched": Object {},
"initialValues": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -376,9 +409,16 @@ exports[`AnomalyDetectors renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -441,6 +481,7 @@ exports[`AnomalyDetectors renders 1`] = `
"validateOnMount": false,
"values": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -449,9 +490,16 @@ exports[`AnomalyDetectors renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
diff --git a/public/pages/CreateMonitor/containers/CreateMonitor/CreateMonitor.test.js b/public/pages/CreateMonitor/containers/CreateMonitor/CreateMonitor.test.js
index 826f971ff..6729d35d2 100644
--- a/public/pages/CreateMonitor/containers/CreateMonitor/CreateMonitor.test.js
+++ b/public/pages/CreateMonitor/containers/CreateMonitor/CreateMonitor.test.js
@@ -32,6 +32,7 @@ import { historyMock, httpClientMock } from '../../../../../test/mocks';
import { FORMIK_INITIAL_VALUES } from './utils/constants';
import AlertingFakes from '../../../../../test/utils/helpers';
import { SEARCH_TYPE } from '../../../../utils/constants';
+import { TRIGGER_TYPE } from '../../../CreateTrigger/containers/CreateTrigger/utils/constants';
const alertingFakes = new AlertingFakes('CreateMonitor random seed');
@@ -179,9 +180,10 @@ describe('CreateMonitor', () => {
});
describe('onUpdate', () => {
- test('calls updateMonitor with monitor with no triggers key', () => {
+ // Query-level monitor
+ test('calls updateMonitor with monitor', () => {
const monitor = alertingFakes.randomMonitor();
- const trigger = alertingFakes.randomTrigger();
+ const trigger = alertingFakes.randomTrigger(TRIGGER_TYPE.QUERY_LEVEL);
monitor.triggers = [trigger];
const wrapper = shallow(
{
);
wrapper.instance().onUpdate(monitor, formikBag);
expect(updateMonitor).toHaveBeenCalledTimes(1);
- // The updatedMonitor that is passed in should NOT have the trigger key
- const updatedMonitor = { ...monitor };
- delete updatedMonitor.triggers;
- expect(updateMonitor).toHaveBeenCalledWith(updatedMonitor);
+ expect(updateMonitor).toHaveBeenCalledWith(monitor);
});
test('logs error when updateMonitor rejects', async () => {
diff --git a/public/pages/CreateMonitor/containers/CreateMonitor/__snapshots__/CreateMonitor.test.js.snap b/public/pages/CreateMonitor/containers/CreateMonitor/__snapshots__/CreateMonitor.test.js.snap
index 59ec5a38e..b65783ed8 100644
--- a/public/pages/CreateMonitor/containers/CreateMonitor/__snapshots__/CreateMonitor.test.js.snap
+++ b/public/pages/CreateMonitor/containers/CreateMonitor/__snapshots__/CreateMonitor.test.js.snap
@@ -12,6 +12,7 @@ exports[`CreateMonitor renders 1`] = `
initialValues={
Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -20,9 +21,16 @@ exports[`CreateMonitor renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
diff --git a/public/pages/CreateMonitor/containers/CreateMonitor/utils/__snapshots__/formikToMonitor.test.js.snap b/public/pages/CreateMonitor/containers/CreateMonitor/utils/__snapshots__/formikToMonitor.test.js.snap
index 086712815..a898d4d74 100644
--- a/public/pages/CreateMonitor/containers/CreateMonitor/utils/__snapshots__/formikToMonitor.test.js.snap
+++ b/public/pages/CreateMonitor/containers/CreateMonitor/utils/__snapshots__/formikToMonitor.test.js.snap
@@ -123,6 +123,7 @@ Object {
},
},
],
+ "monitor_type": "query_level_monitor",
"name": "random_name",
"schedule": Object {
"period": Object {
@@ -133,6 +134,7 @@ Object {
"triggers": Array [],
"type": "monitor",
"ui_metadata": Object {
+ "monitor_type": "query_level_monitor",
"schedule": Object {
"cronExpression": "0 */1 * * *",
"daily": 0,
@@ -157,13 +159,10 @@ Object {
},
},
"search": Object {
- "aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
- "fieldName": "bytes",
- "groupedOverFieldName": "bytes",
- "groupedOverTop": 5,
- "overDocuments": "all documents",
+ "groupBy": Array [],
"searchType": "graph",
"timeField": "",
"where": Object {
@@ -290,13 +289,10 @@ Object {
exports[`formikToUiSearch can build ui search 1`] = `
Object {
- "aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
- "fieldName": "bytes",
- "groupedOverFieldName": "bytes",
- "groupedOverTop": 5,
- "overDocuments": "all documents",
+ "groupBy": Array [],
"searchType": "graph",
"timeField": "@timestamp",
"where": Object {
@@ -311,13 +307,10 @@ Object {
exports[`formikToUiSearch can build ui search with range where field 1`] = `
Object {
- "aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
- "fieldName": "bytes",
- "groupedOverFieldName": "bytes",
- "groupedOverTop": 5,
- "overDocuments": "all documents",
+ "groupBy": Array [],
"searchType": "graph",
"timeField": "@timestamp",
"where": Object {
@@ -336,13 +329,10 @@ Object {
exports[`formikToUiSearch can build ui search with term where field 1`] = `
Object {
- "aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
- "fieldName": "bytes",
- "groupedOverFieldName": "bytes",
- "groupedOverTop": 5,
- "overDocuments": "all documents",
+ "groupBy": Array [],
"searchType": "graph",
"timeField": "@timestamp",
"where": Object {
@@ -360,12 +350,4 @@ Object {
exports[`formikToWhenAggregation can build when (count) aggregation 1`] = `Object {}`;
-exports[`formikToWhenAggregation can build when aggregation 1`] = `
-Object {
- "when": Object {
- "avg": Object {
- "field": "bytes",
- },
- },
-}
-`;
+exports[`formikToWhenAggregation can build when aggregation 1`] = `Object {}`;
diff --git a/public/pages/CreateMonitor/containers/DefineMonitor/__snapshots__/DefineMonitor.test.js.snap b/public/pages/CreateMonitor/containers/DefineMonitor/__snapshots__/DefineMonitor.test.js.snap
index 4945154f9..667ce9e32 100644
--- a/public/pages/CreateMonitor/containers/DefineMonitor/__snapshots__/DefineMonitor.test.js.snap
+++ b/public/pages/CreateMonitor/containers/DefineMonitor/__snapshots__/DefineMonitor.test.js.snap
@@ -1,104 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DefineMonitor renders 1`] = `
-
-
-
-
-
-
-
-
- You must specify an index.
-
-
-
-
-
-
-
-`;
-
-exports[`DefineMonitor should show warning in case of Ad monitor and plugin is not installed 1`] = `
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+ You must specify an index.
+
+
+
+
+
+
+`;
+
+exports[`DefineMonitor should show warning in case of Ad monitor and plugin is not installed 1`] = `
+
+
+ Run
+ ,
+ ]
+ }
+ bodyStyles={
+ Object {
+ "padding": "initial",
+ }
+ }
+ panelStyles={
+ Object {
+ "paddingLeft": "10px",
+ "paddingRight": "10px",
+ }
+ }
+ title="Query"
+ titleSize="s"
+ >
+
+
+
+
+
+
+ You must specify an index.
+
+
+
+
+
+
+
+
`;
diff --git a/public/pages/CreateMonitor/containers/MonitorIndex/__snapshots__/MonitorIndex.test.js.snap b/public/pages/CreateMonitor/containers/MonitorIndex/__snapshots__/MonitorIndex.test.js.snap
index daf14fde0..84940ee25 100644
--- a/public/pages/CreateMonitor/containers/MonitorIndex/__snapshots__/MonitorIndex.test.js.snap
+++ b/public/pages/CreateMonitor/containers/MonitorIndex/__snapshots__/MonitorIndex.test.js.snap
@@ -5,6 +5,7 @@ exports[`MonitorIndex renders 1`] = `
initialValues={
Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -13,9 +14,16 @@ exports[`MonitorIndex renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -97,7 +105,6 @@ exports[`MonitorIndex renders 1`] = `
"label": "Index",
"style": Object {
"paddingLeft": "10px",
- "textAlign": "center",
},
}
}
@@ -132,6 +139,7 @@ exports[`MonitorIndex renders 1`] = `
"initialTouched": Object {},
"initialValues": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -140,9 +148,16 @@ exports[`MonitorIndex renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -205,6 +220,7 @@ exports[`MonitorIndex renders 1`] = `
"validateOnMount": false,
"values": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -213,9 +229,16 @@ exports[`MonitorIndex renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -263,7 +286,6 @@ exports[`MonitorIndex renders 1`] = `
"label": "Index",
"style": Object {
"paddingLeft": "10px",
- "textAlign": "center",
},
}
}
@@ -282,7 +304,6 @@ exports[`MonitorIndex renders 1`] = `
style={
Object {
"paddingLeft": "10px",
- "textAlign": "center",
}
}
>
@@ -292,7 +313,6 @@ exports[`MonitorIndex renders 1`] = `
style={
Object {
"paddingLeft": "10px",
- "textAlign": "center",
}
}
>
@@ -345,6 +365,7 @@ exports[`MonitorIndex renders 1`] = `
"initialTouched": Object {},
"initialValues": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -353,9 +374,16 @@ exports[`MonitorIndex renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
@@ -418,6 +446,7 @@ exports[`MonitorIndex renders 1`] = `
"validateOnMount": false,
"values": Object {
"aggregationType": "count",
+ "aggregations": Array [],
"bucketUnitOfTime": "h",
"bucketValue": 1,
"cronExpression": "0 */1 * * *",
@@ -426,9 +455,16 @@ exports[`MonitorIndex renders 1`] = `
"disabled": false,
"fieldName": Array [],
"frequency": "interval",
+ "groupBy": Array [],
+ "groupByField": Array [
+ Object {
+ "label": "",
+ },
+ ],
"groupedOverFieldName": "bytes",
"groupedOverTop": 5,
"index": Array [],
+ "monitor_type": "query_level_monitor",
"monthly": Object {
"day": 1,
"type": "day",
diff --git a/public/pages/CreateTrigger/components/Action/actions/__snapshots__/Message.test.js.snap b/public/pages/CreateTrigger/components/Action/actions/__snapshots__/Message.test.js.snap
index 571472c2a..bfc62b2ed 100644
--- a/public/pages/CreateTrigger/components/Action/actions/__snapshots__/Message.test.js.snap
+++ b/public/pages/CreateTrigger/components/Action/actions/__snapshots__/Message.test.js.snap
@@ -4,7 +4,8 @@ exports[`Message renders 1`] = `
+
+
-
-
- Message preview
-
-
-
-
-
+
+ Action configuration
+