Skip to content

Commit

Permalink
7.x field changes (#28543)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewvc authored Jan 18, 2019
1 parent e2ab1b0 commit 3d24d19
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 43 deletions.
27 changes: 27 additions & 0 deletions x-pack/plugins/uptime/common/graphql/introspection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/uptime/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -258,6 +260,10 @@ export interface Tls {
rtt?: Rtt | null;
}

export interface Url {
full?: string | null;
}

export interface DocCount {
count: UnsignedInteger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ export const getMonitorListQuery = gql`
ping {
timestamp
monitor {
id
status
type
host
ip
duration {
us
}
}
url {
full
}
}
upSeries {
x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
EuiInMemoryTable,
// @ts-ignore missing type definition
EuiLineSeries,
EuiLink,
EuiPanel,
// @ts-ignore missing type definition
EuiSeriesChart,
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ export const createGetMonitorStatusBarQuery = gql`
duration {
us
}
scheme
}
tcp {
port
url {
full
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -55,11 +55,10 @@ export const MonitorStatusBar = ({
monitor: {
status,
timestamp,
host,
ip,
duration: { us },
scheme,
},
tcp: { port },
url: { full: fullURL },
} = monitorStatus[0];

return (
Expand Down Expand Up @@ -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}>
Expand All @@ -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>
);
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -199,5 +208,6 @@ export const pingsSchema = gql`
tags: String
tcp: TCP
tls: TLS
url: URL
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter {
body: {
query: getFilteredQuery(dateRangeStart, dateRangeEnd, filters),
aggs: {
hosts: {
urls: {
composite: {
sources: [
{
Expand All @@ -165,7 +165,7 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter {
{
port: {
terms: {
field: 'tcp.port',
field: 'url.full',
},
},
},
Expand Down

0 comments on commit 3d24d19

Please sign in to comment.