From 06092c1c027b2cf3978db12069d0d86326a77d1f Mon Sep 17 00:00:00 2001 From: Andrew Cholakian Date: Mon, 2 Nov 2020 15:03:59 -0600 Subject: [PATCH 1/2] Always use summary events for monitor info Fixes https://github.com/elastic/kibana/issues/81942 With synthetics we no longer are guaranteed to have the URL or other monitor info fields in every single event. This PR patches the monitor status API to only query summary fields for this info. As an added benefit, this is a bit more consistent as well because we tend to only show data from completed, not partial checks, in most places. This also removes the status check parameter from this API, which otherwise would need to be refactored. Checking the codebase it appears unused. --- .../server/lib/requests/__tests__/get_latest_monitor.test.ts | 5 +++++ .../plugins/uptime/server/lib/requests/get_latest_monitor.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts index 7fe6a42c807ee0..bd353b62df828e 100644 --- a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts @@ -17,6 +17,11 @@ describe('getLatestMonitor', () => { query: { bool: { filter: [ + { + exists: { + field: 'summary', + }, + }, { range: { '@timestamp': { diff --git a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts b/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts index c15d245f74cc73..fcc6da568a583f 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts @@ -38,6 +38,7 @@ export const getLatestMonitor: UMElasticsearchQueryFn Date: Mon, 2 Nov 2020 16:29:36 -0600 Subject: [PATCH 2/2] Remove unneeded params --- .../plugins/uptime/server/lib/requests/get_latest_monitor.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts b/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts index fcc6da568a583f..d32b78bdc71394 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts @@ -18,8 +18,6 @@ export interface GetLatestMonitorParams { monitorId?: string | null; observerLocation?: string; - - status?: string; } // Get The monitor latest state sorted by timestamp with date range @@ -30,7 +28,6 @@ export const getLatestMonitor: UMElasticsearchQueryFn { const params = { index: dynamicSettings.heartbeatIndices,