From fe56dfb52d284abb7decfef47e899bd5fcb8c62c Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Fri, 11 Feb 2022 14:59:34 -0500 Subject: [PATCH 1/5] uptime - handle null duration --- .../uptime/common/runtime_types/ping/ping.ts | 2 +- .../monitor/ping_list/ping_list.test.tsx | 11 +++++++++-- .../monitor/ping_list/ping_list_table.tsx | 15 +++++++++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts index 989d6d8ef941a..986915f6bcbe9 100644 --- a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts @@ -91,7 +91,7 @@ export type Tls = t.TypeOf; export const MonitorType = t.intersection([ t.type({ duration: t.type({ - us: t.number, + us: t.union([t.number, t.null]), }), id: t.string, status: t.string, diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx index c185303447854..abe7bc25c2f2f 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx @@ -42,7 +42,7 @@ describe('PingList component', () => { type: 'io', }, monitor: { - duration: { us: 1370 }, + duration: { us: null }, id: 'auto-tcp-0X81440A68E839814D', ip: '255.255.255.0', name: '', @@ -162,7 +162,7 @@ describe('PingList component', () => { }, "monitor": Object { "duration": Object { - "us": 1370, + "us": null, }, "id": "auto-tcp-0X81440A68E839814D", "ip": "255.255.255.0", @@ -186,6 +186,13 @@ describe('PingList component', () => { }); }); + describe('duration column', () => { + it('shows -- when duration is null', () => { + const { getByTestId } = render(); + expect(getByTestId('ping-list-duration-unavailable-tool-tip')).toBeInTheDocument(); + }); + }); + describe('formatDuration', () => { it('returns zero for < 1 millisecond', () => { expect(formatDuration(984)).toBe('0 ms'); diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx index 84a2d6a5d6a31..cccafea98c380 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx @@ -6,7 +6,7 @@ */ import React, { MouseEvent, useCallback, useEffect, useState } from 'react'; -import { EuiBasicTable } from '@elastic/eui'; +import { EuiBasicTable, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import moment from 'moment'; import { useHistory } from 'react-router-dom'; @@ -140,7 +140,18 @@ export function PingListTable({ loading, error, pings, pagination, onChange, fai name: i18n.translate('xpack.uptime.pingList.durationMsColumnLabel', { defaultMessage: 'Duration', }), - render: (duration: number) => formatDuration(duration), + render: (duration: number | null) => + duration ? ( + formatDuration(duration) + ) : ( + + {'--'} + + ), }, ...(hasError ? [ From 296f833765317605960ba81b024115262b064a64 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Fri, 11 Feb 2022 18:11:31 -0500 Subject: [PATCH 2/5] adjust types --- x-pack/plugins/uptime/common/runtime_types/ping/ping.ts | 6 +++--- .../public/components/monitor/ping_list/ping_list.test.tsx | 4 ---- .../components/overview/monitor_list/monitor_list.tsx | 2 +- .../server/lib/synthetics_service/service_api_client.ts | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts index 986915f6bcbe9..e78f026277d3a 100644 --- a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts @@ -90,14 +90,14 @@ export type Tls = t.TypeOf; export const MonitorType = t.intersection([ t.type({ - duration: t.type({ - us: t.union([t.number, t.null]), - }), id: t.string, status: t.string, type: t.string, }), t.partial({ + duration: t.type({ + us: t.number, + }), check_group: t.string, ip: t.string, name: t.string, diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx index abe7bc25c2f2f..bfcf359ac0525 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx @@ -42,7 +42,6 @@ describe('PingList component', () => { type: 'io', }, monitor: { - duration: { us: null }, id: 'auto-tcp-0X81440A68E839814D', ip: '255.255.255.0', name: '', @@ -161,9 +160,6 @@ describe('PingList component', () => { "type": "io", }, "monitor": Object { - "duration": Object { - "us": null, - }, "id": "auto-tcp-0X81440A68E839814D", "ip": "255.255.255.0", "name": "", diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx index 2dd4ed7bed481..a2d823cd90af1 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx @@ -135,7 +135,7 @@ export const MonitorListComponent: ({ timestamp={timestamp} summaryPings={summaryPings ?? []} monitorType={type} - duration={duration!.us} + duration={duration?.us} monitorId={monitorId} /> ); diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts b/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts index 1e82ef77e083b..3637cf1020849 100644 --- a/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts +++ b/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts @@ -124,7 +124,7 @@ export class ServiceAPIClient { ); if (locMonitors.length > 0) { promises.push( - rxjsFrom(callServiceEndpoint(locMonitors, url)).pipe( + rxjsFrom(callServiceEndpoint(locMonitors, `${url}-test`)).pipe( tap((result) => { this.logger.debug(result.data); this.logger.debug( From 179ee4c8410167c3aac65c1e85373fdb14c17b48 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Sat, 12 Feb 2022 14:20:01 -0500 Subject: [PATCH 3/5] Update x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts --- .../uptime/server/lib/synthetics_service/service_api_client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts b/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts index 3637cf1020849..1e82ef77e083b 100644 --- a/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts +++ b/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts @@ -124,7 +124,7 @@ export class ServiceAPIClient { ); if (locMonitors.length > 0) { promises.push( - rxjsFrom(callServiceEndpoint(locMonitors, `${url}-test`)).pipe( + rxjsFrom(callServiceEndpoint(locMonitors, url)).pipe( tap((result) => { this.logger.debug(result.data); this.logger.debug( From 427ec81e5d9ae8640ff30b0411ef19db9ad2c14c Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Sun, 13 Feb 2022 13:55:39 -0500 Subject: [PATCH 4/5] raise per page of synthetics monitors --- .../uptime/server/lib/synthetics_service/synthetics_service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts b/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts index 450ab324e7e48..12e13cd22f748 100644 --- a/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts +++ b/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts @@ -280,6 +280,7 @@ export class SyntheticsService { const findResult = await savedObjectsClient.find({ type: syntheticsMonitorType, namespaces: ['*'], + perPage: 10000, }); hydrateSavedObjects({ From f3883ab948510cd200157b402f2ceb4347dfde33 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Mon, 14 Feb 2022 08:50:50 -0500 Subject: [PATCH 5/5] Remove tooltip --- .../components/monitor/ping_list/ping_list_table.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx index cccafea98c380..5e2737684b333 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx @@ -6,7 +6,7 @@ */ import React, { MouseEvent, useCallback, useEffect, useState } from 'react'; -import { EuiBasicTable, EuiToolTip } from '@elastic/eui'; +import { EuiBasicTable } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import moment from 'moment'; import { useHistory } from 'react-router-dom'; @@ -144,13 +144,7 @@ export function PingListTable({ loading, error, pings, pagination, onChange, fai duration ? ( formatDuration(duration) ) : ( - - {'--'} - + {'--'} ), }, ...(hasError