diff --git a/x-pack/plugins/uptime/common/graphql/introspection.json b/x-pack/plugins/uptime/common/graphql/introspection.json index d71c749aab564..d17a16e9d8068 100644 --- a/x-pack/plugins/uptime/common/graphql/introspection.json +++ b/x-pack/plugins/uptime/common/graphql/introspection.json @@ -505,6 +505,14 @@ "type": { "kind": "OBJECT", "name": "TLS", "ofType": null }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "url", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "URL", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -1322,6 +1330,25 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "URL", + "description": "", + "fields": [ + { + "name": "full", + "description": "", + "args": [], + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "DocCount", diff --git a/x-pack/plugins/uptime/common/graphql/types.ts b/x-pack/plugins/uptime/common/graphql/types.ts index 988aedbc265ea..7b4cc41392b90 100644 --- a/x-pack/plugins/uptime/common/graphql/types.ts +++ b/x-pack/plugins/uptime/common/graphql/types.ts @@ -70,6 +70,8 @@ export interface Ping { tcp?: Tcp | null; tls?: Tls | null; + + url?: Url | null; } /** An agent for recording a beat */ export interface Beat { @@ -258,6 +260,10 @@ export interface Tls { rtt?: Rtt | null; } +export interface Url { + full?: string | null; +} + export interface DocCount { count: UnsignedInteger; } diff --git a/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx b/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx index b83970e47cea3..b9306428d0d53 100644 --- a/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx +++ b/x-pack/plugins/uptime/public/components/queries/filter_bar/filter_bar.tsx @@ -67,8 +67,8 @@ export const FilterBar = ({ dateRangeEnd, dateRangeStart, updateQuery }: FilterB { type: 'field_value_selection', field: 'monitor.id', - name: i18n.translate('xpack.uptime.filterBar.options.hostLabel', { - defaultMessage: 'Host', + name: i18n.translate('xpack.uptime.filterBar.options.idLabel', { + defaultMessage: 'ID', }), multiSelect: false, options: take(id, MAX_SELECTION_LENGTH).map((idValue: any) => ({ diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_list/get_monitor_list.ts b/x-pack/plugins/uptime/public/components/queries/monitor_list/get_monitor_list.ts index ed93ef8ef45a8..41462fe7fb44e 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_list/get_monitor_list.ts +++ b/x-pack/plugins/uptime/public/components/queries/monitor_list/get_monitor_list.ts @@ -25,14 +25,16 @@ export const getMonitorListQuery = gql` ping { timestamp monitor { + id status - type - host ip duration { us } } + url { + full + } } upSeries { x diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_list/monitor_list.tsx index a612f342b3b5a..a5e95a14d1863 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_list/monitor_list.tsx @@ -10,6 +10,7 @@ import { EuiInMemoryTable, // @ts-ignore missing type definition EuiLineSeries, + EuiLink, EuiPanel, // @ts-ignore missing type definition EuiSeriesChart, @@ -65,25 +66,22 @@ const monitorListColumns = [ sortable: true, }, { - field: 'ping.monitor.host', - name: i18n.translate('xpack.uptime.monitorList.hostColumnLabel', { - defaultMessage: 'Host', + field: 'ping.monitor.id', + name: i18n.translate('xpack.uptime.monitorList.idColumnLabel', { + defaultMessage: 'ID', }), - render: (host: string, monitor: any) => {host}, + render: (id: string, monitor: any) => {id}, }, { - field: 'key.port', - name: i18n.translate('xpack.uptime.monitorList.portColumnLabel', { - defaultMessage: 'Port', + field: 'ping.url.full', + name: i18n.translate('xpack.uptime.monitorList.urlColumnLabel', { + defaultMessage: 'URL', }), - sortable: true, - }, - { - field: 'ping.monitor.type', - name: i18n.translate('xpack.uptime.monitorList.typeColumnLabel', { - defaultMessage: 'Type', - }), - sortable: true, + render: (url: string, monitor: any) => ( + + {url} + + ), }, { field: 'ping.monitor.ip', diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts index 12fd1a09985d4..0eca6693ac84c 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/get_monitor_status_bar.ts @@ -25,10 +25,9 @@ export const createGetMonitorStatusBarQuery = gql` duration { us } - scheme } - tcp { - port + url { + full } } } diff --git a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx index 5d3f766b7b909..53f9577306ada 100644 --- a/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx +++ b/x-pack/plugins/uptime/public/components/queries/monitor_status_bar/monitor_status_bar.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiFlexGroup, EuiFlexItem, EuiHealth, EuiPanel } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiHealth, EuiLink, EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; @@ -55,11 +55,10 @@ export const MonitorStatusBar = ({ monitor: { status, timestamp, - host, + ip, duration: { us }, - scheme, }, - tcp: { port }, + url: { full: fullURL }, } = monitorStatus[0]; return ( @@ -99,17 +98,16 @@ export const MonitorStatusBar = ({ /> - + + {fullURL} + @@ -120,13 +118,6 @@ export const MonitorStatusBar = ({ defaultMessage="Duration: {duration} ms" /> - - - ); diff --git a/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts b/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts index 33796c25e7831..b0ca434da881a 100644 --- a/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts +++ b/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts @@ -180,6 +180,15 @@ export const pingsSchema = gql` rtt: RTT } + type URL { + full: String + scheme: String + domain: String + port: Int + path: String + query: String + } + "A request sent from a monitor to a host" type Ping { "The timestamp of the ping's creation" @@ -199,5 +208,6 @@ export const pingsSchema = gql` tags: String tcp: TCP tls: TLS + url: URL } `; diff --git a/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts b/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts index 99b8f88f0f0f4..b5d988d2c188b 100644 --- a/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts +++ b/x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts @@ -152,7 +152,7 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter { body: { query: getFilteredQuery(dateRangeStart, dateRangeEnd, filters), aggs: { - hosts: { + urls: { composite: { sources: [ { @@ -165,7 +165,7 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter { { port: { terms: { - field: 'tcp.port', + field: 'url.full', }, }, },