7.x field changes (#28543)

In Heartbeat 7.0 there are a number of field changes that have been made to support ECS and refine the schema in other ways. This PR seeks to accomodate those changes, the most significant of which is the switch to extensive use of the ECS `url` namespace.

One part of that is removing the Host dropdown filter rather than updating it. This control has always been effectively broken due to its inability to scale to a large number of hosts. Updating it makes no sense when it should be removed.
This commit is contained in:
Andrew Cholakian 2019-01-18 08:07:03 -08:00 committed by GitHub
parent e2ab1b0f78
commit 3d24d1943d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 76 additions and 43 deletions

View file

@ -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",

View file

@ -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;
}

View file

@ -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) => ({

View file

@ -25,14 +25,16 @@ export const getMonitorListQuery = gql`
ping {
timestamp
monitor {
id
status
type
host
ip
duration {
us
}
}
url {
full
}
}
upSeries {
x

View file

@ -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) => <Link to={`/monitor/${monitor.key.id}`}>{host}</Link>,
render: (id: string, monitor: any) => <Link to={`/monitor/${monitor.key.id}`}>{id}</Link>,
},
{
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) => (
<EuiLink href={url} target="_blank">
{url}
</EuiLink>
),
},
{
field: 'ping.monitor.ip',

View file

@ -25,10 +25,9 @@ export const createGetMonitorStatusBarQuery = gql`
duration {
us
}
scheme
}
tcp {
port
url {
full
}
}
}

View file

@ -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 = ({
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.uptime.monitorStatusBar.healthStatus.hostMessage"
values={{ host }}
defaultMessage="Host: {host}"
/>
<EuiLink href={fullURL} target="_blank">
{fullURL}
</EuiLink>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.uptime.monitorStatusBar.healthStatus.portMessage"
values={{ port }}
defaultMessage="Port: {port}"
id="xpack.uptime.monitorStatusBar.healthStatus.ipMessage"
// TODO: this should not be computed inline
values={{ ip }}
defaultMessage="IP: {ip}"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
@ -120,13 +118,6 @@ export const MonitorStatusBar = ({
defaultMessage="Duration: {duration} ms"
/>
</EuiFlexItem>
<EuiFlexItem>
<FormattedMessage
id="xpack.uptime.monitorStatusBar.healthStatus.schemeMessage"
values={{ scheme }}
defaultMessage="Scheme: {scheme}"
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
);

View file

@ -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
}
`;

View file

@ -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',
},
},
},