From ccde474377b9d4ed45c9cacbad48a422f7966257 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 11:58:35 +0100 Subject: [PATCH 1/4] Fix monitor list down histogram --- .../uptime/server/lib/requests/get_monitor_states.ts | 2 +- x-pack/test/api_integration/apis/uptime/rest/index.ts | 3 +++ .../apis/uptime/rest/monitor_states_real_data.ts | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts b/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts index 020fcf5331188..2ff1043d79e84 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts @@ -151,7 +151,7 @@ export const getHistogramForMonitors = async ( }, }, }; - const result = await queryContext.search(params); + const { body: result } = await queryContext.search(params); const histoBuckets: any[] = result.aggregations?.histogram.buckets ?? []; const simplified = histoBuckets.map((histoBucket: any): { timestamp: number; byId: any } => { diff --git a/x-pack/test/api_integration/apis/uptime/rest/index.ts b/x-pack/test/api_integration/apis/uptime/rest/index.ts index f59b79a6b7bfc..6f410add0fa4d 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts @@ -9,12 +9,15 @@ import { settingsObjectId, settingsObjectType, } from '../../../../../plugins/uptime/server/lib/saved_objects'; +import { registerMochaHooksForSnapshots } from '../../../../apm_api_integration/common/match_snapshot'; export default function ({ getService, loadTestFile }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const server = getService('kibanaServer'); describe('uptime REST endpoints', () => { + registerMochaHooksForSnapshots(); + beforeEach('clear settings', async () => { try { await server.savedObjects.delete({ diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts index d3c49bb49ff52..077720ac0588b 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts @@ -9,6 +9,7 @@ import { isRight } from 'fp-ts/lib/Either'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { MonitorSummariesResultType } from '../../../../../plugins/uptime/common/runtime_types'; import { API_URLS } from '../../../../../plugins/uptime/common/constants'; +import { expectSnapshot } from '../../../../apm_api_integration/common/match_snapshot'; interface ExpectedMonitorStatesPage { response: any; @@ -90,6 +91,16 @@ export default function ({ getService }: FtrProviderContext) { }); }); + it('will fetch monitor state data for the given down filters', async () => { + const statusFilter = 'down'; + const size = 10; + const { body } = await supertest.get( + `${API_URLS.MONITOR_LIST}?dateRangeStart=${from}&dateRangeEnd=${to}&statusFilter=${statusFilter}&pageSize=${size}` + ); + + expectSnapshot(body).toMatch(); + }); + it('can navigate forward and backward using pagination', async () => { const expectedResultsCount = 100; const size = 10; From a8d741bca2c9e49dc1ab92bd94cfa0787cbb7f5d Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 12:21:20 +0100 Subject: [PATCH 2/4] snapshots --- .../monitor_states_real_data.snap | 1257 +++++++++++++++++ 1 file changed, 1257 insertions(+) create mode 100644 x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap diff --git a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap new file mode 100644 index 0000000000000..8e7ab2023722d --- /dev/null +++ b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap @@ -0,0 +1,1257 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`monitor states endpoint will fetch monitor state data for the given down filters 1`] = ` +Object { + "nextPagePagination": null, + "prevPagePagination": null, + "summaries": Array [ + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0010-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "rZtoHm0B0I9WX_CznN_V", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 41, + }, + "response_header": Object { + "us": 36777, + }, + "total": Object { + "us": 37821, + }, + "validate": Object { + "us": 36818, + }, + "write_request": Object { + "us": 53, + }, + }, + }, + "monitor": Object { + "check_group": "d76f07d1-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 37926, + }, + "id": "0010-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 56, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 890, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0020-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.372Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "X5toHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 54, + }, + "response_header": Object { + "us": 180, + }, + "total": Object { + "us": 555, + }, + "validate": Object { + "us": 234, + }, + "write_request": Object { + "us": 63, + }, + }, + }, + "monitor": Object { + "check_group": "d7712ecb-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 14900, + }, + "id": "0020-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 14294, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 105, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "timestamp": 1568172624744, + }, + Object { + "timestamp": 1568172677247, + }, + Object { + "timestamp": 1568172729750, + }, + Object { + "timestamp": 1568172782253, + }, + Object { + "timestamp": 1568172834756, + }, + Object { + "down": 1, + "timestamp": 1568172887259, + }, + Object { + "timestamp": 1568172939762, + }, + Object { + "down": 1, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 1, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0030-intermittent", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "eJtoHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "500 Internal Server Error", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "500", + "hash": "0604cd3138feed202ef293e062da2f4720f77a05d25ee036a7a01c9cfcdd1f0a", + }, + "status_code": 500, + }, + "rtt": Object { + "content": Object { + "us": 28, + }, + "response_header": Object { + "us": 197, + }, + "total": Object { + "us": 17068, + }, + "validate": Object { + "us": 225, + }, + "write_request": Object { + "us": 58, + }, + }, + }, + "monitor": Object { + "check_group": "d771299d-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 17146, + }, + "id": "0030-intermittent", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 33, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 16662, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.373Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.373Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0040-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.372Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "eZtoHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 29, + }, + "response_header": Object { + "us": 172, + }, + "total": Object { + "us": 18023, + }, + "validate": Object { + "us": 201, + }, + "write_request": Object { + "us": 28, + }, + }, + }, + "monitor": Object { + "check_group": "d76f5490-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 18106, + }, + "id": "0040-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 39, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 17766, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0050-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.386Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "dJtoHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 36, + }, + "response_header": Object { + "us": 213, + }, + "total": Object { + "us": 1011, + }, + "validate": Object { + "us": 249, + }, + "write_request": Object { + "us": 20, + }, + }, + }, + "monitor": Object { + "check_group": "d76f9a0c-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 4258, + }, + "id": "0050-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 3215, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 84, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.386Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.386Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0070-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "a5toHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 33, + }, + "response_header": Object { + "us": 190, + }, + "total": Object { + "us": 2015, + }, + "validate": Object { + "us": 223, + }, + "write_request": Object { + "us": 21, + }, + }, + }, + "monitor": Object { + "check_group": "d7712c5a-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 15117, + }, + "id": "0070-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 13061, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 84, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.375Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.375Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0080-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "oJtoHm0B0I9WX_CznN_V", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 34, + }, + "response_header": Object { + "us": 34569, + }, + "total": Object { + "us": 36089, + }, + "validate": Object { + "us": 34604, + }, + "write_request": Object { + "us": 60, + }, + }, + }, + "monitor": Object { + "check_group": "d7715884-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 36171, + }, + "id": "0080-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 37, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 1033, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + ], + "totalSummaryCount": 2000, +} +`; From f2c1c0927fa0021f838b03626d4a14540e7d2684 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 12:25:48 +0100 Subject: [PATCH 3/4] UP --- .../monitor_states_real_data.snap | 1257 ----------------- .../uptime/rest/monitor_states_real_data.ts | 2 +- 2 files changed, 1 insertion(+), 1258 deletions(-) delete mode 100644 x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap diff --git a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap deleted file mode 100644 index 8e7ab2023722d..0000000000000 --- a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap +++ /dev/null @@ -1,1257 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`monitor states endpoint will fetch monitor state data for the given down filters 1`] = ` -Object { - "nextPagePagination": null, - "prevPagePagination": null, - "summaries": Array [ - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0010-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.371Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "rZtoHm0B0I9WX_CznN_V", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 41, - }, - "response_header": Object { - "us": 36777, - }, - "total": Object { - "us": 37821, - }, - "validate": Object { - "us": 36818, - }, - "write_request": Object { - "us": 53, - }, - }, - }, - "monitor": Object { - "check_group": "d76f07d1-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 37926, - }, - "id": "0010-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 56, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 890, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0020-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.372Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "X5toHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 54, - }, - "response_header": Object { - "us": 180, - }, - "total": Object { - "us": 555, - }, - "validate": Object { - "us": 234, - }, - "write_request": Object { - "us": 63, - }, - }, - }, - "monitor": Object { - "check_group": "d7712ecb-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 14900, - }, - "id": "0020-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 14294, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 105, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "timestamp": 1568172624744, - }, - Object { - "timestamp": 1568172677247, - }, - Object { - "timestamp": 1568172729750, - }, - Object { - "timestamp": 1568172782253, - }, - Object { - "timestamp": 1568172834756, - }, - Object { - "down": 1, - "timestamp": 1568172887259, - }, - Object { - "timestamp": 1568172939762, - }, - Object { - "down": 1, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 1, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0030-intermittent", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "eJtoHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "500 Internal Server Error", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "500", - "hash": "0604cd3138feed202ef293e062da2f4720f77a05d25ee036a7a01c9cfcdd1f0a", - }, - "status_code": 500, - }, - "rtt": Object { - "content": Object { - "us": 28, - }, - "response_header": Object { - "us": 197, - }, - "total": Object { - "us": 17068, - }, - "validate": Object { - "us": 225, - }, - "write_request": Object { - "us": 58, - }, - }, - }, - "monitor": Object { - "check_group": "d771299d-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 17146, - }, - "id": "0030-intermittent", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 33, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 16662, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.373Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.373Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0040-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.372Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "eZtoHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 29, - }, - "response_header": Object { - "us": 172, - }, - "total": Object { - "us": 18023, - }, - "validate": Object { - "us": 201, - }, - "write_request": Object { - "us": 28, - }, - }, - }, - "monitor": Object { - "check_group": "d76f5490-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 18106, - }, - "id": "0040-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 39, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 17766, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0050-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.386Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "dJtoHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 36, - }, - "response_header": Object { - "us": 213, - }, - "total": Object { - "us": 1011, - }, - "validate": Object { - "us": 249, - }, - "write_request": Object { - "us": 20, - }, - }, - }, - "monitor": Object { - "check_group": "d76f9a0c-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 4258, - }, - "id": "0050-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 3215, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 84, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.386Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.386Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0070-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "a5toHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 33, - }, - "response_header": Object { - "us": 190, - }, - "total": Object { - "us": 2015, - }, - "validate": Object { - "us": 223, - }, - "write_request": Object { - "us": 21, - }, - }, - }, - "monitor": Object { - "check_group": "d7712c5a-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 15117, - }, - "id": "0070-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 13061, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 84, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.375Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.375Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0080-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.371Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "oJtoHm0B0I9WX_CznN_V", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 34, - }, - "response_header": Object { - "us": 34569, - }, - "total": Object { - "us": 36089, - }, - "validate": Object { - "us": 34604, - }, - "write_request": Object { - "us": 60, - }, - }, - }, - "monitor": Object { - "check_group": "d7715884-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 36171, - }, - "id": "0080-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 37, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 1033, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - ], - "totalSummaryCount": 2000, -} -`; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts index 077720ac0588b..08a339ed59326 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts @@ -93,7 +93,7 @@ export default function ({ getService }: FtrProviderContext) { it('will fetch monitor state data for the given down filters', async () => { const statusFilter = 'down'; - const size = 10; + const size = 2; const { body } = await supertest.get( `${API_URLS.MONITOR_LIST}?dateRangeStart=${from}&dateRangeEnd=${to}&statusFilter=${statusFilter}&pageSize=${size}` ); From 118cc486abf478b80b80aca601891d68ed31cf7f Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 12:26:19 +0100 Subject: [PATCH 4/4] UP --- .../monitor_states_real_data.snap | 369 ++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap diff --git a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap new file mode 100644 index 0000000000000..50625683b605d --- /dev/null +++ b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap @@ -0,0 +1,369 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`monitor states endpoint will fetch monitor state data for the given down filters 1`] = ` +Object { + "nextPagePagination": "{\\"cursorDirection\\":\\"AFTER\\",\\"sortOrder\\":\\"ASC\\",\\"cursorKey\\":{\\"monitor_id\\":\\"0020-down\\"}}", + "prevPagePagination": null, + "summaries": Array [ + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0010-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "rZtoHm0B0I9WX_CznN_V", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 41, + }, + "response_header": Object { + "us": 36777, + }, + "total": Object { + "us": 37821, + }, + "validate": Object { + "us": 36818, + }, + "write_request": Object { + "us": 53, + }, + }, + }, + "monitor": Object { + "check_group": "d76f07d1-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 37926, + }, + "id": "0010-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 56, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 890, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0020-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.372Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "X5toHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 54, + }, + "response_header": Object { + "us": 180, + }, + "total": Object { + "us": 555, + }, + "validate": Object { + "us": 234, + }, + "write_request": Object { + "us": 63, + }, + }, + }, + "monitor": Object { + "check_group": "d7712ecb-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 14900, + }, + "id": "0020-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 14294, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 105, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + ], + "totalSummaryCount": 2000, +} +`;