From 53a351e1b76ed3128826302e4df524b69904a902 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 24 Feb 2020 12:09:36 -0500 Subject: [PATCH 01/36] WIP replacing GQL with redux/rest. --- .../plugins/uptime/common/types/index.ts | 1 + .../plugins/uptime/common/types/ping/ping.ts | 159 ++++++++++++++++++ .../public/components/connected/index.ts | 1 + .../components/connected/pings/ping_list.ts | 40 +++++ .../public/components/functional/index.ts | 2 +- .../components/functional/ping_list/index.tsx | 2 +- .../functional/ping_list/ping_list.tsx | 26 +-- .../plugins/uptime/public/pages/monitor.tsx | 3 +- .../plugins/uptime/public/queries/index.ts | 1 - .../uptime/public/queries/pings_query.ts | 71 -------- .../uptime/public/state/actions/ping.ts | 6 + .../plugins/uptime/public/state/api/ping.ts | 32 ++++ .../public/state/effects/fetch_effect.ts | 2 +- .../uptime/public/state/effects/ping.ts | 15 +- .../uptime/public/state/reducers/index.ts | 2 + .../uptime/public/state/reducers/ping_list.ts | 50 ++++++ .../uptime/public/state/selectors/index.ts | 4 + x-pack/plugins/uptime/server/graphql/index.ts | 3 +- .../server/graphql/monitors/schema.gql.ts | 2 +- .../uptime/server/graphql/pings/index.ts | 1 - .../uptime/server/graphql/pings/resolvers.ts | 52 ------ .../uptime/server/graphql/pings/schema.gql.ts | 24 --- 22 files changed, 323 insertions(+), 176 deletions(-) create mode 100644 x-pack/legacy/plugins/uptime/common/types/ping/ping.ts create mode 100644 x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts delete mode 100644 x-pack/legacy/plugins/uptime/public/queries/pings_query.ts create mode 100644 x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts delete mode 100644 x-pack/plugins/uptime/server/graphql/pings/resolvers.ts diff --git a/x-pack/legacy/plugins/uptime/common/types/index.ts b/x-pack/legacy/plugins/uptime/common/types/index.ts index 34bfbc540672f1..4f0aa8450bf185 100644 --- a/x-pack/legacy/plugins/uptime/common/types/index.ts +++ b/x-pack/legacy/plugins/uptime/common/types/index.ts @@ -5,3 +5,4 @@ */ export * from './ping/histogram'; +export * from './pings/ping'; diff --git a/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts b/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts new file mode 100644 index 00000000000000..8d4943e1c467ab --- /dev/null +++ b/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts @@ -0,0 +1,159 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; + +// { +// "id": "deQ8cHABC7VDoh7Q0UMK", +// "timestamp": "2020-02-23T04:09:57.792Z", +// "@timestamp": "2020-02-23T04:09:57.792Z", +// "resolve": { +// "ip": "127.0.0.1", +// "rtt": { +// "us": 711 +// } +// }, +// "url": { +// "scheme": "http", +// "domain": "localhost", +// "port": 5678, +// "path": "/pattern", +// "query": "r=200x1", +// "full": "http://localhost:5678/pattern?r=200x1" +// }, +// "event": { +// "dataset": "uptime" +// }, +// "ecs": { +// "version": "1.4.0" +// }, +// "summary": { +// "up": 0, +// "down": 1 +// }, +// "monitor": { +// "status": "down", +// "duration": { +// "us": 4259 +// }, +// "id": "0099-up", +// "name": "Test 0099 - up", +// "type": "http", +// "timespan": { +// "gte": "2020-02-23T04:09:57.792Z", +// "lt": "2020-02-23T04:10:27.792Z" +// }, +// "check_group": "48ac99ce-55f2-11ea-ab0b-acde48001122", +// "ip": "127.0.0.1" +// }, +// "error": { +// "type": "io", +// "message": "Get http://localhost:5678/pattern?r=200x1: dial tcp 127.0.0.1:5678: connect: connection refused" +// }, +// "agent": { +// "ephemeral_id": "33099805-35cc-48cb-88ef-94f77ceb0efb", +// "hostname": "Justins-MacBook-Pro.local", +// "id": "5884d7f7-9a49-4b0e-bff2-72a475aa695f", +// "version": "8.0.0", +// "type": "heartbeat" +// }, +// "observer": { +// "hostname": "Justins-MacBook-Pro.local", +// "geo": { +// "name": "fairbanks", +// "location": "37.926868, -78.024902" +// } +// } +// } + +export const NewPingType = t.type({ + id: t.string, + timestamp: t.string, + '@timestamp': t.string, + resolve: t.partial({ + ip: t.string, + rtt: t.type({ + us: t.number, + }), + }), + url: t.partial({ + scheme: t.string, + domain: t.string, + port: t.number, + path: t.string, + query: t.string, + full: t.string, + }), + event: t.partial({ + dataset: t.string, + }), + ecs: t.partial({ + version: t.string, + }), + summary: t.partial({ + up: t.number, + down: t.number, + }), + monitor: t.partial({ + status: t.string, + duration: t.partial({ + us: t.number, + }), + id: t.string, + name: t.string, + type: t.string, + timespan: t.type({ + gte: t.string, + lt: t.string, + }), + check_group: t.string, + ip: t.string, + }), + error: t.partial({ + type: t.string, + message: t.string, + }), + agent: t.partial({ + ephemeral_id: t.string, + hostname: t.string, + id: t.string, + version: t.string, + type: t.string, + }), + observer: t.partial({ + hostname: t.string, + geo: t.partial({ + name: t.string, + location: t.string, + }), + }), +}); + +export type NewPing = t.TypeOf; + +export const PingsResponseType = t.type({ + total: t.number, + locations: t.array(t.string), + pings: t.array(NewPingType), +}); + +export type PingsResponse = t.TypeOf; + +export interface GetPingsParams { + dateRangeStart: string; + dateRangeEnd: string; + location?: string; + monitorId?: string; + size?: number; + sort?: string; + status?: string; +} + +export interface PingsResult { + total: number; + locations: string[]; + pings: NewPing[]; +} diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/index.ts b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts index 585f0bf7f25f54..42c61f7049252a 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/index.ts +++ b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts @@ -12,3 +12,4 @@ export { MonitorStatusDetails } from './monitor/status_details_container'; export { MonitorStatusBar } from './monitor/status_bar_container'; export { MonitorListDrawer } from './monitor/list_drawer_container'; export { MonitorListActionsPopover } from './monitor/drawer_popover_container'; +export { PingList } from './pings/ping_list'; diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts new file mode 100644 index 00000000000000..63634a4e76ca09 --- /dev/null +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts @@ -0,0 +1,40 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { connect } from 'react-redux'; +import { AppState } from '../../../state'; +import { fetchPings } from '../../../state/api'; +import { selectPingList } from '../../../state/selectors'; +import { GetPingsParams } from '../../../../common/types/ping/ping'; +import { PingListComponent } from '../../functional'; + +interface OwnProps { + onSelectedStatusChange: (status: string | undefined) => void; + onSelectedLocationChange: (location: any) => void; + onPageCountChange: (itemCount: number) => void; + pageSize: number; + selectedOption: string; + selectedLocation: string | undefined; +} + +const mapDispatchToProps = (dispatch: any) => ({ + fetchPings: (params: GetPingsParams) => dispatch(fetchPings({ ...params })), +}); + +const mapStateToProps = (state: AppState) => ({ + allPings: selectPingList(state), + loading: state.pingList.loading, +}); + +export const PingList = connect< + typeof mapStateToProps, + typeof mapDispatchToProps, + OwnProps, + AppState +>( + mapStateToProps, + mapDispatchToProps +)(PingListComponent); diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts index e86ba548fb5d96..d3cbe35fa71238 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts +++ b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts @@ -10,6 +10,6 @@ export { KueryBarComponent } from './kuery_bar/kuery_bar'; export { MonitorCharts } from './monitor_charts'; export { MonitorList } from './monitor_list'; export { OverviewPageParsingErrorCallout } from './overview_page_parsing_error_callout'; -export { PingList } from './ping_list'; +export { PingListComponent } from './ping_list'; export { PingHistogramComponent } from './charts'; export { StatusPanel } from './status_panel'; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx index e57b229dfd9738..808f3f90ef0150 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export * from './ping_list'; +export { PingListComponent } from './ping_list'; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index e8825dacc0078f..0cb3e94b815944 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -20,24 +20,20 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { get } from 'lodash'; import moment from 'moment'; import React, { Fragment, useState } from 'react'; import styled from 'styled-components'; import { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table'; -import { Ping, PingResults } from '../../../../common/graphql/types'; +import { PingsResponse } from '../../../../common/types/ping/ping'; +import { Ping } from '../../../../common/graphql/types'; import { convertMicrosecondsToMilliseconds as microsToMillis } from '../../../lib/helper'; -import { UptimeGraphQLQueryProps, withUptimeGraphQL } from '../../higher_order'; -import { pingsQuery } from '../../../queries'; import { LocationName } from './../location_name'; import { Pagination } from './../monitor_list'; import { PingListExpandedRowComponent } from './expanded_row'; -interface PingListQueryResult { - allPings?: PingResults; -} - interface PingListProps { + allPings: PingsResponse; + loading: boolean; onSelectedStatusChange: (status: string | undefined) => void; onSelectedLocationChange: (location: any) => void; onPageCountChange: (itemCount: number) => void; @@ -46,7 +42,6 @@ interface PingListProps { selectedLocation: string | undefined; } -type Props = UptimeGraphQLQueryProps & PingListProps; interface ExpandedRowMap { [key: string]: JSX.Element; } @@ -75,7 +70,7 @@ const SpanWithMargin = styled.span` `; export const PingListComponent = ({ - data, + allPings, loading, onPageCountChange, onSelectedLocationChange, @@ -83,7 +78,7 @@ export const PingListComponent = ({ pageSize, selectedOption, selectedLocation, -}: Props) => { +}: PingListProps) => { const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); const statusOptions = [ @@ -106,7 +101,7 @@ export const PingListComponent = ({ value: 'down', }, ]; - const locations = get(data, 'allPings.locations'); + const { locations } = allPings; const locationOptions = !locations ? [AllLocationOption] : [AllLocationOption].concat( @@ -115,7 +110,7 @@ export const PingListComponent = ({ }) ); - const pings: Ping[] = data?.allPings?.pings ?? []; + const { pings } = allPings; const hasStatus: boolean = pings.reduce( (hasHttpStatus: boolean, currentPing: Ping) => @@ -331,8 +326,3 @@ export const PingListComponent = ({ ); }; - -export const PingList = withUptimeGraphQL( - PingListComponent, - pingsQuery -); diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 8c608f57a95923..a4c9ee83b720ac 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -9,7 +9,7 @@ import React, { useContext, useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; import { ChromeBreadcrumb } from 'kibana/public'; import { connect, MapDispatchToPropsFunction, MapStateToPropsParam } from 'react-redux'; -import { MonitorCharts, PingList } from '../components/functional'; +import { PingList } from '../components/connected'; import { UptimeRefreshContext, UptimeThemeContext } from '../contexts'; import { useUptimeTelemetry, useUrlParams, UptimePage } from '../hooks'; import { useTrackPageview } from '../../../../../plugins/observability/public'; @@ -19,6 +19,7 @@ import { AppState } from '../state'; import { selectSelectedMonitor } from '../state/selectors'; import { getSelectedMonitor } from '../state/actions'; import { PageHeader } from './page_header'; +import { MonitorCharts } from '../components/functional'; interface StateProps { selectedMonitor: Ping | null; diff --git a/x-pack/legacy/plugins/uptime/public/queries/index.ts b/x-pack/legacy/plugins/uptime/public/queries/index.ts index 02c9c7cb23403c..f1733b0a7b7d92 100644 --- a/x-pack/legacy/plugins/uptime/public/queries/index.ts +++ b/x-pack/legacy/plugins/uptime/public/queries/index.ts @@ -6,4 +6,3 @@ export { docCountQuery, docCountQueryString } from './doc_count_query'; export { monitorChartsQuery, monitorChartsQueryString } from './monitor_charts_query'; -export { pingsQuery, pingsQueryString } from './pings_query'; diff --git a/x-pack/legacy/plugins/uptime/public/queries/pings_query.ts b/x-pack/legacy/plugins/uptime/public/queries/pings_query.ts deleted file mode 100644 index 203c7ef426c192..00000000000000 --- a/x-pack/legacy/plugins/uptime/public/queries/pings_query.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import gql from 'graphql-tag'; - -export const pingsQueryString = ` -query PingList( - $dateRangeStart: String! - $dateRangeEnd: String! - $monitorId: String - $status: String - $sort: String - $size: Int - $location: String -) { - allPings( - dateRangeStart: $dateRangeStart - dateRangeEnd: $dateRangeEnd - monitorId: $monitorId - status: $status - sort: $sort - size: $size - location: $location - ) { - total - locations - pings { - id - timestamp - http { - response { - status_code - body { - bytes - hash - content - content_bytes - } - } - } - error { - message - type - } - monitor { - duration { - us - } - id - ip - name - scheme - status - type - } - observer { - geo { - name - } - } - } - } - } -`; - -export const pingsQuery = gql` - ${pingsQueryString} -`; diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts index bb7258d9a54b2f..193f5e855e667f 100644 --- a/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts @@ -6,7 +6,13 @@ import { createAction } from 'redux-actions'; import { GetPingHistogramParams, HistogramResult } from '../../../common/types'; +import { GetPingsParams } from '../../../server/lib/requests'; +import { PingsResponse } from '../../../common/types/ping/ping'; export const getPingHistogram = createAction('GET_PING_HISTOGRAM'); export const getPingHistogramSuccess = createAction('GET_PING_HISTOGRAM_SUCCESS'); export const getPingHistogramFail = createAction('GET_PING_HISTOGRAM_FAIL'); + +export const getPings = createAction('GET PINGS'); +export const getPingsSuccess = createAction('GET PINGS SUCCESS'); +export const getPingsFail = createAction('GET PINGS FAIL'); diff --git a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts index c61bf42c8c90e8..34b035a55d4fba 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts @@ -5,9 +5,41 @@ */ import { stringify } from 'query-string'; +import { PathReporter } from 'io-ts/lib/PathReporter'; import { getApiPath } from '../../lib/helper'; import { APIFn } from './types'; import { GetPingHistogramParams, HistogramResult } from '../../../common/types'; +import { GetPingsParams } from '../../../server/lib/requests'; +import { PingsResponseType, PingsResponse } from '../../../common/types/ping/ping'; + +export const fetchPings: APIFn = async ({ + dateRangeStart, + dateRangeEnd, + location, + monitorId, + size, + sort, + status, +}) => { + const apiPath = '/api/uptime/pings'; + const params = { + dateRangeStart, + dateRangeEnd, + location, + monitorId, + size, + sort, + status, + }; + const urlParams = new URLSearchParams(params).toString(); + const response = await fetch(`${apiPath}?${urlParams}`); + if (!response.ok) { + throw new Error(response.statusText); + } + const data = await response.json(); + PathReporter.report(PingsResponseType.decode(data)); + return data; +}; export const fetchPingHistogram: APIFn = async ({ basePath, diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/fetch_effect.ts b/x-pack/legacy/plugins/uptime/public/state/effects/fetch_effect.ts index d293cdbe451b54..e8c456e87b36a9 100644 --- a/x-pack/legacy/plugins/uptime/public/state/effects/fetch_effect.ts +++ b/x-pack/legacy/plugins/uptime/public/state/effects/fetch_effect.ts @@ -16,7 +16,7 @@ import { getBasePath } from '../selectors'; * @param fail creates a failure action * @template T the action type expected by the fetch action * @template R the type that the API request should return on success - * @template S tye type of the success action + * @template S the type of the success action * @template F the type of the failure action */ export function fetchEffectFactory( diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/ping.ts b/x-pack/legacy/plugins/uptime/public/state/effects/ping.ts index acb9b31915fa99..dec67ed8cf9794 100644 --- a/x-pack/legacy/plugins/uptime/public/state/effects/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/effects/ping.ts @@ -5,10 +5,21 @@ */ import { takeLatest } from 'redux-saga/effects'; -import { getPingHistogram, getPingHistogramSuccess, getPingHistogramFail } from '../actions'; -import { fetchPingHistogram } from '../api'; +import { + getPingHistogram, + getPingHistogramSuccess, + getPingHistogramFail, + getPings, + getPingsSuccess, + getPingsFail, +} from '../actions'; +import { fetchPingHistogram, fetchPings } from '../api'; import { fetchEffectFactory } from './fetch_effect'; +export function* fetchPingsEffect() { + yield takeLatest(String(getPings), fetchEffectFactory(fetchPings, getPingsSuccess, getPingsFail)); +} + export function* fetchPingHistogramEffect() { yield takeLatest( String(getPingHistogram), diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts index 842cb1e9371082..bd7a15befcf0c0 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/index.ts @@ -12,6 +12,7 @@ import { uiReducer } from './ui'; import { monitorStatusReducer } from './monitor_status'; import { indexPatternReducer } from './index_pattern'; import { pingReducer } from './ping'; +import { pingListReducer } from './ping_list'; export const rootReducer = combineReducers({ monitor: monitorReducer, @@ -21,4 +22,5 @@ export const rootReducer = combineReducers({ monitorStatus: monitorStatusReducer, indexPattern: indexPatternReducer, ping: pingReducer, + pingList: pingListReducer, }); diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts new file mode 100644 index 00000000000000..e1ff99437f7a27 --- /dev/null +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { handleActions, Action } from 'redux-actions'; +import { PingsResponse } from '../../../common/types/ping/ping'; +import { getPings } from '../../../server/lib/requests'; +import { getPingsSuccess, getPingsFail } from '../actions'; + +export interface PingListState { + pingList: PingsResponse; + errors: Error[]; + loading: boolean; +} + +const initialState: PingListState = { + pingList: { + total: 0, + locations: [], + pings: [], + }, + loading: false, + errors: [], +}; + +type PingListPayload = PingsResponse & Error; + +export const pingListReducer = handleActions( + { + [String(getPings)]: state => ({ + ...state, + pingListLoading: true, + }), + + [String(getPingsSuccess)]: (state, action: Action) => ({ + ...state, + pingList: { ...action.payload }, + pingListLoading: false, + }), + + [String(getPingsFail)]: (state, action: Action) => ({ + ...state, + pingListErrors: [...state.errors, action.payload], + pingListLoading: false, + }), + }, + initialState +); diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts index 25498cc0cb0eea..a1f10f1e1fdf46 100644 --- a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts +++ b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts @@ -41,3 +41,7 @@ export const selectPingHistogram = ({ ping, ui }: AppState) => { esKuery: ui.esKuery, }; }; + +export const selectPingList = ({ pingList }: AppState) => { + return pingList; +}; diff --git a/x-pack/plugins/uptime/server/graphql/index.ts b/x-pack/plugins/uptime/server/graphql/index.ts index 007550da3cb62c..09c140edee86da 100644 --- a/x-pack/plugins/uptime/server/graphql/index.ts +++ b/x-pack/plugins/uptime/server/graphql/index.ts @@ -6,7 +6,7 @@ import { createMonitorsResolvers, monitorsSchema } from './monitors'; import { createMonitorStatesResolvers, monitorStatesSchema } from './monitor_states'; -import { createPingsResolvers, pingsSchema } from './pings'; +import { pingsSchema } from './pings'; import { CreateUMGraphQLResolvers } from './types'; import { unsignedIntegerResolverFunctions, unsignedIntegerSchema } from './unsigned_int_scalar'; @@ -14,7 +14,6 @@ export { DEFAULT_GRAPHQL_PATH } from './constants'; export const resolvers: CreateUMGraphQLResolvers[] = [ createMonitorsResolvers, createMonitorStatesResolvers, - createPingsResolvers, unsignedIntegerResolverFunctions, ]; export const typeDefs: any[] = [ diff --git a/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts b/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts index 6b8a896c4c60be..77952c77ccd70f 100644 --- a/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts +++ b/x-pack/plugins/uptime/server/graphql/monitors/schema.gql.ts @@ -80,7 +80,7 @@ export const monitorsSchema = gql` monitors: [LatestMonitor!] } - extend type Query { + type Query { getMonitors( dateRangeStart: String! dateRangeEnd: String! diff --git a/x-pack/plugins/uptime/server/graphql/pings/index.ts b/x-pack/plugins/uptime/server/graphql/pings/index.ts index 57ec3242a7aa90..100ce29c398ec1 100644 --- a/x-pack/plugins/uptime/server/graphql/pings/index.ts +++ b/x-pack/plugins/uptime/server/graphql/pings/index.ts @@ -4,5 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export { createPingsResolvers } from './resolvers'; export { pingsSchema } from './schema.gql'; diff --git a/x-pack/plugins/uptime/server/graphql/pings/resolvers.ts b/x-pack/plugins/uptime/server/graphql/pings/resolvers.ts deleted file mode 100644 index b383fc5d5fb154..00000000000000 --- a/x-pack/plugins/uptime/server/graphql/pings/resolvers.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { UMResolver } from '../../../../../legacy/plugins/uptime/common/graphql/resolver_types'; -import { - AllPingsQueryArgs, - PingResults, -} from '../../../../../legacy/plugins/uptime/common/graphql/types'; -import { UMServerLibs } from '../../lib/lib'; -import { UMContext } from '../types'; -import { CreateUMGraphQLResolvers } from '../types'; - -export type UMAllPingsResolver = UMResolver< - PingResults | Promise, - any, - AllPingsQueryArgs, - UMContext ->; - -export interface UMPingResolver { - allPings: () => PingResults; -} - -export const createPingsResolvers: CreateUMGraphQLResolvers = ( - libs: UMServerLibs -): { - Query: { - allPings: UMAllPingsResolver; - }; -} => ({ - Query: { - async allPings( - _resolver, - { monitorId, sort, size, status, dateRangeStart, dateRangeEnd, location }, - { APICaller } - ): Promise { - return await libs.requests.getPings({ - callES: APICaller, - dateRangeStart, - dateRangeEnd, - monitorId, - status, - sort, - size, - location, - }); - }, - }, -}); 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 4b7ccbec374644..179bca53db1617 100644 --- a/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts +++ b/x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts @@ -7,10 +7,6 @@ import gql from 'graphql-tag'; export const pingsSchema = gql` - schema { - query: Query - } - type PingResults { "Total number of matching pings" total: UnsignedInteger! @@ -20,26 +16,6 @@ export const pingsSchema = gql` pings: [Ping!]! } - type Query { - "Get a list of all recorded pings for all monitors" - allPings( - "Optional: the direction to sort by. Accepts 'asc' and 'desc'. Defaults to 'desc'." - sort: String - "Optional: the number of results to return." - size: Int - "Optional: the monitor ID filter." - monitorId: String - "Optional: the check status to filter by." - status: String - "The lower limit of the date range." - dateRangeStart: String! - "The upper limit of the date range." - dateRangeEnd: String! - "Optional: agent location to filter by." - location: String - ): PingResults! - } - type ContainerImage { name: String tag: String From e26f6fba42d57c1ca3df123b21f8507adeb039fe Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 4 Mar 2020 19:10:12 -0500 Subject: [PATCH 02/36] Finish implementing migration. --- .../public/components/connected/index.ts | 1 - .../components/connected/pings/ping_list.ts | 40 ----- .../public/components/functional/index.ts | 2 +- .../ping_list/__tests__/ping_list.test.tsx | 5 +- .../components/functional/ping_list/index.tsx | 2 +- .../functional/ping_list/ping_list.tsx | 166 ++++++++++-------- .../plugins/uptime/public/pages/monitor.tsx | 10 +- .../uptime/public/state/actions/ping.ts | 3 +- .../plugins/uptime/public/state/api/ping.ts | 22 +-- .../uptime/public/state/effects/index.ts | 3 +- .../uptime/public/state/reducers/ping_list.ts | 3 +- .../plugins/uptime/server/rest_api/index.ts | 3 +- .../uptime/server/rest_api/pings/get_all.ts | 48 ----- .../uptime/server/rest_api/pings/index.ts | 1 + 14 files changed, 112 insertions(+), 197 deletions(-) delete mode 100644 x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts delete mode 100644 x-pack/plugins/uptime/server/rest_api/pings/get_all.ts diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/index.ts b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts index 42c61f7049252a..585f0bf7f25f54 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/index.ts +++ b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts @@ -12,4 +12,3 @@ export { MonitorStatusDetails } from './monitor/status_details_container'; export { MonitorStatusBar } from './monitor/status_bar_container'; export { MonitorListDrawer } from './monitor/list_drawer_container'; export { MonitorListActionsPopover } from './monitor/drawer_popover_container'; -export { PingList } from './pings/ping_list'; diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts deleted file mode 100644 index 63634a4e76ca09..00000000000000 --- a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { connect } from 'react-redux'; -import { AppState } from '../../../state'; -import { fetchPings } from '../../../state/api'; -import { selectPingList } from '../../../state/selectors'; -import { GetPingsParams } from '../../../../common/types/ping/ping'; -import { PingListComponent } from '../../functional'; - -interface OwnProps { - onSelectedStatusChange: (status: string | undefined) => void; - onSelectedLocationChange: (location: any) => void; - onPageCountChange: (itemCount: number) => void; - pageSize: number; - selectedOption: string; - selectedLocation: string | undefined; -} - -const mapDispatchToProps = (dispatch: any) => ({ - fetchPings: (params: GetPingsParams) => dispatch(fetchPings({ ...params })), -}); - -const mapStateToProps = (state: AppState) => ({ - allPings: selectPingList(state), - loading: state.pingList.loading, -}); - -export const PingList = connect< - typeof mapStateToProps, - typeof mapDispatchToProps, - OwnProps, - AppState ->( - mapStateToProps, - mapDispatchToProps -)(PingListComponent); diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts index d3cbe35fa71238..e86ba548fb5d96 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts +++ b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts @@ -10,6 +10,6 @@ export { KueryBarComponent } from './kuery_bar/kuery_bar'; export { MonitorCharts } from './monitor_charts'; export { MonitorList } from './monitor_list'; export { OverviewPageParsingErrorCallout } from './overview_page_parsing_error_callout'; -export { PingListComponent } from './ping_list'; +export { PingList } from './ping_list'; export { PingHistogramComponent } from './charts'; export { StatusPanel } from './status_panel'; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index ba07d6c63b36cd..5a13ebaf766e9f 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { PingResults, Ping } from '../../../../../common/graphql/types'; -import { PingListComponent, AllLocationOption, toggleDetails } from '../ping_list'; +import { PingList, AllLocationOption, toggleDetails } from '../ping_list'; import { EuiComboBoxOptionProps } from '@elastic/eui'; import { ExpandedRowMap } from '../../monitor_list/types'; @@ -201,8 +201,7 @@ describe('PingList component', () => { it('renders sorted list without errors', () => { const { allPings } = pingList; const component = shallowWithIntl( - {}} diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx index 808f3f90ef0150..30d3783dd683d7 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export { PingListComponent } from './ping_list'; +export { PingList } from './ping_list'; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index 0cb3e94b815944..ac7ce06fd8378e 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -21,29 +21,33 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; -import React, { Fragment, useState } from 'react'; +import React, { Fragment, useContext, useState, useEffect } from 'react'; import styled from 'styled-components'; import { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table'; -import { PingsResponse } from '../../../../common/types/ping/ping'; import { Ping } from '../../../../common/graphql/types'; import { convertMicrosecondsToMilliseconds as microsToMillis } from '../../../lib/helper'; import { LocationName } from './../location_name'; import { Pagination } from './../monitor_list'; import { PingListExpandedRowComponent } from './expanded_row'; +import { useSelector, useDispatch } from 'react-redux'; +import { selectPingList } from '../../../state/selectors'; +import { getPings } from '../../../state/actions'; +import { UptimeSettingsContext } from '../../../contexts'; + +interface ExpandedRowMap { + [key: string]: JSX.Element; +} interface PingListProps { - allPings: PingsResponse; - loading: boolean; + monitorId: string; onSelectedStatusChange: (status: string | undefined) => void; onSelectedLocationChange: (location: any) => void; onPageCountChange: (itemCount: number) => void; pageSize: number; selectedOption: string; selectedLocation: string | undefined; -} - -interface ExpandedRowMap { - [key: string]: JSX.Element; + size: number; + status: string; } export const AllLocationOption = { text: 'All', value: '' }; @@ -69,16 +73,41 @@ const SpanWithMargin = styled.span` margin-right: 16px; `; -export const PingListComponent = ({ - allPings, - loading, - onPageCountChange, - onSelectedLocationChange, - onSelectedStatusChange, - pageSize, - selectedOption, - selectedLocation, -}: PingListProps) => { +export const PingList = (props: PingListProps) => { + const { + monitorId, + onPageCountChange, + onSelectedLocationChange, + onSelectedStatusChange, + pageSize, + selectedLocation, + selectedOption, + size, + status, + } = props; + + const { + loading, + pingList: { locations, pings }, + } = useSelector(selectPingList); + + const { dateRangeStart, dateRangeEnd } = useContext(UptimeSettingsContext); + + const dispatch = useDispatch(); + + useEffect(() => { + dispatch( + getPings({ + dateRangeStart, + dateRangeEnd, + location: selectedLocation, + monitorId, + size, + status: status !== 'all' ? status : '', + }) + ); + }, [dateRangeStart, dateRangeEnd, dispatch, monitorId, selectedLocation, size, status]); + const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); const statusOptions = [ @@ -101,7 +130,6 @@ export const PingListComponent = ({ value: 'down', }, ]; - const { locations } = allPings; const locationOptions = !locations ? [AllLocationOption] : [AllLocationOption].concat( @@ -110,8 +138,6 @@ export const PingListComponent = ({ }) ); - const { pings } = allPings; - const hasStatus: boolean = pings.reduce( (hasHttpStatus: boolean, currentPing: Ping) => hasHttpStatus || !!currentPing.http?.response?.status_code, @@ -252,60 +278,50 @@ export const PingListComponent = ({ - - - - - - { - if (typeof selected.target.value === 'string') { - onSelectedStatusChange( - selected.target && selected.target.value !== '' - ? selected.target.value - : undefined - ); - } - }} - /> - - - - - { - onSelectedLocationChange( - selected.target && selected.target.value !== '' - ? selected.target.value - : null - ); - }} - /> - - - - - + + { + if (typeof selected.target.value === 'string') { + onSelectedStatusChange( + selected.target && selected.target.value !== '' + ? selected.target.value + : undefined + ); + } + }} + /> + + + + + { + onSelectedLocationChange( + selected.target && selected.target.value !== '' ? selected.target.value : null + ); + }} + /> + diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index a4c9ee83b720ac..dc6ddb6eb16ad6 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -9,7 +9,6 @@ import React, { useContext, useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; import { ChromeBreadcrumb } from 'kibana/public'; import { connect, MapDispatchToPropsFunction, MapStateToPropsParam } from 'react-redux'; -import { PingList } from '../components/connected'; import { UptimeRefreshContext, UptimeThemeContext } from '../contexts'; import { useUptimeTelemetry, useUrlParams, UptimePage } from '../hooks'; import { useTrackPageview } from '../../../../../plugins/observability/public'; @@ -20,6 +19,7 @@ import { selectSelectedMonitor } from '../state/selectors'; import { getSelectedMonitor } from '../state/actions'; import { PageHeader } from './page_header'; import { MonitorCharts } from '../components/functional'; +import { PingList } from '../components/functional/ping_list'; interface StateProps { selectedMonitor: Ping | null; @@ -86,11 +86,9 @@ export const MonitorPageComponent: React.FC = ({ pageSize={pingListPageCount} selectedOption={selectedPingStatus} selectedLocation={selectedLocation} - variables={{ - ...sharedVariables, - size: pingListPageCount, - status: selectedPingStatus, - }} + monitorId={monitorId} + size={pingListPageCount} + status={selectedPingStatus} /> ); diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts index 193f5e855e667f..9752b56e6c4684 100644 --- a/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts @@ -6,8 +6,7 @@ import { createAction } from 'redux-actions'; import { GetPingHistogramParams, HistogramResult } from '../../../common/types'; -import { GetPingsParams } from '../../../server/lib/requests'; -import { PingsResponse } from '../../../common/types/ping/ping'; +import { PingsResponse, GetPingsParams } from '../../../common/types/ping/ping'; export const getPingHistogram = createAction('GET_PING_HISTOGRAM'); export const getPingHistogramSuccess = createAction('GET_PING_HISTOGRAM_SUCCESS'); diff --git a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts index 34b035a55d4fba..1d411101fd9237 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts @@ -9,27 +9,19 @@ import { PathReporter } from 'io-ts/lib/PathReporter'; import { getApiPath } from '../../lib/helper'; import { APIFn } from './types'; import { GetPingHistogramParams, HistogramResult } from '../../../common/types'; -import { GetPingsParams } from '../../../server/lib/requests'; -import { PingsResponseType, PingsResponse } from '../../../common/types/ping/ping'; +import { PingsResponseType, PingsResponse, GetPingsParams } from '../../../common/types/ping/ping'; -export const fetchPings: APIFn = async ({ - dateRangeStart, - dateRangeEnd, - location, - monitorId, - size, - sort, - status, -}) => { +export const fetchPings: APIFn = async pp => { + const { dateRangeStart, dateRangeEnd, location, monitorId, size, sort, status } = pp; const apiPath = '/api/uptime/pings'; const params = { dateRangeStart, dateRangeEnd, - location, monitorId, - size, - sort, - status, + ...(location && { location }), + ...(size && { size }), + ...(sort && { sort }), + ...(status && { status }), }; const urlParams = new URLSearchParams(params).toString(); const response = await fetch(`${apiPath}?${urlParams}`); diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/index.ts b/x-pack/legacy/plugins/uptime/public/state/effects/index.ts index f809454cefb39f..60875a51ee642c 100644 --- a/x-pack/legacy/plugins/uptime/public/state/effects/index.ts +++ b/x-pack/legacy/plugins/uptime/public/state/effects/index.ts @@ -10,7 +10,7 @@ import { fetchOverviewFiltersEffect } from './overview_filters'; import { fetchSnapshotCountEffect } from './snapshot'; import { fetchMonitorStatusEffect } from './monitor_status'; import { fetchIndexPatternEffect } from './index_pattern'; -import { fetchPingHistogramEffect } from './ping'; +import { fetchPingsEffect, fetchPingHistogramEffect } from './ping'; export function* rootEffect() { yield fork(fetchMonitorDetailsEffect); @@ -18,5 +18,6 @@ export function* rootEffect() { yield fork(fetchOverviewFiltersEffect); yield fork(fetchMonitorStatusEffect); yield fork(fetchIndexPatternEffect); + yield fork(fetchPingsEffect); yield fork(fetchPingHistogramEffect); } diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts index e1ff99437f7a27..1f753c6e2c7d7f 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts @@ -6,8 +6,7 @@ import { handleActions, Action } from 'redux-actions'; import { PingsResponse } from '../../../common/types/ping/ping'; -import { getPings } from '../../../server/lib/requests'; -import { getPingsSuccess, getPingsFail } from '../actions'; +import { getPings, getPingsSuccess, getPingsFail } from '../actions'; export interface PingListState { pingList: PingsResponse; diff --git a/x-pack/plugins/uptime/server/rest_api/index.ts b/x-pack/plugins/uptime/server/rest_api/index.ts index aa3b36ec7d9194..2b1fb0bfeda6c7 100644 --- a/x-pack/plugins/uptime/server/rest_api/index.ts +++ b/x-pack/plugins/uptime/server/rest_api/index.ts @@ -5,7 +5,7 @@ */ import { createGetOverviewFilters } from './overview_filters'; -import { createGetPingsRoute } from './pings'; +import { createGetPingHistogramRoute, createGetPingsRoute } from './pings'; import { createGetIndexPatternRoute } from './index_pattern'; import { createLogMonitorPageRoute, createLogOverviewPageRoute } from './telemetry'; import { createGetSnapshotCount } from './snapshot'; @@ -16,7 +16,6 @@ import { createGetMonitorLocationsRoute, createGetStatusBarRoute, } from './monitors'; -import { createGetPingHistogramRoute } from './pings/get_ping_histogram'; export * from './types'; export { createRouteWithAuth } from './create_route_with_auth'; diff --git a/x-pack/plugins/uptime/server/rest_api/pings/get_all.ts b/x-pack/plugins/uptime/server/rest_api/pings/get_all.ts deleted file mode 100644 index 21168edfc97445..00000000000000 --- a/x-pack/plugins/uptime/server/rest_api/pings/get_all.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { schema } from '@kbn/config-schema'; -import { UMServerLibs } from '../../lib/lib'; -import { UMRestApiRouteFactory } from '../types'; - -export const createGetAllRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ - method: 'GET', - path: '/api/uptime/pings', - validate: { - query: schema.object({ - dateRangeStart: schema.string(), - dateRangeEnd: schema.string(), - location: schema.maybe(schema.string()), - monitorId: schema.maybe(schema.string()), - size: schema.maybe(schema.number()), - sort: schema.maybe(schema.string()), - status: schema.maybe(schema.string()), - }), - }, - options: { - tags: ['access:uptime'], - }, - handler: async ({ callES }, _context, request, response): Promise => { - const { dateRangeStart, dateRangeEnd, location, monitorId, size, sort, status } = request.query; - - const result = await libs.requests.getPings({ - callES, - dateRangeStart, - dateRangeEnd, - monitorId, - status, - sort, - size, - location, - }); - - return response.ok({ - body: { - ...result, - }, - }); - }, -}); diff --git a/x-pack/plugins/uptime/server/rest_api/pings/index.ts b/x-pack/plugins/uptime/server/rest_api/pings/index.ts index abb7da26f994f0..a10ab435e4b0a3 100644 --- a/x-pack/plugins/uptime/server/rest_api/pings/index.ts +++ b/x-pack/plugins/uptime/server/rest_api/pings/index.ts @@ -5,3 +5,4 @@ */ export { createGetPingsRoute } from './get_pings'; +export { createGetPingHistogramRoute } from './get_ping_histogram'; From 48a999051a0778a419682bc76365bad0043c1596 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 11 Mar 2020 09:47:53 -0400 Subject: [PATCH 03/36] Introduce new connected component for ping list. --- .../public/components/connected/index.ts | 1 + .../components/connected/pings/index.ts | 7 + .../components/connected/pings/ping_list.tsx | 66 ++++++ .../public/components/functional/index.ts | 2 +- .../ping_list/__tests__/ping_list.test.tsx | 6 +- .../components/functional/ping_list/index.tsx | 2 +- .../functional/ping_list/ping_list.tsx | 198 ++++++++---------- .../plugins/uptime/public/pages/monitor.tsx | 2 +- .../graphql/monitor_states/schema.gql.ts | 2 +- 9 files changed, 170 insertions(+), 116 deletions(-) create mode 100644 x-pack/legacy/plugins/uptime/public/components/connected/pings/index.ts create mode 100644 x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/index.ts b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts index 2e30e5c3cb24f1..a389ad32857044 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/index.ts +++ b/x-pack/legacy/plugins/uptime/public/components/connected/index.ts @@ -12,4 +12,5 @@ export { MonitorStatusDetails } from './monitor/status_details_container'; export { MonitorStatusBar } from './monitor/status_bar_container'; export { MonitorListDrawer } from './monitor/list_drawer_container'; export { MonitorListActionsPopover } from './monitor/drawer_popover_container'; +export { PingList, PingListProps } from './pings'; export { DurationChart } from './charts/monitor_duration'; diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/index.ts b/x-pack/legacy/plugins/uptime/public/components/connected/pings/index.ts new file mode 100644 index 00000000000000..95ced104e51882 --- /dev/null +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { PingList, PingListProps } from './ping_list'; diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx new file mode 100644 index 00000000000000..01d6fc895bdbf7 --- /dev/null +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useSelector, useDispatch } from 'react-redux'; +import React, { useContext } from 'react'; +import { selectPingList } from '../../../state/selectors'; +import { getPings } from '../../../state/actions'; +import { GetPingsParams } from '../../../../common/types/ping/ping'; +import { UptimeSettingsContext } from '../../../contexts'; +import { PingListComponent } from '../../functional'; + +export interface PingListProps { + monitorId: string; + onSelectedStatusChange: (status: string | undefined) => void; + onSelectedLocationChange: (location: any) => void; + onPageCountChange: (itemCount: number) => void; + pageSize: number; + selectedOption: string; + selectedLocation: string | undefined; + size: number; + status: string; +} +export const PingList = (props: PingListProps) => { + const { + loading, + pingList: { locations, pings }, + } = useSelector(selectPingList); + + const { dateRangeStart: from, dateRangeEnd: to } = useContext(UptimeSettingsContext); + + const dispatch = useDispatch(); + const getPingsHandler = ({ + dateRangeStart, + dateRangeEnd, + location, + monitorId, + size, + status, + }: GetPingsParams) => { + dispatch( + getPings({ + dateRangeStart, + dateRangeEnd, + location, + monitorId, + size, + status, + }) + ); + }; + + return ( + + ); +}; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts index e86ba548fb5d96..d3cbe35fa71238 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/index.ts +++ b/x-pack/legacy/plugins/uptime/public/components/functional/index.ts @@ -10,6 +10,6 @@ export { KueryBarComponent } from './kuery_bar/kuery_bar'; export { MonitorCharts } from './monitor_charts'; export { MonitorList } from './monitor_list'; export { OverviewPageParsingErrorCallout } from './overview_page_parsing_error_callout'; -export { PingList } from './ping_list'; +export { PingListComponent } from './ping_list'; export { PingHistogramComponent } from './charts'; export { StatusPanel } from './status_panel'; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index 55eeb744416295..e668fc7fae9a0e 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { PingResults, Ping } from '../../../../../common/graphql/types'; -import { PingListComponent, PingList, AllLocationOption, toggleDetails } from '../ping_list'; +import { PingList, AllLocationOption, toggleDetails } from '../ping_list'; import { ExpandedRowMap } from '../../monitor_list/types'; describe('PingList component', () => { @@ -198,12 +198,10 @@ describe('PingList component', () => { }); it('renders sorted list without errors', () => { - const { allPings } = pingList; const component = shallowWithIntl( {}} + onSelectedLocationChange={(loc: any[]) => {}} onSelectedStatusChange={jest.fn()} pageSize={30} selectedOption="down" diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx index 30d3783dd683d7..808f3f90ef0150 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/index.tsx @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export { PingList } from './ping_list'; +export { PingListComponent } from './ping_list'; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index ac7ce06fd8378e..d5d148c18aa02b 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -21,35 +21,20 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; -import React, { Fragment, useContext, useState, useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import styled from 'styled-components'; -import { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table'; import { Ping } from '../../../../common/graphql/types'; import { convertMicrosecondsToMilliseconds as microsToMillis } from '../../../lib/helper'; import { LocationName } from './../location_name'; import { Pagination } from './../monitor_list'; import { PingListExpandedRowComponent } from './expanded_row'; -import { useSelector, useDispatch } from 'react-redux'; -import { selectPingList } from '../../../state/selectors'; -import { getPings } from '../../../state/actions'; -import { UptimeSettingsContext } from '../../../contexts'; +import { GetPingsParams, NewPing } from '../../../../common/types/ping/ping'; +import { PingListProps } from '../../connected/pings'; interface ExpandedRowMap { [key: string]: JSX.Element; } -interface PingListProps { - monitorId: string; - onSelectedStatusChange: (status: string | undefined) => void; - onSelectedLocationChange: (location: any) => void; - onPageCountChange: (itemCount: number) => void; - pageSize: number; - selectedOption: string; - selectedLocation: string | undefined; - size: number; - status: string; -} - export const AllLocationOption = { text: 'All', value: '' }; export const toggleDetails = ( @@ -73,40 +58,44 @@ const SpanWithMargin = styled.span` margin-right: 16px; `; -export const PingList = (props: PingListProps) => { +interface Props extends PingListProps { + dateRangeStart: string; + dateRangeEnd: string; + getPings: (props: GetPingsParams) => void; + loading: boolean; + locations: string[]; + pings: NewPing[]; +} + +export const PingListComponent = (props: Props) => { const { + dateRangeStart, + dateRangeEnd, + getPings, + loading, + locations, monitorId, onPageCountChange, onSelectedLocationChange, onSelectedStatusChange, pageSize, + pings, selectedLocation, selectedOption, size, status, } = props; - const { - loading, - pingList: { locations, pings }, - } = useSelector(selectPingList); - - const { dateRangeStart, dateRangeEnd } = useContext(UptimeSettingsContext); - - const dispatch = useDispatch(); - useEffect(() => { - dispatch( - getPings({ - dateRangeStart, - dateRangeEnd, - location: selectedLocation, - monitorId, - size, - status: status !== 'all' ? status : '', - }) - ); - }, [dateRangeStart, dateRangeEnd, dispatch, monitorId, selectedLocation, size, status]); + getPings({ + dateRangeStart, + dateRangeEnd, + location: selectedLocation, + monitorId, + size, + status: status !== 'all' ? status : '', + }); + }, [dateRangeStart, dateRangeEnd, monitorId, selectedLocation, size, status]); const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); @@ -265,80 +254,73 @@ export const PingList = (props: PingListProps) => { }; return ( - - - -

- -

-
- - - - + +

+ +

+
+ + + + + - { - if (typeof selected.target.value === 'string') { - onSelectedStatusChange( - selected.target && selected.target.value !== '' - ? selected.target.value - : undefined - ); - } - }} - /> - - - - { + if (typeof selected.target.value === 'string') { + onSelectedStatusChange( + selected.target && selected.target.value !== '' + ? selected.target.value + : undefined + ); + } + }} + /> + + + + + - { - onSelectedLocationChange( - selected.target && selected.target.value !== '' ? selected.target.value : null - ); - }} - /> - - - - - ) => - onPageCountChange(criteria.page!.size) - } - /> -
-
+ onChange={selected => { + onSelectedLocationChange( + selected.target && selected.target.value !== '' ? selected.target.value : null + ); + }} + /> + + + + + onPageCountChange(criteria.page!.size)} + /> + ); }; diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 47201709259014..05def0a4f4c686 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -19,7 +19,7 @@ import { selectSelectedMonitor } from '../state/selectors'; import { getSelectedMonitor } from '../state/actions'; import { PageHeader } from './page_header'; import { MonitorCharts } from '../components/functional'; -import { PingList } from '../components/functional/ping_list'; +import { PingList } from '../components/connected'; interface StateProps { selectedMonitor: Ping | null; diff --git a/x-pack/plugins/uptime/server/graphql/monitor_states/schema.gql.ts b/x-pack/plugins/uptime/server/graphql/monitor_states/schema.gql.ts index 198f97eab96524..9a61f65a455f3e 100644 --- a/x-pack/plugins/uptime/server/graphql/monitor_states/schema.gql.ts +++ b/x-pack/plugins/uptime/server/graphql/monitor_states/schema.gql.ts @@ -177,7 +177,7 @@ export const monitorStatesSchema = gql` DESC } - extend type Query { + type Query { "Fetches the current state of Uptime monitors for the given parameters." getMonitorStates( dateRangeStart: String! From 76a015884df092c9fedf1d5d6de068972d96e658 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 13 Mar 2020 11:02:24 -0400 Subject: [PATCH 04/36] Replace GraphQL type with io-ts. --- .../plugins/uptime/common/graphql/types.ts | 341 ----------------- .../uptime/common/types/ping/histogram.ts | 12 + .../plugins/uptime/common/types/ping/ping.ts | 264 ++++++------- .../monitor/status_bar_container.tsx | 2 +- .../components/connected/pings/ping_list.tsx | 39 +- .../__test__/monitor_ssl_certificate.test.tsx | 4 +- .../__test__/monitor_status.bar.test.tsx | 7 +- .../monitor_ssl_certificate.tsx | 4 +- .../monitor_status_bar/monitor_status_bar.tsx | 2 +- .../ping_list/__tests__/expanded_row.test.tsx | 15 +- .../ping_list/__tests__/ping_list.test.tsx | 350 ++++++++---------- .../functional/ping_list/expanded_row.tsx | 4 +- .../functional/ping_list/ping_list.tsx | 22 +- .../plugins/uptime/public/pages/monitor.tsx | 2 +- .../uptime/public/state/api/monitor_status.ts | 11 +- .../public/state/reducers/monitor_status.ts | 2 +- .../server/lib/requests/get_latest_monitor.ts | 18 +- .../uptime/server/lib/requests/get_monitor.ts | 15 +- .../uptime/server/lib/requests/get_pings.ts | 25 +- .../uptime/server/lib/requests/types.ts | 72 ---- .../server/lib/requests/uptime_requests.ts | 6 +- 21 files changed, 416 insertions(+), 801 deletions(-) delete mode 100644 x-pack/plugins/uptime/server/lib/requests/types.ts diff --git a/x-pack/legacy/plugins/uptime/common/graphql/types.ts b/x-pack/legacy/plugins/uptime/common/graphql/types.ts index a33a69c2298730..850e2f472bf787 100644 --- a/x-pack/legacy/plugins/uptime/common/graphql/types.ts +++ b/x-pack/legacy/plugins/uptime/common/graphql/types.ts @@ -16,296 +16,17 @@ export type UnsignedInteger = any; // ==================================================== export interface Query { - /** Get a list of all recorded pings for all monitors */ - allPings: PingResults; - /** Fetches the current state of Uptime monitors for the given parameters. */ getMonitorStates?: MonitorSummaryResult | null; /** Fetches details about the uptime index. */ getStatesIndexStatus: StatesIndexStatus; } -export interface PingResults { - /** Total number of matching pings */ - total: UnsignedInteger; - /** Unique list of all locations the query matched */ - locations: string[]; - /** List of pings */ - pings: Ping[]; -} -/** A request sent from a monitor to a host */ -export interface Ping { - /** unique ID for this ping */ - id: string; - /** The timestamp of the ping's creation */ - timestamp: string; - /** The agent that recorded the ping */ - beat?: Beat | null; - - container?: Container | null; - - docker?: Docker | null; - - ecs?: Ecs | null; - - error?: Error | null; - - host?: Host | null; - - http?: Http | null; - - icmp?: Icmp | null; - - kubernetes?: Kubernetes | null; - - meta?: Meta | null; - - monitor?: Monitor | null; - - observer?: Observer | null; - - resolve?: Resolve | null; - - socks5?: Socks5 | null; - - summary?: Summary | null; - - tags?: string | null; - - tcp?: Tcp | null; - - tls?: PingTls | null; - - url?: Url | null; -} -/** An agent for recording a beat */ -export interface Beat { - hostname?: string | null; - - name?: string | null; - - timezone?: string | null; - - type?: string | null; -} - -export interface Container { - id?: string | null; - - image?: ContainerImage | null; - - name?: string | null; - - runtime?: string | null; -} - -export interface ContainerImage { - name?: string | null; - - tag?: string | null; -} - -export interface Docker { - id?: string | null; - - image?: string | null; - - name?: string | null; -} - -export interface Ecs { - version?: string | null; -} - -export interface Error { - code?: number | null; - - message?: string | null; - - type?: string | null; -} - -export interface Host { - architecture?: string | null; - - id?: string | null; - - hostname?: string | null; - - ip?: string | null; - - mac?: string | null; - - name?: string | null; - - os?: Os | null; -} - -export interface Os { - family?: string | null; - - kernel?: string | null; - - platform?: string | null; - - version?: string | null; - - name?: string | null; - - build?: string | null; -} - -export interface Http { - response?: HttpResponse | null; - - rtt?: HttpRtt | null; - - url?: string | null; -} - -export interface HttpResponse { - status_code?: UnsignedInteger | null; - - body?: HttpBody | null; -} - -export interface HttpBody { - /** Size of HTTP response body in bytes */ - bytes?: UnsignedInteger | null; - /** Hash of the HTTP response body */ - hash?: string | null; - /** Response body of the HTTP Response. May be truncated based on client settings. */ - content?: string | null; - /** Byte length of the content string, taking into account multibyte chars. */ - content_bytes?: UnsignedInteger | null; -} - -export interface HttpRtt { - content?: Duration | null; - - response_header?: Duration | null; - - total?: Duration | null; - - validate?: Duration | null; - - validate_body?: Duration | null; - - write_request?: Duration | null; -} /** The monitor's status for a ping */ export interface Duration { us?: UnsignedInteger | null; } -export interface Icmp { - requests?: number | null; - - rtt?: number | null; -} - -export interface Kubernetes { - container?: KubernetesContainer | null; - - namespace?: string | null; - - node?: KubernetesNode | null; - - pod?: KubernetesPod | null; -} - -export interface KubernetesContainer { - image?: string | null; - - name?: string | null; -} - -export interface KubernetesNode { - name?: string | null; -} - -export interface KubernetesPod { - name?: string | null; - - uid?: string | null; -} - -export interface Meta { - cloud?: MetaCloud | null; -} - -export interface MetaCloud { - availability_zone?: string | null; - - instance_id?: string | null; - - instance_name?: string | null; - - machine_type?: string | null; - - project_id?: string | null; - - provider?: string | null; - - region?: string | null; -} - -export interface Monitor { - duration?: Duration | null; - - host?: string | null; - /** The id of the monitor */ - id?: string | null; - /** The IP pinged by the monitor */ - ip?: string | null; - /** The name of the protocol being monitored */ - name?: string | null; - /** The protocol scheme of the monitored host */ - scheme?: string | null; - /** The status of the monitored host */ - status?: string | null; - /** The type of host being monitored */ - type?: string | null; - - check_group?: string | null; -} -/** Metadata added by a proccessor, which is specified in its configuration. */ -export interface Observer { - /** Geolocation data for the agent. */ - geo?: Geo | null; -} -/** Geolocation data added via processors to enrich events. */ -export interface Geo { - /** Name of the city in which the agent is running. */ - city_name?: string | null; - /** The name of the continent on which the agent is running. */ - continent_name?: string | null; - /** ISO designation for the agent's country. */ - country_iso_code?: string | null; - /** The name of the agent's country. */ - country_name?: string | null; - /** The lat/long of the agent. */ - location?: string | null; - /** A name for the host's location, e.g. 'us-east-1' or 'LAX'. */ - name?: string | null; - /** ISO designation of the agent's region. */ - region_iso_code?: string | null; - /** Name of the region hosting the agent. */ - region_name?: string | null; -} - -export interface Resolve { - host?: string | null; - - ip?: string | null; - - rtt?: Duration | null; -} - -export interface Socks5 { - rtt?: Rtt | null; -} - export interface Rtt { connect?: Duration | null; @@ -334,55 +55,10 @@ export interface Location { lon?: number | null; } -export interface Tcp { - port?: number | null; - - rtt?: Rtt | null; -} -/** Contains monitor transmission encryption information. */ -export interface PingTls { - /** The date and time after which the certificate is invalid. */ - certificate_not_valid_after?: string | null; - - certificate_not_valid_before?: string | null; - - certificates?: string | null; - - rtt?: Rtt | null; -} - -export interface Url { - full?: string | null; - - scheme?: string | null; - - domain?: string | null; - - port?: number | null; - - path?: string | null; - - query?: string | null; -} - export interface DocCount { count: UnsignedInteger; } - -export interface Snapshot { - counts: SnapshotCount; -} - -export interface SnapshotCount { - up: number; - - down: number; - - total: number; -} - - /** The primary object returned for monitor states. */ export interface MonitorSummaryResult { /** Used to go to the next page of results */ @@ -533,23 +209,6 @@ export interface StatesIndexStatus { docCount?: DocCount | null; } -export interface AllPingsQueryArgs { - /** Optional: the direction to sort by. Accepts 'asc' and 'desc'. Defaults to 'desc'. */ - sort?: string | null; - /** Optional: the number of results to return. */ - size?: number | null; - /** Optional: the monitor ID filter. */ - monitorId?: string | null; - /** Optional: the check status to filter by. */ - status?: string | null; - /** The lower limit of the date range. */ - dateRangeStart: string; - /** The upper limit of the date range. */ - dateRangeEnd: string; - /** Optional: agent location to filter by. */ - location?: string | null; -} - export interface GetMonitorStatesQueryArgs { dateRangeStart: string; diff --git a/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts b/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts index a4e03a2b762c8e..e573d1e39bec53 100644 --- a/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts +++ b/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts @@ -28,3 +28,15 @@ export interface HistogramResult { histogram: HistogramDataPoint[]; interval: string; } + +export interface HistogramQueryResult { + key: number; + key_as_string: string; + doc_count: number; + down: { + doc_count: number; + }; + up: { + doc_count: number; + }; +} diff --git a/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts b/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts index 8d4943e1c467ab..b8ff2c6e76cd82 100644 --- a/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts +++ b/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts @@ -6,138 +6,154 @@ import * as t from 'io-ts'; -// { -// "id": "deQ8cHABC7VDoh7Q0UMK", -// "timestamp": "2020-02-23T04:09:57.792Z", -// "@timestamp": "2020-02-23T04:09:57.792Z", -// "resolve": { -// "ip": "127.0.0.1", -// "rtt": { -// "us": 711 -// } -// }, -// "url": { -// "scheme": "http", -// "domain": "localhost", -// "port": 5678, -// "path": "/pattern", -// "query": "r=200x1", -// "full": "http://localhost:5678/pattern?r=200x1" -// }, -// "event": { -// "dataset": "uptime" -// }, -// "ecs": { -// "version": "1.4.0" -// }, -// "summary": { -// "up": 0, -// "down": 1 -// }, -// "monitor": { -// "status": "down", -// "duration": { -// "us": 4259 -// }, -// "id": "0099-up", -// "name": "Test 0099 - up", -// "type": "http", -// "timespan": { -// "gte": "2020-02-23T04:09:57.792Z", -// "lt": "2020-02-23T04:10:27.792Z" -// }, -// "check_group": "48ac99ce-55f2-11ea-ab0b-acde48001122", -// "ip": "127.0.0.1" -// }, -// "error": { -// "type": "io", -// "message": "Get http://localhost:5678/pattern?r=200x1: dial tcp 127.0.0.1:5678: connect: connection refused" -// }, -// "agent": { -// "ephemeral_id": "33099805-35cc-48cb-88ef-94f77ceb0efb", -// "hostname": "Justins-MacBook-Pro.local", -// "id": "5884d7f7-9a49-4b0e-bff2-72a475aa695f", -// "version": "8.0.0", -// "type": "heartbeat" -// }, -// "observer": { -// "hostname": "Justins-MacBook-Pro.local", -// "geo": { -// "name": "fairbanks", -// "location": "37.926868, -78.024902" -// } -// } -// } +export const HttpResponseBodyType = t.partial({ + bytes: t.number, + content: t.string, + content_bytes: t.number, + hash: t.string, +}); -export const NewPingType = t.type({ - id: t.string, - timestamp: t.string, - '@timestamp': t.string, - resolve: t.partial({ - ip: t.string, - rtt: t.type({ - us: t.number, - }), - }), - url: t.partial({ - scheme: t.string, - domain: t.string, - port: t.number, - path: t.string, - query: t.string, - full: t.string, - }), - event: t.partial({ - dataset: t.string, - }), - ecs: t.partial({ - version: t.string, - }), - summary: t.partial({ - up: t.number, - down: t.number, +export type HttpResponseBody = t.TypeOf; + +export const TlsType = t.partial({ + certificate_not_valid_after: t.string, + certificate_not_valid_before: t.string, +}); + +export type Tls = t.TypeOf; + +export const PingType = t.intersection([ + t.type({ + '@timestamp': t.string, + monitor: t.intersection([ + t.type({ + duration: t.type({ + us: t.number, + }), + id: t.string, + status: t.string, + type: t.string, + }), + t.partial({ + check_group: t.string, + ip: t.string, + name: t.string, + timespan: t.partial({ + gte: t.string, + lte: t.string, + }), + }), + ]), }), - monitor: t.partial({ - status: t.string, - duration: t.partial({ - us: t.number, + t.partial({ + agent: t.intersection([ + t.type({ + ephemeral_id: t.string, + hostname: t.string, + id: t.string, + type: t.string, + version: t.string, + }), + t.partial({ + name: t.string, + }), + ]), + container: t.partial({ + id: t.string, + image: t.partial({ + name: t.string, + tag: t.string, + }), + name: t.string, + runtime: t.string, }), - id: t.string, - name: t.string, - type: t.string, - timespan: t.type({ - gte: t.string, - lt: t.string, + ecs: t.partial({ + version: t.string, }), - check_group: t.string, - ip: t.string, - }), - error: t.partial({ - type: t.string, - message: t.string, - }), - agent: t.partial({ - ephemeral_id: t.string, - hostname: t.string, - id: t.string, - version: t.string, - type: t.string, - }), - observer: t.partial({ - hostname: t.string, - geo: t.partial({ - name: t.string, - location: t.string, + error: t.intersection([ + t.partial({ + code: t.string, + id: t.string, + stack_trace: t.string, + type: t.string, + }), + t.type({ + // this is _always_ on the error field + message: t.string, + }), + ]), + http: t.partial({ + request: t.partial({ + body: t.partial({ + bytes: t.number, + content: t.partial({ + text: t.string, + }), + }), + bytes: t.number, + method: t.string, + referrer: t.string, + }), + response: t.partial({ + body: HttpResponseBodyType, + bytes: t.number, + redirects: t.string, + status_code: t.number, + }), + version: t.string, + }), + icmp: t.partial({ + requests: t.number, + rtt: t.partial({ + us: t.number, + }), + }), + kubernetes: t.partial({ + pod: t.partial({ + name: t.string, + uid: t.string, + }), + }), + observer: t.partial({ + geo: t.partial({ + name: t.string, + }), + }), + resolve: t.partial({ + ip: t.string, + rtt: t.partial({ + us: t.number, + }), + }), + summary: t.partial({ + down: t.number, + up: t.number, + }), + tags: t.string, + tcp: t.partial({ + rtt: t.partial({ + connect: t.partial({ + us: t.number, + }), + }), + }), + tls: TlsType, + // should this be partial? + url: t.partial({ + domain: t.string, + full: t.string, + port: t.number, + scheme: t.string, }), }), -}); +]); -export type NewPing = t.TypeOf; +export type Ping = t.TypeOf; export const PingsResponseType = t.type({ total: t.number, locations: t.array(t.string), - pings: t.array(NewPingType), + pings: t.array(PingType), }); export type PingsResponse = t.TypeOf; @@ -151,9 +167,3 @@ export interface GetPingsParams { sort?: string; status?: string; } - -export interface PingsResult { - total: number; - locations: string[]; - pings: NewPing[]; -} diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx index b2b555d32a3c7f..74b8854d90fdeb 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx @@ -12,7 +12,7 @@ import { selectMonitorLocations, selectMonitorStatus } from '../../../state/sele import { MonitorStatusBarComponent } from '../../functional/monitor_status_details/monitor_status_bar'; import { getMonitorStatus, getSelectedMonitor } from '../../../state/actions'; import { useUrlParams } from '../../../hooks'; -import { Ping } from '../../../../common/graphql/types'; +import { Ping } from '../../../../common/types/ping/ping'; import { MonitorLocations } from '../../../../common/runtime_types/monitor'; import { UptimeRefreshContext } from '../../../contexts'; diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx index 01d6fc895bdbf7..b63e737470739f 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx @@ -5,7 +5,7 @@ */ import { useSelector, useDispatch } from 'react-redux'; -import React, { useContext } from 'react'; +import React, { useContext, useCallback } from 'react'; import { selectPingList } from '../../../state/selectors'; import { getPings } from '../../../state/actions'; import { GetPingsParams } from '../../../../common/types/ping/ping'; @@ -32,35 +32,30 @@ export const PingList = (props: PingListProps) => { const { dateRangeStart: from, dateRangeEnd: to } = useContext(UptimeSettingsContext); const dispatch = useDispatch(); - const getPingsHandler = ({ - dateRangeStart, - dateRangeEnd, - location, - monitorId, - size, - status, - }: GetPingsParams) => { - dispatch( - getPings({ - dateRangeStart, - dateRangeEnd, - location, - monitorId, - size, - status, - }) - ); - }; + const getPingsCallback = useCallback( + ({ dateRangeStart, dateRangeEnd, location, monitorId, size, status }: GetPingsParams) => + dispatch( + getPings({ + dateRangeStart, + dateRangeEnd, + location, + monitorId, + size, + status, + }) + ), + [dispatch] + ); return ( - ); + ); }; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx index 2eae14301fd4d9..3a54943e79cd33 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx @@ -9,11 +9,11 @@ import moment from 'moment'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { EuiBadge } from '@elastic/eui'; import { renderWithIntl } from 'test_utils/enzyme_helpers'; -import { PingTls } from '../../../../../common/graphql/types'; +import { Tls } from '../../../../../common/types/ping/ping'; import { MonitorSSLCertificate } from '../monitor_status_bar'; describe('MonitorStatusBar component', () => { - let monitorTls: PingTls; + let monitorTls: Tls; beforeEach(() => { const dateInTwoMonths = moment() diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx index 0a53eeb89d793f..56951c991423c9 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx @@ -8,7 +8,7 @@ import moment from 'moment'; import React from 'react'; import { renderWithIntl } from 'test_utils/enzyme_helpers'; import { MonitorStatusBarComponent } from '../monitor_status_bar'; -import { Ping } from '../../../../../common/graphql/types'; +import { Ping } from '../../../../../common/types/ping/ping'; describe('MonitorStatusBar component', () => { let monitorStatus: Ping; @@ -16,15 +16,16 @@ describe('MonitorStatusBar component', () => { beforeEach(() => { monitorStatus = { - id: 'id1', - timestamp: moment(new Date()) + '@timestamp': moment(new Date()) .subtract(15, 'm') .toString(), monitor: { duration: { us: 1234567, }, + id: 'id1', status: 'up', + type: 'http', }, url: { full: 'https://www.example.com/', diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx index c57348c4ab4cd4..0304169b81c90f 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx @@ -10,13 +10,13 @@ import { EuiSpacer, EuiText, EuiBadge } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { PingTls } from '../../../../../common/graphql/types'; +import { Tls } from '../../../../../common/types/ping/ping'; interface Props { /** * TLS information coming from monitor in ES heartbeat index */ - tls: PingTls | null | undefined; + tls: Tls | null | undefined; } export const MonitorSSLCertificate = ({ tls }: Props) => { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx index 22e4377944be13..993f9a0a23bc62 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx @@ -17,7 +17,7 @@ import { import { MonitorSSLCertificate } from './monitor_ssl_certificate'; import * as labels from './translations'; import { StatusByLocations } from './status_by_location'; -import { Ping } from '../../../../../common/graphql/types'; +import { Ping } from '../../../../../common/types/ping/ping'; import { MonitorLocations } from '../../../../../common/runtime_types'; interface MonitorStatusBarProps { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx index 9dbe48ec5553a0..0ec9afc312222f 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx @@ -7,15 +7,22 @@ import { mountWithIntl, renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { PingListExpandedRowComponent } from '../expanded_row'; -import { Ping } from '../../../../../common/graphql/types'; +import { Ping } from '../../../../../common/types/ping/ping'; import { DocLinkForBody } from '../doc_link_body'; describe('PingListExpandedRow', () => { let ping: Ping; beforeEach(() => { ping = { - id: '123', - timestamp: '19290310', + '@timestamp': '19290310', + monitor: { + duration: { + us: 12345, + }, + id: '123', + status: 'down', + type: 'http', + }, http: { response: { body: { @@ -34,7 +41,7 @@ describe('PingListExpandedRow', () => { it('renders error information when an error field is present', () => { ping.error = { - code: 403, + code: '403', message: 'Forbidden', }; expect(shallowWithIntl()).toMatchSnapshot(); diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index e668fc7fae9a0e..e626251025557f 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -6,204 +6,180 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; -import { PingResults, Ping } from '../../../../../common/graphql/types'; -import { PingList, AllLocationOption, toggleDetails } from '../ping_list'; +import { PingListComponent, AllLocationOption, toggleDetails } from '../ping_list'; import { ExpandedRowMap } from '../../monitor_list/types'; +import { Ping, PingsResponse } from '../../../../../common/types/ping/ping'; describe('PingList component', () => { - let pingList: { allPings: PingResults }; + let response: PingsResponse; beforeEach(() => { - pingList = { - allPings: { - total: 9231, - pings: [ - { - id: 'id1', - timestamp: '2019-01-28T17:47:08.078Z', - http: null, - error: { - message: 'dial tcp 127.0.0.1:9200: connect: connection refused', - type: 'io', - }, - monitor: { - duration: { us: 1430 }, - id: 'auto-tcp-0X81440A68E839814C', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'down', - type: 'tcp', - }, - }, - { - id: 'id2', - timestamp: '2019-01-28T17:47:09.075Z', - http: null, - error: { - message: 'dial tcp 127.0.0.1:9200: connect: connection refused', - type: 'io', - }, - monitor: { - duration: { us: 1370 }, - id: 'auto-tcp-0X81440A68E839814C', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'down', - type: 'tcp', - }, - }, - { - id: 'id3', - timestamp: '2019-01-28T17:47:06.077Z', - http: null, - error: null, - monitor: { - duration: { us: 1452 }, - id: 'auto-tcp-0X81440A68E839814C', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'up', - type: 'tcp', - }, - }, - { - id: 'id4', - timestamp: '2019-01-28T17:47:07.075Z', - http: null, - error: { - message: 'dial tcp 127.0.0.1:9200: connect: connection refused', - type: 'io', - }, - monitor: { - duration: { us: 1094 }, - id: 'auto-tcp-0X81440A68E839814C', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'down', - type: 'tcp', - }, - }, - { - id: 'id5', - timestamp: '2019-01-28T17:47:07.074Z', - http: null, - error: { - message: - 'Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused', - type: 'io', - }, - monitor: { - duration: { us: 1597 }, - id: 'auto-http-0X3675F89EF0612091', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'down', - type: 'http', - }, - }, - { - id: 'id6', - timestamp: '2019-01-28T17:47:18.080Z', - http: null, - error: { - message: 'dial tcp 127.0.0.1:9200: connect: connection refused', - type: 'io', - }, - monitor: { - duration: { us: 1699 }, - id: 'auto-tcp-0X81440A68E839814C', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'down', - type: 'tcp', - }, - }, - { - id: 'id7', - timestamp: '2019-01-28T17:47:19.076Z', - http: null, - error: { - message: 'dial tcp 127.0.0.1:9200: connect: connection refused', - type: 'io', - }, - monitor: { - duration: { us: 5384 }, - id: 'auto-tcp-0X81440A68E839814C', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'down', - type: 'tcp', - }, - }, - { - id: 'id8', - timestamp: '2019-01-28T17:47:19.076Z', - http: null, - error: { - message: - 'Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused', - type: 'io', - }, - monitor: { - duration: { us: 5397 }, - id: 'auto-http-0X3675F89EF0612091', - ip: '127.0.0.1', - name: '', - scheme: null, - status: 'down', - type: 'http', - }, - }, - { - id: 'id9', - timestamp: '2019-01-28T17:47:19.077Z', - http: { response: { status_code: 200 } }, - error: null, - monitor: { - duration: { us: 127511 }, - id: 'auto-http-0X131221E73F825974', - ip: '172.217.7.4', - name: '', - scheme: null, - status: 'up', - type: 'http', - }, - }, - { - id: 'id10', - timestamp: '2019-01-28T17:47:19.077Z', - http: { response: { status_code: 200 } }, - error: null, - monitor: { - duration: { us: 287543 }, - id: 'auto-http-0X9CB71300ABD5A2A8', - ip: '192.30.253.112', - name: '', - scheme: null, - status: 'up', - type: 'http', - }, - }, - ], - locations: ['nyc'], - }, + response = { + total: 9231, + locations: ['nyc'], + pings: [ + { + '@timestamp': '2019-01-28T17:47:08.078Z', + error: { + message: 'dial tcp 127.0.0.1:9200: connect: connection refused', + type: 'io', + }, + monitor: { + duration: { us: 1430 }, + id: 'auto-tcp-0X81440A68E839814C', + ip: '127.0.0.1', + name: '', + status: 'down', + type: 'tcp', + }, + }, + { + '@timestamp': '2019-01-28T17:47:09.075Z', + error: { + message: 'dial tcp 127.0.0.1:9200: connect: connection refused', + type: 'io', + }, + monitor: { + duration: { us: 1370 }, + id: 'auto-tcp-0X81440A68E839814C', + ip: '127.0.0.1', + name: '', + status: 'down', + type: 'tcp', + }, + }, + { + '@timestamp': '2019-01-28T17:47:06.077Z', + monitor: { + duration: { us: 1452 }, + id: 'auto-tcp-0X81440A68E839814C', + ip: '127.0.0.1', + name: '', + status: 'up', + type: 'tcp', + }, + }, + { + '@timestamp': '2019-01-28T17:47:07.075Z', + error: { + message: 'dial tcp 127.0.0.1:9200: connect: connection refused', + type: 'io', + }, + monitor: { + duration: { us: 1094 }, + id: 'auto-tcp-0X81440A68E839814C', + ip: '127.0.0.1', + name: '', + status: 'down', + type: 'tcp', + }, + }, + { + '@timestamp': '2019-01-28T17:47:07.074Z', + error: { + message: + 'Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused', + type: 'io', + }, + monitor: { + duration: { us: 1597 }, + id: 'auto-http-0X3675F89EF0612091', + ip: '127.0.0.1', + name: '', + status: 'down', + type: 'http', + }, + }, + { + '@timestamp': '2019-01-28T17:47:18.080Z', + error: { + message: 'dial tcp 127.0.0.1:9200: connect: connection refused', + type: 'io', + }, + monitor: { + duration: { us: 1699 }, + id: 'auto-tcp-0X81440A68E839814C', + ip: '127.0.0.1', + name: '', + status: 'down', + type: 'tcp', + }, + }, + { + '@timestamp': '2019-01-28T17:47:19.076Z', + error: { + message: 'dial tcp 127.0.0.1:9200: connect: connection refused', + type: 'io', + }, + monitor: { + duration: { us: 5384 }, + id: 'auto-tcp-0X81440A68E839814C', + ip: '127.0.0.1', + name: '', + status: 'down', + type: 'tcp', + }, + }, + { + '@timestamp': '2019-01-28T17:47:19.076Z', + error: { + message: + 'Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused', + type: 'io', + }, + monitor: { + duration: { us: 5397 }, + id: 'auto-http-0X3675F89EF0612091', + ip: '127.0.0.1', + name: '', + status: 'down', + type: 'http', + }, + }, + { + '@timestamp': '2019-01-28T17:47:19.077Z', + http: { response: { status_code: 200 } }, + monitor: { + duration: { us: 127511 }, + id: 'auto-http-0X131221E73F825974', + ip: '172.217.7.4', + name: '', + status: 'up', + type: 'http', + }, + }, + { + '@timestamp': '2019-01-28T17:47:19.077Z', + http: { response: { status_code: 200 } }, + monitor: { + duration: { us: 287543 }, + id: 'auto-http-0X9CB71300ABD5A2A8', + ip: '192.30.253.112', + name: '', + status: 'up', + type: 'http', + }, + }, + ], }; }); it('renders sorted list without errors', () => { const component = shallowWithIntl( - {}} onSelectedStatusChange={jest.fn()} pageSize={30} + pings={response.pings} + size={10} + status="all" selectedOption="down" selectedLocation={AllLocationOption.value} /> @@ -219,13 +195,13 @@ describe('PingList component', () => { beforeEach(() => { itemIdToExpandedRowMap = {}; - pings = pingList.allPings.pings; + pings = response.pings; }); it('should expand an item if empty', () => { const ping = pings[0]; toggleDetails(ping, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); - expect(itemIdToExpandedRowMap).toHaveProperty(ping.id); + expect(itemIdToExpandedRowMap).toHaveProperty(ping.monitor.id); }); it('should un-expand an item if clicked again', () => { @@ -240,7 +216,7 @@ describe('PingList component', () => { const pingB = pings[1]; toggleDetails(pingA, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); toggleDetails(pingB, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); - expect(itemIdToExpandedRowMap).toHaveProperty(pingB.id); + expect(itemIdToExpandedRowMap).toHaveProperty(pingB.monitor.id); }); }); }); diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx index c684235122e34b..a3b9501d170e23 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx @@ -16,14 +16,14 @@ import { } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Ping, HttpBody } from '../../../../common/graphql/types'; +import { Ping, HttpResponseBody } from '../../../../common/types/ping/ping'; import { DocLinkForBody } from './doc_link_body'; interface Props { ping: Ping; } -const BodyDescription = ({ body }: { body: HttpBody }) => { +const BodyDescription = ({ body }: { body: HttpResponseBody }) => { const contentBytes = body.content_bytes || 0; const bodyBytes = body.bytes || 0; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index d5d148c18aa02b..bfcaca3294d0ef 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -23,12 +23,12 @@ import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; import React, { useState, useEffect } from 'react'; import styled from 'styled-components'; -import { Ping } from '../../../../common/graphql/types'; +import { Ping } from '../../../../common/types/ping/ping'; import { convertMicrosecondsToMilliseconds as microsToMillis } from '../../../lib/helper'; import { LocationName } from './../location_name'; import { Pagination } from './../monitor_list'; import { PingListExpandedRowComponent } from './expanded_row'; -import { GetPingsParams, NewPing } from '../../../../common/types/ping/ping'; +import { GetPingsParams } from '../../../../common/types/ping/ping'; import { PingListProps } from '../../connected/pings'; interface ExpandedRowMap { @@ -43,14 +43,14 @@ export const toggleDetails = ( setItemIdToExpandedRowMap: (update: ExpandedRowMap) => any ) => { // If the user has clicked on the expanded map, close all expanded rows. - if (itemIdToExpandedRowMap[ping.id]) { + if (itemIdToExpandedRowMap[ping.monitor.id]) { setItemIdToExpandedRowMap({}); return; } // Otherwise expand this row const newItemIdToExpandedRowMap: ExpandedRowMap = {}; - newItemIdToExpandedRowMap[ping.id] = ; + newItemIdToExpandedRowMap[ping.monitor.id] = ; setItemIdToExpandedRowMap(newItemIdToExpandedRowMap); }; @@ -64,7 +64,7 @@ interface Props extends PingListProps { getPings: (props: GetPingsParams) => void; loading: boolean; locations: string[]; - pings: NewPing[]; + pings: Ping[]; } export const PingListComponent = (props: Props) => { @@ -95,7 +95,7 @@ export const PingListComponent = (props: Props) => { size, status: status !== 'all' ? status : '', }); - }, [dateRangeStart, dateRangeEnd, monitorId, selectedLocation, size, status]); + }, [dateRangeStart, dateRangeEnd, getPings, monitorId, selectedLocation, size, status]); const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); @@ -128,7 +128,7 @@ export const PingListComponent = (props: Props) => { ); const hasStatus: boolean = pings.reduce( - (hasHttpStatus: boolean, currentPing: Ping) => + (hasHttpStatus: boolean, currentPing) => hasHttpStatus || !!currentPing.http?.response?.status_code, false ); @@ -152,7 +152,7 @@ export const PingListComponent = (props: Props) => { {i18n.translate('xpack.uptime.pingList.recencyMessage', { - values: { fromNow: moment(item.timestamp).fromNow() }, + values: { fromNow: moment(item['@timestamp']).fromNow() }, defaultMessage: 'Checked {fromNow}', description: 'A string used to inform our users how long ago Heartbeat pinged the selected host.', @@ -226,15 +226,15 @@ export const PingListComponent = (props: Props) => { return ( toggleDetails(item, itemIdToExpandedRowMap, setItemIdToExpandedRowMap)} - disabled={!item.error && !(item.http?.response?.body?.bytes > 0)} + disabled={!item.error && !(item.http?.response?.body?.content_bytes ?? 0 > 0)} aria-label={ - itemIdToExpandedRowMap[item.id] + itemIdToExpandedRowMap[item.monitor.id] ? i18n.translate('xpack.uptime.pingList.collapseRow', { defaultMessage: 'Collapse', }) : i18n.translate('xpack.uptime.pingList.expandRow', { defaultMessage: 'Expand' }) } - iconType={itemIdToExpandedRowMap[item.id] ? 'arrowUp' : 'arrowDown'} + iconType={itemIdToExpandedRowMap[item.monitor.id] ? 'arrowUp' : 'arrowDown'} /> ); }, diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 05def0a4f4c686..75a9ccd7dd901a 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -13,7 +13,7 @@ import { UptimeRefreshContext } from '../contexts'; import { useUptimeTelemetry, useUrlParams, UptimePage } from '../hooks'; import { useTrackPageview } from '../../../../../plugins/observability/public'; import { MonitorStatusDetails } from '../components/connected'; -import { Ping } from '../../common/graphql/types'; +import { Ping } from '../../common/types/ping/ping'; import { AppState } from '../state'; import { selectSelectedMonitor } from '../state/selectors'; import { getSelectedMonitor } from '../state/actions'; diff --git a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts index 936e864b75619a..d6c17dc6cd9f79 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts @@ -4,9 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ +import { isRight } from 'fp-ts/lib/Either'; +import { ThrowReporter } from 'io-ts/lib/ThrowReporter'; import { getApiPath } from '../../lib/helper'; import { QueryParams } from '../actions/types'; -import { Ping } from '../../../common/graphql/types'; +import { PingType, Ping } from '../../../common/types/ping/ping'; export interface APIParams { basePath: string; @@ -45,5 +47,10 @@ export const fetchMonitorStatus = async ({ throw new Error(response.statusText); } const responseData = await response.json(); - return responseData; + const decoded = PingType.decode(responseData); + if (isRight(decoded)) { + return decoded.right; + } + ThrowReporter.report(decoded); + throw new Error('Error parsing API response'); }; diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts index 2688a0946dd610..7bf3194a34535a 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts @@ -12,7 +12,7 @@ import { getMonitorStatusSuccess, getMonitorStatusFail, } from '../actions'; -import { Ping } from '../../../common/graphql/types'; +import { Ping } from '../../../common/types/ping/ping'; import { QueryParams } from '../actions/types'; export interface MonitorStatusState { 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 2d549fce06884f..4479cea7847c8f 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 @@ -4,8 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ +import { isRight } from 'fp-ts/lib/Either'; +import { ThrowReporter } from 'io-ts/lib/ThrowReporter'; import { UMElasticsearchQueryFn } from '../adapters'; -import { Ping } from '../../../../../legacy/plugins/uptime/common/graphql/types'; +import { PingType, Ping } from '../../../../../legacy/plugins/uptime/common/types/ping/ping'; import { INDEX_NAMES } from '../../../../../legacy/plugins/uptime/common/constants'; export interface GetLatestMonitorParams { @@ -69,10 +71,14 @@ export const getLatestMonitor: UMElasticsearchQueryFn = async index: INDEX_NAMES.HEARTBEAT, body: { size: 1, - _source: ['url', 'monitor', 'observer'], + _source: ['@timestamp', 'url', 'monitor', 'observer'], query: { bool: { filter: [ @@ -45,6 +47,11 @@ export const getMonitor: UMElasticsearchQueryFn = async }; const result = await callES('search', params); - - return result.hits.hits[0]?._source; + const decoded = PingType.decode(result.hits.hits[0]?._source); + if (isRight(decoded)) { + return decoded.right; + } else { + ThrowReporter.report(decoded); + throw new Error('Received invalid document'); + } }; diff --git a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts index ddca27d7820663..2790891e0d3f31 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts @@ -4,12 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ +import { isRight } from 'fp-ts/lib/Either'; +import { ThrowReporter } from 'io-ts/lib/ThrowReporter'; import { UMElasticsearchQueryFn } from '../adapters/framework'; import { - PingResults, + HttpResponseBody, + PingsResponse, + PingsResponseType, Ping, - HttpBody, -} from '../../../../../legacy/plugins/uptime/common/graphql/types'; +} from '../../../../../legacy/plugins/uptime/common/types/ping/ping'; import { INDEX_NAMES } from '../../../../../legacy/plugins/uptime/common/constants'; export interface GetPingsParams { @@ -35,7 +38,7 @@ export interface GetPingsParams { location?: string | null; } -export const getPings: UMElasticsearchQueryFn = async ({ +export const getPings: UMElasticsearchQueryFn = async ({ callES, dateRangeStart, dateRangeEnd, @@ -94,7 +97,7 @@ export const getPings: UMElasticsearchQueryFn = asy // Calculate here the length of the content string in bytes, this is easier than in client JS, where // we don't have access to Buffer.byteLength. There are some hacky ways to do this in the // client but this is cleaner. - const httpBody: HttpBody | undefined = _source?.http?.response?.body; + const httpBody: HttpResponseBody | undefined = _source?.http?.response?.body; if (httpBody && httpBody.content) { httpBody.content_bytes = Buffer.byteLength(httpBody.content); } @@ -102,11 +105,15 @@ export const getPings: UMElasticsearchQueryFn = asy return { id: _id, timestamp, ..._source }; }); - const results: PingResults = { + const decoded = PingsResponseType.decode({ total: total.value, locations: locations.buckets.map((bucket: { key: string }) => bucket.key), pings, - }; - - return results; + }); + if (isRight(decoded)) { + return decoded.right; + } else { + ThrowReporter.report(decoded); + throw new Error('Unable to parse data'); + } }; diff --git a/x-pack/plugins/uptime/server/lib/requests/types.ts b/x-pack/plugins/uptime/server/lib/requests/types.ts deleted file mode 100644 index 53a4e989e37893..00000000000000 --- a/x-pack/plugins/uptime/server/lib/requests/types.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { Ping, PingResults } from '../../../../../legacy/plugins/uptime/common/graphql/types'; -import { UMElasticsearchQueryFn } from '../adapters'; -import { - GetPingHistogramParams, - HistogramResult, -} from '../../../../../legacy/plugins/uptime/common/types'; - -export interface GetAllParams { - /** @member dateRangeStart timestamp bounds */ - dateRangeStart: string; - - /** @member dateRangeEnd timestamp bounds */ - dateRangeEnd: string; - - /** @member monitorId optional limit by monitorId */ - monitorId?: string | null; - - /** @member status optional limit by check statuses */ - status?: string | null; - - /** @member sort optional sort by timestamp */ - sort?: string | null; - - /** @member size optional limit query size */ - size?: number | null; - - /** @member location optional location value for use in filtering*/ - location?: string | null; -} - -export interface GetLatestMonitorDocsParams { - /** @member dateRangeStart timestamp bounds */ - dateStart?: string; - - /** @member dateRangeEnd timestamp bounds */ - dateEnd?: string; - - /** @member monitorId optional limit to monitorId */ - monitorId?: string | null; -} - -/** - * Count the number of documents in heartbeat indices - */ -export interface UMPingsAdapter { - getAll: UMElasticsearchQueryFn; - - // Get the monitor meta info regardless of timestamp - getMonitor: UMElasticsearchQueryFn; - - getLatestMonitorStatus: UMElasticsearchQueryFn; - - getPingHistogram: UMElasticsearchQueryFn; -} - -export interface HistogramQueryResult { - key: number; - key_as_string: string; - doc_count: number; - down: { - doc_count: number; - }; - up: { - doc_count: number; - }; -} diff --git a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts index 6fd77afe711d4d..becbaa326db96b 100644 --- a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts +++ b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts @@ -7,9 +7,9 @@ import { UMElasticsearchQueryFn } from '../adapters'; import { Ping, - PingResults, - StatesIndexStatus, -} from '../../../../../legacy/plugins/uptime/common/graphql/types'; + PingsResponse as PingResults, +} from '../../../../../legacy/plugins/uptime/common/types/ping/ping'; +import { StatesIndexStatus } from '../../../../../legacy/plugins/uptime/common/graphql/types'; import { GetFilterBarParams, GetLatestMonitorParams, From aee6023d0f1e6fe53556f0df67bdb8f12871524c Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Tue, 17 Mar 2020 13:36:46 -0400 Subject: [PATCH 05/36] Update some broken tests. --- .../__snapshots__/ping_list.test.tsx.snap | 651 ++++++++---------- .../ping_list/__tests__/ping_list.test.tsx | 71 +- .../functional/ping_list/ping_list.tsx | 6 +- .../__tests__/get_latest_monitor.test.ts | 23 +- 4 files changed, 381 insertions(+), 370 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap index d19de73c16c5fb..f32d84bc154177 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap @@ -1,385 +1,334 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`PingList component renders sorted list without errors 1`] = ` - - - + +

+ +

+
+ + + -

- + -

-
- - - + + + - - - - - - - - - - - - - - - - - - - - + + + + + + Response code + , + "render": [Function], + }, + Object { + "align": "right", + "isExpander": true, + "render": [Function], + "width": "24px", + }, + ] + } + hasActions={true} + isExpandable={true} + itemId="@timestamp" + itemIdToExpandedRowMap={Object {}} + items={ + Array [ + Object { + "@timestamp": "2019-01-28T17:47:08.078Z", + "error": Object { + "message": "dial tcp 127.0.0.1:9200: connect: connection refused", + "type": "io", }, - Object { - "align": "right", - "dataType": "number", - "field": "monitor.ip", - "name": "IP", + "monitor": Object { + "duration": Object { + "us": 1430, + }, + "id": "auto-tcp-0X81440A68E839814C", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "tcp", }, - Object { - "align": "right", - "field": "monitor.duration.us", - "name": "Duration", - "render": [Function], + }, + Object { + "@timestamp": "2019-01-28T17:47:09.075Z", + "error": Object { + "message": "dial tcp 127.0.0.1:9200: connect: connection refused", + "type": "io", }, - Object { - "align": "right", - "field": "error.type", - "name": "Error type", - "render": [Function], + "monitor": Object { + "duration": Object { + "us": 1370, + }, + "id": "auto-tcp-0X81440A68E839814D", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "tcp", }, - Object { - "align": "right", - "field": "http.response.status_code", - "name": - Response code - , - "render": [Function], + }, + Object { + "@timestamp": "2019-01-28T17:47:06.077Z", + "monitor": Object { + "duration": Object { + "us": 1452, + }, + "id": "auto-tcp-0X81440A68E839814E", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "tcp", }, - Object { - "align": "right", - "isExpander": true, - "render": [Function], - "width": "24px", + }, + Object { + "@timestamp": "2019-01-28T17:47:07.075Z", + "error": Object { + "message": "dial tcp 127.0.0.1:9200: connect: connection refused", + "type": "io", }, - ] - } - hasActions={true} - isExpandable={true} - itemId="id" - itemIdToExpandedRowMap={Object {}} - items={ - Array [ - Object { - "error": Object { - "message": "dial tcp 127.0.0.1:9200: connect: connection refused", - "type": "io", + "monitor": Object { + "duration": Object { + "us": 1094, }, - "http": null, - "id": "id1", - "monitor": Object { - "duration": Object { - "us": 1430, - }, - "id": "auto-tcp-0X81440A68E839814C", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "tcp", - }, - "timestamp": "2019-01-28T17:47:08.078Z", + "id": "auto-tcp-0X81440A68E839814F", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "tcp", }, - Object { - "error": Object { - "message": "dial tcp 127.0.0.1:9200: connect: connection refused", - "type": "io", - }, - "http": null, - "id": "id2", - "monitor": Object { - "duration": Object { - "us": 1370, - }, - "id": "auto-tcp-0X81440A68E839814C", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "tcp", - }, - "timestamp": "2019-01-28T17:47:09.075Z", + }, + Object { + "@timestamp": "2019-01-28T17:47:07.074Z", + "error": Object { + "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", + "type": "io", }, - Object { - "error": null, - "http": null, - "id": "id3", - "monitor": Object { - "duration": Object { - "us": 1452, - }, - "id": "auto-tcp-0X81440A68E839814C", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "tcp", + "monitor": Object { + "duration": Object { + "us": 1597, }, - "timestamp": "2019-01-28T17:47:06.077Z", + "id": "auto-http-0X3675F89EF061209G", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", }, - Object { - "error": Object { - "message": "dial tcp 127.0.0.1:9200: connect: connection refused", - "type": "io", - }, - "http": null, - "id": "id4", - "monitor": Object { - "duration": Object { - "us": 1094, - }, - "id": "auto-tcp-0X81440A68E839814C", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "tcp", - }, - "timestamp": "2019-01-28T17:47:07.075Z", + }, + Object { + "@timestamp": "2019-01-28T17:47:18.080Z", + "error": Object { + "message": "dial tcp 127.0.0.1:9200: connect: connection refused", + "type": "io", }, - Object { - "error": Object { - "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", - "type": "io", + "monitor": Object { + "duration": Object { + "us": 1699, }, - "http": null, - "id": "id5", - "monitor": Object { - "duration": Object { - "us": 1597, - }, - "id": "auto-http-0X3675F89EF0612091", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "http", - }, - "timestamp": "2019-01-28T17:47:07.074Z", + "id": "auto-tcp-0X81440A68E839814H", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "tcp", }, - Object { - "error": Object { - "message": "dial tcp 127.0.0.1:9200: connect: connection refused", - "type": "io", - }, - "http": null, - "id": "id6", - "monitor": Object { - "duration": Object { - "us": 1699, - }, - "id": "auto-tcp-0X81440A68E839814C", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "tcp", - }, - "timestamp": "2019-01-28T17:47:18.080Z", + }, + Object { + "@timestamp": "2019-01-28T17:47:19.076Z", + "error": Object { + "message": "dial tcp 127.0.0.1:9200: connect: connection refused", + "type": "io", }, - Object { - "error": Object { - "message": "dial tcp 127.0.0.1:9200: connect: connection refused", - "type": "io", - }, - "http": null, - "id": "id7", - "monitor": Object { - "duration": Object { - "us": 5384, - }, - "id": "auto-tcp-0X81440A68E839814C", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "tcp", + "monitor": Object { + "duration": Object { + "us": 5384, }, - "timestamp": "2019-01-28T17:47:19.076Z", + "id": "auto-tcp-0X81440A68E839814I", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "tcp", }, - Object { - "error": Object { - "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", - "type": "io", - }, - "http": null, - "id": "id8", - "monitor": Object { - "duration": Object { - "us": 5397, - }, - "id": "auto-http-0X3675F89EF0612091", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "http", + }, + Object { + "@timestamp": "2019-01-28T17:47:19.076Z", + "error": Object { + "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", + "type": "io", + }, + "monitor": Object { + "duration": Object { + "us": 5397, }, - "timestamp": "2019-01-28T17:47:19.076Z", + "id": "auto-http-0X3675F89EF061209J", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", }, - Object { - "error": null, - "http": Object { - "response": Object { - "status_code": 200, - }, + }, + Object { + "@timestamp": "2019-01-28T17:47:19.077Z", + "http": Object { + "response": Object { + "status_code": 200, }, - "id": "id9", - "monitor": Object { - "duration": Object { - "us": 127511, - }, - "id": "auto-http-0X131221E73F825974", - "ip": "172.217.7.4", - "name": "", - "scheme": null, - "status": "up", - "type": "http", + }, + "monitor": Object { + "duration": Object { + "us": 127511, }, - "timestamp": "2019-01-28T17:47:19.077Z", + "id": "auto-http-0X131221E73F825974", + "ip": "172.217.7.4", + "name": "", + "status": "up", + "type": "http", }, - Object { - "error": null, - "http": Object { - "response": Object { - "status_code": 200, - }, + }, + Object { + "@timestamp": "2019-01-28T17:47:19.077Z", + "http": Object { + "response": Object { + "status_code": 200, }, - "id": "id10", - "monitor": Object { - "duration": Object { - "us": 287543, - }, - "id": "auto-http-0X9CB71300ABD5A2A8", - "ip": "192.30.253.112", - "name": "", - "scheme": null, - "status": "up", - "type": "http", + }, + "monitor": Object { + "duration": Object { + "us": 287543, }, - "timestamp": "2019-01-28T17:47:19.077Z", + "id": "auto-http-0X9CB71300ABD5A2A8", + "ip": "192.30.253.112", + "name": "", + "status": "up", + "type": "http", }, - ] - } - loading={false} - noItemsMessage="No items found" - onChange={[Function]} - pagination={ - Object { - "initialPageSize": 20, - "pageIndex": 0, - "pageSize": 30, - "pageSizeOptions": Array [ - 5, - 10, - 20, - 50, - 100, - ], - "totalItemCount": 30, - } + }, + ] + } + loading={false} + noItemsMessage="No items found" + onChange={[Function]} + pagination={ + Object { + "initialPageSize": 20, + "pageIndex": 0, + "pageSize": 30, + "pageSizeOptions": Array [ + 5, + 10, + 20, + 50, + 100, + ], + "totalItemCount": 30, } - responsive={true} - tableLayout="fixed" - /> -
-
+ } + responsive={true} + tableLayout="fixed" + /> + `; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index e626251025557f..807036ecc2be14 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -26,7 +26,7 @@ describe('PingList component', () => { }, monitor: { duration: { us: 1430 }, - id: 'auto-tcp-0X81440A68E839814C', + id: 'auto-tcp-0X81440A68E839814F', ip: '127.0.0.1', name: '', status: 'down', @@ -41,7 +41,7 @@ describe('PingList component', () => { }, monitor: { duration: { us: 1370 }, - id: 'auto-tcp-0X81440A68E839814C', + id: 'auto-tcp-0X81440A68E839814D', ip: '127.0.0.1', name: '', status: 'down', @@ -52,7 +52,7 @@ describe('PingList component', () => { '@timestamp': '2019-01-28T17:47:06.077Z', monitor: { duration: { us: 1452 }, - id: 'auto-tcp-0X81440A68E839814C', + id: 'auto-tcp-0X81440A68E839814D', ip: '127.0.0.1', name: '', status: 'up', @@ -67,7 +67,7 @@ describe('PingList component', () => { }, monitor: { duration: { us: 1094 }, - id: 'auto-tcp-0X81440A68E839814C', + id: 'auto-tcp-0X81440A68E839814E', ip: '127.0.0.1', name: '', status: 'down', @@ -83,7 +83,7 @@ describe('PingList component', () => { }, monitor: { duration: { us: 1597 }, - id: 'auto-http-0X3675F89EF0612091', + id: 'auto-http-0X3675F89EF061209G', ip: '127.0.0.1', name: '', status: 'down', @@ -98,7 +98,7 @@ describe('PingList component', () => { }, monitor: { duration: { us: 1699 }, - id: 'auto-tcp-0X81440A68E839814C', + id: 'auto-tcp-0X81440A68E839814H', ip: '127.0.0.1', name: '', status: 'down', @@ -113,7 +113,7 @@ describe('PingList component', () => { }, monitor: { duration: { us: 5384 }, - id: 'auto-tcp-0X81440A68E839814C', + id: 'auto-tcp-0X81440A68E839814I', ip: '127.0.0.1', name: '', status: 'down', @@ -129,7 +129,7 @@ describe('PingList component', () => { }, monitor: { duration: { us: 5397 }, - id: 'auto-http-0X3675F89EF0612091', + id: 'auto-http-0X3675F89EF061209J', ip: '127.0.0.1', name: '', status: 'down', @@ -141,7 +141,7 @@ describe('PingList component', () => { http: { response: { status_code: 200 } }, monitor: { duration: { us: 127511 }, - id: 'auto-http-0X131221E73F825974', + id: 'auto-tcp-0X81440A68E839814C', ip: '172.217.7.4', name: '', status: 'up', @@ -153,7 +153,7 @@ describe('PingList component', () => { http: { response: { status_code: 200 } }, monitor: { duration: { us: 287543 }, - id: 'auto-http-0X9CB71300ABD5A2A8', + id: 'auto-http-0X131221E73F825974', ip: '192.30.253.112', name: '', status: 'up', @@ -201,7 +201,31 @@ describe('PingList component', () => { it('should expand an item if empty', () => { const ping = pings[0]; toggleDetails(ping, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); - expect(itemIdToExpandedRowMap).toHaveProperty(ping.monitor.id); + expect(itemIdToExpandedRowMap).toMatchInlineSnapshot(` + Object { + "2019-01-28T17:47:08.078Z": , + } + `); }); it('should un-expand an item if clicked again', () => { @@ -216,7 +240,30 @@ describe('PingList component', () => { const pingB = pings[1]; toggleDetails(pingA, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); toggleDetails(pingB, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); - expect(itemIdToExpandedRowMap).toHaveProperty(pingB.monitor.id); + expect(pingA['@timestamp']).not.toEqual(pingB['@timestamp']); + expect(itemIdToExpandedRowMap[pingB['@timestamp']]).toMatchInlineSnapshot(` + + `); }); }); }); diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index bfcaca3294d0ef..6c8966c7370c12 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -43,14 +43,14 @@ export const toggleDetails = ( setItemIdToExpandedRowMap: (update: ExpandedRowMap) => any ) => { // If the user has clicked on the expanded map, close all expanded rows. - if (itemIdToExpandedRowMap[ping.monitor.id]) { + if (itemIdToExpandedRowMap[ping['@timestamp']]) { setItemIdToExpandedRowMap({}); return; } // Otherwise expand this row const newItemIdToExpandedRowMap: ExpandedRowMap = {}; - newItemIdToExpandedRowMap[ping.monitor.id] = ; + newItemIdToExpandedRowMap[ping['@timestamp']] = ; setItemIdToExpandedRowMap(newItemIdToExpandedRowMap); }; @@ -316,7 +316,7 @@ export const PingListComponent = (props: Props) => { isExpandable={true} hasActions={true} items={pings} - itemId="id" + itemId="@timestamp" itemIdToExpandedRowMap={itemIdToExpandedRowMap} pagination={pagination} onChange={(criteria: any) => onPageCountChange(criteria.page!.size)} 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 ad0987a7f6faf2..a7a87d61bf3305 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 @@ -61,9 +61,14 @@ describe('getLatestMonitor', () => { hits: [ { _source: { - '@timestamp': 123456, + '@timestamp': '123456', monitor: { + duration: { + us: 12345, + }, id: 'testMonitor', + status: 'down', + type: 'http', }, }, }, @@ -85,9 +90,19 @@ describe('getLatestMonitor', () => { dateEnd: 'now', monitorId: 'testMonitor', }); - expect(result.timestamp).toBe(123456); - expect(result.monitor).not.toBeFalsy(); - expect(result?.monitor?.id).toBe('testMonitor'); + expect(result).toMatchInlineSnapshot(` + Object { + "@timestamp": "123456", + "monitor": Object { + "duration": Object { + "us": 12345, + }, + "id": "testMonitor", + "status": "down", + "type": "http", + }, + } + `); expect(mockEsClient).toHaveBeenCalledWith('search', expectedGetLatestSearchParams); }); }); From 0370e861756ed3e07d7c417752958d42c6c89bff Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 23 Mar 2020 17:08:47 -0400 Subject: [PATCH 06/36] Add test for new helper function. --- .../public/state/api/__tests__/ping.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts diff --git a/x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts b/x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts new file mode 100644 index 00000000000000..e7a790de457a39 --- /dev/null +++ b/x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { mergeParams } from '../ping'; + +describe('mergeParams', () => { + describe('mergeParams', () => { + it('returns the guaranteed params if there are no falsy params', () => { + expect(mergeParams({ foo: 'bar' }, {})).toMatchInlineSnapshot(); + }); + + it('adds truthy params while ignoring falsy params', () => { + expect( + mergeParams({ young: 'star' }, { h: 1, he: 2, li: undefined }) + ).toMatchInlineSnapshot(); + }); + }); +}); From 1a23bacc3c6ec10e35380ba9361db699c2f2b118 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 23 Mar 2020 18:37:44 -0400 Subject: [PATCH 07/36] Write test snapshots. --- .../public/state/api/__tests__/ping.test.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts b/x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts index e7a790de457a39..d7b3667397101c 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts @@ -6,16 +6,24 @@ import { mergeParams } from '../ping'; -describe('mergeParams', () => { +describe('ping', () => { describe('mergeParams', () => { it('returns the guaranteed params if there are no falsy params', () => { - expect(mergeParams({ foo: 'bar' }, {})).toMatchInlineSnapshot(); + expect(mergeParams({ foo: 'bar' }, {})).toMatchInlineSnapshot(` + Object { + "foo": "bar", + } + `); }); it('adds truthy params while ignoring falsy params', () => { - expect( - mergeParams({ young: 'star' }, { h: 1, he: 2, li: undefined }) - ).toMatchInlineSnapshot(); + expect(mergeParams({ young: 'star' }, { h: 1, he: 2, li: undefined })).toMatchInlineSnapshot(` + Object { + "h": 1, + "he": 2, + "young": "star", + } + `); }); }); }); From 999cc076f0a2e98daa15d2fdab9a8fc6ca69bf4a Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Tue, 24 Mar 2020 17:49:49 -0400 Subject: [PATCH 08/36] Migrate api tests from graphql to rest. --- .../uptime/server/lib/requests/get_pings.ts | 6 +- .../apis/uptime/get_all_pings.js | 4 +- .../uptime/graphql/fixtures/ping_list.json | 774 ++-- .../graphql/fixtures/ping_list_count.json | 3932 +++++++++++------ .../fixtures/ping_list_monitor_id.json | 1154 +++-- .../graphql/fixtures/ping_list_sort.json | 394 +- .../apis/uptime/graphql/index.js | 1 - .../apis/uptime/graphql/ping_list.ts | 116 - .../api_integration/apis/uptime/rest/index.ts | 1 + .../apis/uptime/rest/ping_list.ts | 66 + 10 files changed, 4070 insertions(+), 2378 deletions(-) delete mode 100644 x-pack/test/api_integration/apis/uptime/graphql/ping_list.ts create mode 100644 x-pack/test/api_integration/apis/uptime/rest/ping_list.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts index 468833ee8112e1..923f65d2f89f41 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts @@ -91,9 +91,7 @@ export const getPings: UMElasticsearchQueryFn = a const locations = aggs?.locations ?? { buckets: [{ key: 'N/A', doc_count: 0 }] }; - const pings: Ping[] = hits.map(({ _id, _source }: any) => { - const timestamp = _source['@timestamp']; - + const pings: Ping[] = hits.map(({ _source }: any) => { // Calculate here the length of the content string in bytes, this is easier than in client JS, where // we don't have access to Buffer.byteLength. There are some hacky ways to do this in the // client but this is cleaner. @@ -102,7 +100,7 @@ export const getPings: UMElasticsearchQueryFn = a httpBody.content_bytes = Buffer.byteLength(httpBody.content); } - return { id: _id, timestamp, ..._source }; + return _source; }); const decoded = PingsResponseType.decode({ diff --git a/x-pack/test/api_integration/apis/uptime/get_all_pings.js b/x-pack/test/api_integration/apis/uptime/get_all_pings.js index dcbc9389b1da24..a194578686ea09 100644 --- a/x-pack/test/api_integration/apis/uptime/get_all_pings.js +++ b/x-pack/test/api_integration/apis/uptime/get_all_pings.js @@ -39,8 +39,8 @@ export default function({ getService }) { expect(apiResponse.total).to.be(2); expect(apiResponse.pings.length).to.be(2); - expect(apiResponse.pings[0].timestamp).to.be('2018-10-30T14:49:23.889Z'); - expect(apiResponse.pings[1].timestamp).to.be('2018-10-30T18:51:56.792Z'); + expect(apiResponse.pings[0]['@timestamp']).to.be('2018-10-30T14:49:23.889Z'); + expect(apiResponse.pings[1]['@timestamp']).to.be('2018-10-30T18:51:56.792Z'); }); it('should return results of n length', async () => { diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json index 330ec83931a62b..575c0d19771b07 100644 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json +++ b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json @@ -1,320 +1,536 @@ { - "allPings": { - "total": 2000, - "locations": [ - "mpls" - ], - "pings": [ - { - "timestamp": "2019-09-11T03:40:34.410Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 413 + "total": 2000, + "locations": ["mpls"], + "pings": [ + { + "@timestamp": "2019-09-11T03:40:34.410Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0074-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 32 }, + "response_header": { "us": 148 }, + "total": { "us": 363 }, + "validate": { "us": 180 }, + "write_request": { "us": 36 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 441 + "monitor": { + "check_group": "d77146ac-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 413 }, + "id": "0074-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 144 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0073-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 20 }, + "response_header": { "us": 153 }, + "total": { "us": 357 }, + "validate": { "us": 173 }, + "write_request": { "us": 33 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 482 + "monitor": { + "check_group": "d76f7d42-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 441 }, + "id": "0073-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 28 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 127 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0099-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 38 }, + "response_header": { "us": 186 }, + "total": { "us": 429 }, + "validate": { "us": 224 }, + "write_request": { "us": 34 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 558 + "monitor": { + "check_group": "d76f56d9-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 482 }, + "id": "0099-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 150 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0098-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 47 }, + "response_header": { "us": 218 }, + "total": { "us": 495 }, + "validate": { "us": 265 }, + "write_request": { "us": 53 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 304 + "monitor": { + "check_group": "d7714bae-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 558 }, + "id": "0098-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 189 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0075-intermittent", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 25 }, + "response_header": { "us": 151 }, + "total": { "us": 256 }, + "validate": { "us": 176 }, + "write_request": { "us": 22 } } }, - { - "timestamp": "2019-09-11T03:40:34.405Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 487 + "monitor": { + "check_group": "d77163e6-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 304 }, + "id": "0075-intermittent", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 53 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.405Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0097-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 216 }, + "total": { "us": 425 }, + "validate": { "us": 249 }, + "write_request": { "us": 26 } } }, - { - "timestamp": "2019-09-11T03:40:34.405Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 602 + "monitor": { + "check_group": "d7715ccb-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 487 }, + "id": "0097-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 16 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 144 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.405Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0049-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 40 }, + "response_header": { "us": 283 }, + "total": { "us": 545 }, + "validate": { "us": 323 }, + "write_request": { "us": 33 } } }, - { - "timestamp": "2019-09-11T03:40:34.390Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 365 + "monitor": { + "check_group": "d7715e1f-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 602 }, + "id": "0049-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 25 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 168 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.390Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0047-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 29 }, + "response_header": { "us": 186 }, + "total": { "us": 323 }, + "validate": { "us": 215 }, + "write_request": { "us": 43 } } }, - { - "timestamp": "2019-09-11T03:40:34.389Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 870 + "monitor": { + "check_group": "d7713de2-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 365 }, + "id": "0047-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 85 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.389Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0077-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 44 }, + "response_header": { "us": 278 }, + "total": { "us": 813 }, + "validate": { "us": 322 }, + "write_request": { "us": 23 } } }, - { - "timestamp": "2019-09-11T03:40:34.387Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 2808 + "monitor": { + "check_group": "d7714c9b-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 870 }, + "id": "0077-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 27 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 74 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.387Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0076-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 39 }, + "response_header": { "us": 119 }, + "total": { "us": 2751 }, + "validate": { "us": 159 }, + "write_request": { "us": 63 } } + }, + "monitor": { + "check_group": "d76f8c60-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 2808 }, + "id": "0076-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 21 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 97 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" } - ] - } -} \ No newline at end of file + } + ] +} diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json index 3a619f517626ad..6af0daa719e0a5 100644 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json +++ b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json @@ -1,1569 +1,2665 @@ { - "allPings": { - "total": 2000, - "locations": [ - "mpls" - ], - "pings": [ - { - "timestamp": "2019-09-11T03:40:34.410Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 413 + "total": 2000, + "locations": ["mpls"], + "pings": [ + { + "@timestamp": "2019-09-11T03:40:34.410Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0074-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 32 }, + "response_header": { "us": 148 }, + "total": { "us": 363 }, + "validate": { "us": 180 }, + "write_request": { "us": 36 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 441 + "monitor": { + "check_group": "d77146ac-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 413 }, + "id": "0074-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 144 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0073-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 20 }, + "response_header": { "us": 153 }, + "total": { "us": 357 }, + "validate": { "us": 173 }, + "write_request": { "us": 33 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 482 + "monitor": { + "check_group": "d76f7d42-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 441 }, + "id": "0073-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 28 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 127 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0099-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 38 }, + "response_header": { "us": 186 }, + "total": { "us": 429 }, + "validate": { "us": 224 }, + "write_request": { "us": 34 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 558 + "monitor": { + "check_group": "d76f56d9-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 482 }, + "id": "0099-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 150 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0098-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 47 }, + "response_header": { "us": 218 }, + "total": { "us": 495 }, + "validate": { "us": 265 }, + "write_request": { "us": 53 } } }, - { - "timestamp": "2019-09-11T03:40:34.406Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 304 + "monitor": { + "check_group": "d7714bae-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 558 }, + "id": "0098-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 189 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.406Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0075-intermittent", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 25 }, + "response_header": { "us": 151 }, + "total": { "us": 256 }, + "validate": { "us": 176 }, + "write_request": { "us": 22 } } }, - { - "timestamp": "2019-09-11T03:40:34.405Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 487 + "monitor": { + "check_group": "d77163e6-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 304 }, + "id": "0075-intermittent", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 53 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.405Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0097-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 216 }, + "total": { "us": 425 }, + "validate": { "us": 249 }, + "write_request": { "us": 26 } } }, - { - "timestamp": "2019-09-11T03:40:34.405Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 602 + "monitor": { + "check_group": "d7715ccb-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 487 }, + "id": "0097-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 16 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 144 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.405Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0049-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 40 }, + "response_header": { "us": 283 }, + "total": { "us": 545 }, + "validate": { "us": 323 }, + "write_request": { "us": 33 } } }, - { - "timestamp": "2019-09-11T03:40:34.390Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 365 + "monitor": { + "check_group": "d7715e1f-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 602 }, + "id": "0049-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 25 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 168 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.390Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0047-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 29 }, + "response_header": { "us": 186 }, + "total": { "us": 323 }, + "validate": { "us": 215 }, + "write_request": { "us": 43 } } }, - { - "timestamp": "2019-09-11T03:40:34.389Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 870 + "monitor": { + "check_group": "d7713de2-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 365 }, + "id": "0047-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 85 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.389Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0077-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 44 }, + "response_header": { "us": 278 }, + "total": { "us": 813 }, + "validate": { "us": 322 }, + "write_request": { "us": 23 } } }, - { - "timestamp": "2019-09-11T03:40:34.387Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 2808 + "monitor": { + "check_group": "d7714c9b-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 870 }, + "id": "0077-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 27 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 74 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.387Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0076-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 39 }, + "response_header": { "us": 119 }, + "total": { "us": 2751 }, + "validate": { "us": 159 }, + "write_request": { "us": 63 } } }, - { - "timestamp": "2019-09-11T03:40:34.386Z", - "http": { - "response": { - "status_code": 400, - "body": { - "bytes": 3, - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - "content": "400", - "content_bytes": 3 - } - } - }, - "error": { - "message": "400 Bad Request", - "type": "validate" - }, - "monitor": { - "duration": { - "us": 4258 + "monitor": { + "check_group": "d76f8c60-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 2808 }, + "id": "0076-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 21 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 97 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.386Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "error": { "message": "400 Bad Request", "type": "validate" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + "content_bytes": 3 }, - "id": "0050-down", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 400 + }, + "rtt": { + "content": { "us": 36 }, + "response_header": { "us": 213 }, + "total": { "us": 1011 }, + "validate": { "us": 249 }, + "write_request": { "us": 20 } } }, - { - "timestamp": "2019-09-11T03:40:34.386Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 4784 + "monitor": { + "check_group": "d76f9a0c-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 4258 }, + "id": "0050-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 3215 } }, + "summary": { "down": 1, "up": 0 }, + "tcp": { "rtt": { "connect": { "us": 84 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.386Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0048-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 30 }, + "response_header": { "us": 281 }, + "total": { "us": 1150 }, + "validate": { "us": 311 }, + "write_request": { "us": 22 } } }, - { - "timestamp": "2019-09-11T03:40:34.376Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 14580 + "monitor": { + "check_group": "d7715654-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 4784 }, + "id": "0048-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 3604 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 83 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.376Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0072-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 35 }, + "response_header": { "us": 102 }, + "total": { "us": 1078 }, + "validate": { "us": 137 }, + "write_request": { "us": 23 } } }, - { - "timestamp": "2019-09-11T03:40:34.376Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 14679 + "monitor": { + "check_group": "d7714e76-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 14580 }, + "id": "0072-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13443 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 83 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.376Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0096-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 34 }, + "response_header": { "us": 142 }, + "total": { "us": 1325 }, + "validate": { "us": 176 }, + "write_request": { "us": 20 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15308 + "monitor": { + "check_group": "d77161ee-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 14679 }, + "id": "0096-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13298 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 97 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0092-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 34 }, + "response_header": { "us": 112 }, + "total": { "us": 2186 }, + "validate": { "us": 146 }, + "write_request": { "us": 22 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15183 + "monitor": { + "check_group": "d7713d04-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15308 }, + "id": "0092-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13087 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 90 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0069-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 37 }, + "response_header": { "us": 101 }, + "total": { "us": 2053 }, + "validate": { "us": 139 }, + "write_request": { "us": 22 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15013 + "monitor": { + "check_group": "d771594f-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15183 }, + "id": "0069-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13079 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 95 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0093-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 103 }, + "total": { "us": 1817 }, + "validate": { "us": 136 }, + "write_request": { "us": 39 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 400, - "body": { - "bytes": 3, - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - "content": "400", - "content_bytes": 3 - } - } - }, - "error": { - "message": "400 Bad Request", - "type": "validate" - }, - "monitor": { - "duration": { - "us": 15117 + "monitor": { + "check_group": "d7712fe9-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15013 }, + "id": "0093-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13154 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 85 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "error": { "message": "400 Bad Request", "type": "validate" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + "content_bytes": 3 }, - "id": "0070-down", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 400 + }, + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 190 }, + "total": { "us": 2015 }, + "validate": { "us": 223 }, + "write_request": { "us": 21 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 14875 + "monitor": { + "check_group": "d7712c5a-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15117 }, + "id": "0070-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13061 } }, + "summary": { "down": 1, "up": 0 }, + "tcp": { "rtt": { "connect": { "us": 84 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0071-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 204 }, + "total": { "us": 1613 }, + "validate": { "us": 237 }, + "write_request": { "us": 17 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 14801 + "monitor": { + "check_group": "d7715562-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 14875 }, + "id": "0071-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13213 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 82 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0095-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 34 }, + "response_header": { "us": 231 }, + "total": { "us": 1525 }, + "validate": { "us": 265 }, + "write_request": { "us": 15 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15065 + "monitor": { + "check_group": "d7714e85-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 14801 }, + "id": "0095-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13245 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 84 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0032-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 34 }, + "response_header": { "us": 302 }, + "total": { "us": 1929 }, + "validate": { "us": 337 }, + "write_request": { "us": 24 } } }, - { - "timestamp": "2019-09-11T03:40:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 14911 + "monitor": { + "check_group": "d77164ad-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15065 }, + "id": "0032-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13096 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 85 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0094-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 38 }, + "response_header": { "us": 291 }, + "total": { "us": 1798 }, + "validate": { "us": 329 }, + "write_request": { "us": 33 } } }, - { - "timestamp": "2019-09-11T03:40:34.374Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 16135 + "monitor": { + "check_group": "d7716713-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 14911 }, + "id": "0094-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13082 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 84 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.374Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0046-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 32 }, + "response_header": { "us": 72 }, + "total": { "us": 2740 }, + "validate": { "us": 104 }, + "write_request": { "us": 27 } } }, - { - "timestamp": "2019-09-11T03:40:34.374Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15428 + "monitor": { + "check_group": "d7713116-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 16135 }, + "id": "0046-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13358 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 84 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.374Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0091-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 22 }, + "response_header": { "us": 79 }, + "total": { "us": 2518 }, + "validate": { "us": 101 }, + "write_request": { "us": 22 } } }, - { - "timestamp": "2019-09-11T03:40:34.374Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15499 + "monitor": { + "check_group": "d76f7de5-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15428 }, + "id": "0091-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 12873 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 86 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.374Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0067-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 43 }, + "response_header": { "us": 74 }, + "total": { "us": 2653 }, + "validate": { "us": 117 }, + "write_request": { "us": 24 } } }, - { - "timestamp": "2019-09-11T03:40:34.374Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15464 + "monitor": { + "check_group": "d76f5dc4-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15499 }, + "id": "0067-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 12810 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 97 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.374Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0068-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 50 }, + "response_header": { "us": 87 }, + "total": { "us": 2448 }, + "validate": { "us": 137 }, + "write_request": { "us": 23 } } }, - { - "timestamp": "2019-09-11T03:40:34.374Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 21736 + "monitor": { + "check_group": "d7712ff7-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15464 }, + "id": "0068-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 12979 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 194 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.374Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0090-intermittent", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 30 }, + "response_header": { "us": 155 }, + "total": { "us": 17495 }, + "validate": { "us": 185 }, + "write_request": { "us": 26 } } }, - { - "timestamp": "2019-09-11T03:40:34.374Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 21874 + "monitor": { + "check_group": "d76f6d4a-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 21736 }, + "id": "0090-intermittent", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 29 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 17180 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.374Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0031-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 29 }, + "response_header": { "us": 116 }, + "total": { "us": 16475 }, + "validate": { "us": 145 }, + "write_request": { "us": 23 } } }, - { - "timestamp": "2019-09-11T03:40:34.374Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 36584 + "monitor": { + "check_group": "d76f9f33-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 21874 }, + "id": "0031-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 32 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 855 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.374Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0066-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 21 }, + "response_header": { "us": 272 }, + "total": { "us": 36515 }, + "validate": { "us": 293 }, + "write_request": { "us": 46 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 3148 + "monitor": { + "check_group": "d76f47b3-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 36584 }, + "id": "0066-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 31 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 36164 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0084-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 68 }, + "response_header": { "us": 432 }, + "total": { "us": 3065 }, + "validate": { "us": 501 }, + "write_request": { "us": 91 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 13442 + "monitor": { + "check_group": "d7713a6e-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 3148 }, + "id": "0084-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 34 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 1839 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0083-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 42 }, + "response_header": { "us": 384 }, + "total": { "us": 13373 }, + "validate": { "us": 427 }, + "write_request": { "us": 73 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 13666 + "monitor": { + "check_group": "d7713952-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 13442 }, + "id": "0083-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 22 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 12887 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0041-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 38 }, + "response_header": { "us": 12643 }, + "total": { "us": 13591 }, + "validate": { "us": 12681 }, + "write_request": { "us": 46 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 16290 + "monitor": { + "check_group": "d76f65db-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 13666 }, + "id": "0041-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 32 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 771 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0045-intermittent", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 36 }, + "response_header": { "us": 100 }, + "total": { "us": 16215 }, + "validate": { "us": 136 }, + "write_request": { "us": 55 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 17255 + "monitor": { + "check_group": "d7712bcf-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 16290 }, + "id": "0045-intermittent", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 31 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 13440 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0042-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 16441 }, + "total": { "us": 17177 }, + "validate": { "us": 16474 }, + "write_request": { "us": 55 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 500, - "body": { - "bytes": 3, - "hash": "0604cd3138feed202ef293e062da2f4720f77a05d25ee036a7a01c9cfcdd1f0a", - "content": "500", - "content_bytes": 3 - } - } - }, - "error": { - "message": "500 Internal Server Error", - "type": "validate" - }, - "monitor": { - "duration": { - "us": 17146 + "monitor": { + "check_group": "d76f68c4-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 17255 }, + "id": "0042-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 171 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "error": { "message": "500 Internal Server Error", "type": "validate" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "content": "500", + "hash": "0604cd3138feed202ef293e062da2f4720f77a05d25ee036a7a01c9cfcdd1f0a", + "content_bytes": 3 }, - "id": "0030-intermittent", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "down", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 500 + }, + "rtt": { + "content": { "us": 28 }, + "response_header": { "us": 197 }, + "total": { "us": 17068 }, + "validate": { "us": 225 }, + "write_request": { "us": 58 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 17770 + "monitor": { + "check_group": "d771299d-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 17146 }, + "id": "0030-intermittent", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, + "summary": { "down": 1, "up": 0 }, + "tcp": { "rtt": { "connect": { "us": 16662 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0063-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 31 }, + "response_header": { "us": 237 }, + "total": { "us": 17695 }, + "validate": { "us": 269 }, + "write_request": { "us": 19 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 18194 + "monitor": { + "check_group": "d76f934d-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 17770 }, + "id": "0063-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 17371 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0061-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 60 }, + "total": { "us": 263 }, + "validate": { "us": 93 }, + "write_request": { "us": 25 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 17587 + "monitor": { + "check_group": "d76f45b0-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 18194 }, + "id": "0061-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 17894 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 121 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0065-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 46 }, + "response_header": { "us": 91 }, + "total": { "us": 314 }, + "validate": { "us": 138 }, + "write_request": { "us": 24 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 22666 + "monitor": { + "check_group": "d76f6b5c-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 17587 }, + "id": "0065-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 17231 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 80 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0062-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 4309 }, + "response_header": { "us": 16631 }, + "total": { "us": 22567 }, + "validate": { "us": 20941 }, + "write_request": { "us": 93 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 33311 + "monitor": { + "check_group": "d7715f00-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 22666 }, + "id": "0062-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 755 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0026-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 30 }, + "response_header": { "us": 32463 }, + "total": { "us": 33244 }, + "validate": { "us": 32494 }, + "write_request": { "us": 55 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 33506 + "monitor": { + "check_group": "d7712d77-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 33311 }, + "id": "0026-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 28 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 441 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0085-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 37 }, + "response_header": { "us": 32543 }, + "total": { "us": 33420 }, + "validate": { "us": 32581 }, + "write_request": { "us": 1876 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 33974 + "monitor": { + "check_group": "d76f4be5-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 33506 }, + "id": "0085-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 31 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 633 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0025-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 29 }, + "response_header": { "us": 32957 }, + "total": { "us": 33876 }, + "validate": { "us": 32986 }, + "write_request": { "us": 59 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 33693 + "monitor": { + "check_group": "d7712642-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 33974 }, + "id": "0025-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 29 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 752 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0088-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 32 }, + "response_header": { "us": 134 }, + "total": { "us": 33626 }, + "validate": { "us": 167 }, + "write_request": { "us": 83 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 33833 + "monitor": { + "check_group": "d77135e8-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 33693 }, + "id": "0088-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 10 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 33374 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0089-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 29 }, + "response_header": { "us": 62 }, + "total": { "us": 33750 }, + "validate": { "us": 92 }, + "write_request": { "us": 26 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 34600 + "monitor": { + "check_group": "d76f7475-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 33833 }, + "id": "0089-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 29 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 33362 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0087-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 25 }, + "response_header": { "us": 128 }, + "total": { "us": 34465 }, + "validate": { "us": 153 }, + "write_request": { "us": 52 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 35573 + "monitor": { + "check_group": "d76f5b68-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 34600 }, + "id": "0087-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 97 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 34111 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0028-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 42 }, + "response_header": { "us": 183 }, + "total": { "us": 35499 }, + "validate": { "us": 225 }, + "write_request": { "us": 57 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 35830 + "monitor": { + "check_group": "d7713a0f-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 35573 }, + "id": "0028-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 32 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 35069 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0086-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 36 }, + "response_header": { "us": 163 }, + "total": { "us": 363 }, + "validate": { "us": 199 }, + "write_request": { "us": 36 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 35698 + "monitor": { + "check_group": "d7712898-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 35830 }, + "id": "0086-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 35425 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 118 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0064-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 39 }, + "response_header": { "us": 200 }, + "total": { "us": 35558 }, + "validate": { "us": 240 }, + "write_request": { "us": 62 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 35594 + "monitor": { + "check_group": "d7715777-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 35698 }, + "id": "0064-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 38 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 35230 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0029-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 38 }, + "response_header": { "us": 146 }, + "total": { "us": 35516 }, + "validate": { "us": 184 }, + "write_request": { "us": 30 } } }, - { - "timestamp": "2019-09-11T03:40:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 35652 + "monitor": { + "check_group": "d7714a08-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 35594 }, + "id": "0029-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 35 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 35171 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0044-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "name": "mpls" - } + "status_code": 200 + }, + "rtt": { + "content": { "us": 51 }, + "response_header": { "us": 99 }, + "total": { "us": 35574 }, + "validate": { "us": 151 }, + "write_request": { "us": 56 } } + }, + "monitor": { + "check_group": "d7714fb0-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 35652 }, + "id": "0044-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 35223 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" } - ] - } -} \ No newline at end of file + } + ] +} diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json index 5826fd9f3f540d..823c2e474da71a 100644 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json +++ b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json @@ -1,475 +1,801 @@ { - "allPings": { - "total": 20, - "locations": [ - "mpls" - ], - "pings": [ - { - "timestamp": "2019-09-11T03:40:34.371Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 35534 + "total": 20, + "locations": ["mpls"], + "pings": [ + { + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 27 }, + "response_header": { "us": 213 }, + "total": { "us": 446 }, + "validate": { "us": 241 }, + "write_request": { "us": 77 } } }, - { - "timestamp": "2019-09-11T03:40:04.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 3080 + "monitor": { + "check_group": "d76f46bc-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 35534 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 35021 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 55 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:40:04.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 1187 }, + "response_header": { "us": 1465 }, + "total": { "us": 2993 }, + "validate": { "us": 2653 }, + "write_request": { "us": 382 } } }, - { - "timestamp": "2019-09-11T03:39:34.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 7810 + "monitor": { + "check_group": "c58e66d4-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 3080 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 7 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 294 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:39:34.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 127 }, + "response_header": { "us": 4267 }, + "total": { "us": 7078 }, + "validate": { "us": 4395 }, + "write_request": { "us": 70 } } }, - { - "timestamp": "2019-09-11T03:39:04.371Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 1575 + "monitor": { + "check_group": "b3abe52b-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 7810 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 622 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 2434 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:39:04.371Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 61 }, + "response_header": { "us": 1063 }, + "total": { "us": 1294 }, + "validate": { "us": 1125 }, + "write_request": { "us": 39 } } }, - { - "timestamp": "2019-09-11T03:38:34.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 1787 + "monitor": { + "check_group": "a1ca3676-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 1575 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 211 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 96 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:38:34.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 48 }, + "response_header": { "us": 929 }, + "total": { "us": 1372 }, + "validate": { "us": 977 }, + "write_request": { "us": 25 } } }, - { - "timestamp": "2019-09-11T03:38:04.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 654 + "monitor": { + "check_group": "8fe85c49-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 1787 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 385 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 360 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:38:04.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 27 }, + "response_header": { "us": 190 }, + "total": { "us": 361 }, + "validate": { "us": 217 }, + "write_request": { "us": 23 } } }, - { - "timestamp": "2019-09-11T03:37:34.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 15915 + "monitor": { + "check_group": "7e091979-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 654 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 264 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 102 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:37:34.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 61 }, + "response_header": { "us": 166 }, + "total": { "us": 350 }, + "validate": { "us": 227 }, + "write_request": { "us": 28 } } }, - { - "timestamp": "2019-09-11T03:37:04.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 2679 + "monitor": { + "check_group": "6c256fdb-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 15915 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15519 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 74 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:37:04.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 69 }, + "response_header": { "us": 1652 }, + "total": { "us": 2196 }, + "validate": { "us": 1721 }, + "write_request": { "us": 61 } } }, - { - "timestamp": "2019-09-11T03:36:34.371Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 2104 + "monitor": { + "check_group": "5a43bd3a-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 2679 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 413 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 350 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:36:34.371Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 44 }, + "response_header": { "us": 1155 }, + "total": { "us": 2053 }, + "validate": { "us": 1199 }, + "write_request": { "us": 35 } } }, - { - "timestamp": "2019-09-11T03:36:04.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 5759 + "monitor": { + "check_group": "48629ee3-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 2104 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 16 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 795 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:36:04.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 33 }, + "response_header": { "us": 189 }, + "total": { "us": 383 }, + "validate": { "us": 223 }, + "write_request": { "us": 35 } } }, - { - "timestamp": "2019-09-11T03:35:34.373Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 7166 + "monitor": { + "check_group": "368192e1-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 5759 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 5330 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 102 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:35:34.373Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 111 }, + "response_header": { "us": 426 }, + "total": { "us": 4544 }, + "validate": { "us": 537 }, + "write_request": { "us": 34 } } }, - { - "timestamp": "2019-09-11T03:35:04.371Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 26830 + "monitor": { + "check_group": "24a2a15c-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 7166 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 2555 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 3812 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:35:04.371Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 37 }, + "response_header": { "us": 6616 }, + "total": { "us": 26512 }, + "validate": { "us": 6654 }, + "write_request": { "us": 32 } } }, - { - "timestamp": "2019-09-11T03:34:34.371Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 993 + "monitor": { + "check_group": "12c3c9dc-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 26830 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 273 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 96 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:34:34.371Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 49 }, + "response_header": { "us": 349 }, + "total": { "us": 916 }, + "validate": { "us": 398 }, + "write_request": { "us": 121 } } }, - { - "timestamp": "2019-09-11T03:34:04.381Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 3880 + "monitor": { + "check_group": "00dd66e2-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 993 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 343 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:34:04.381Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 67 }, + "response_header": { "us": 2443 }, + "total": { "us": 3325 }, + "validate": { "us": 2510 }, + "write_request": { "us": 38 } } }, - { - "timestamp": "2019-09-11T03:33:34.371Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 1604 + "monitor": { + "check_group": "eef9da64-d444-11e9-88e3-3e80641b9c71", + "duration": { "us": 3880 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 489 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 760 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:33:34.371Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 58 }, + "response_header": { "us": 1148 }, + "total": { "us": 1499 }, + "validate": { "us": 1207 }, + "write_request": { "us": 69 } } + }, + "monitor": { + "check_group": "dd18462b-d444-11e9-88e3-3e80641b9c71", + "duration": { "us": 1604 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 40 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 199 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" } - ] - } -} \ No newline at end of file + } + ] +} diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json index b9b8deae2e564f..578384074c9ff3 100644 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json +++ b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json @@ -1,165 +1,271 @@ { - "allPings": { - "total": 20, - "locations": [ - "mpls" - ], - "pings": [ - { - "timestamp": "2019-09-11T03:31:04.380Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 56940 + "total": 20, + "locations": ["mpls"], + "pings": [ + { + "@timestamp": "2019-09-11T03:31:04.380Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 40 }, + "response_header": { "us": 200 }, + "total": { "us": 56793 }, + "validate": { "us": 241 }, + "write_request": { "us": 11 } } }, - { - "timestamp": "2019-09-11T03:31:34.366Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 9861 + "monitor": { + "check_group": "83acd094-d444-11e9-88e3-3e80641b9c71", + "duration": { "us": 56940 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 92 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 2260 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:31:34.366Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 89 }, + "response_header": { "us": 996 }, + "total": { "us": 2268 }, + "validate": { "us": 1086 }, + "write_request": { "us": 109 } } }, - { - "timestamp": "2019-09-11T03:32:04.372Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 2924 + "monitor": { + "check_group": "959b955d-d444-11e9-88e3-3e80641b9c71", + "duration": { "us": 9861 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 7466 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 363 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:32:04.372Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 132 }, + "response_header": { "us": 1486 }, + "total": { "us": 2724 }, + "validate": { "us": 1619 }, + "write_request": { "us": 103 } } }, - { - "timestamp": "2019-09-11T03:32:34.375Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 21665 + "monitor": { + "check_group": "a773d911-d444-11e9-88e3-3e80641b9c71", + "duration": { "us": 2924 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 47 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 802 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:32:34.375Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 32 }, + "response_header": { "us": 204 }, + "total": { "us": 20654 }, + "validate": { "us": 237 }, + "write_request": { "us": 55 } } }, - { - "timestamp": "2019-09-11T03:33:04.370Z", - "http": { - "response": { - "status_code": 200, - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf", - "content": null, - "content_bytes": null - } - } - }, - "error": null, - "monitor": { - "duration": { - "us": 2128 + "monitor": { + "check_group": "b9554b41-d444-11e9-88e3-3e80641b9c71", + "duration": { "us": 21665 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 970 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 791 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" + } + }, + { + "@timestamp": "2019-09-11T03:33:04.370Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "scheme": null, - "status": "up", - "type": "http" + "status_code": 200 }, - "observer": { - "geo": { - "name": "mpls" - } + "rtt": { + "content": { "us": 72 }, + "response_header": { "us": 1316 }, + "total": { "us": 1646 }, + "validate": { "us": 1389 }, + "write_request": { "us": 40 } } + }, + "monitor": { + "check_group": "cb3a5b9e-d444-11e9-88e3-3e80641b9c71", + "duration": { "us": 2128 }, + "id": "0001-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 427 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 140 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" } - ] - } -} \ No newline at end of file + } + ] +} diff --git a/x-pack/test/api_integration/apis/uptime/graphql/index.js b/x-pack/test/api_integration/apis/uptime/graphql/index.js index ee22974d471701..6aedc66bf2adfc 100644 --- a/x-pack/test/api_integration/apis/uptime/graphql/index.js +++ b/x-pack/test/api_integration/apis/uptime/graphql/index.js @@ -11,6 +11,5 @@ export default function({ loadTestFile }) { // verifying the pre-loaded documents are returned in a way that // matches the snapshots contained in './fixtures' loadTestFile(require.resolve('./monitor_states')); - loadTestFile(require.resolve('./ping_list')); }); } diff --git a/x-pack/test/api_integration/apis/uptime/graphql/ping_list.ts b/x-pack/test/api_integration/apis/uptime/graphql/ping_list.ts deleted file mode 100644 index c84b9c382acddc..00000000000000 --- a/x-pack/test/api_integration/apis/uptime/graphql/ping_list.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import expect from '@kbn/expect'; -import { pingsQueryString } from '../../../../../legacy/plugins/uptime/public/queries'; -import { expectFixtureEql } from './helpers/expect_fixture_eql'; -import { Ping, PingResults } from '../../../../../legacy/plugins/uptime/common/graphql/types'; - -const expectPingFixtureEql = (data: { allPings: PingResults }, fixtureName: string) => { - expectFixtureEql(data, fixtureName, d => d.allPings.pings.forEach((p: Ping) => delete p.id)); -}; - -export default function({ getService }: any) { - describe('pingList query', () => { - before('load heartbeat data', () => getService('esArchiver').load('uptime/full_heartbeat')); - after('unload heartbeat index', () => getService('esArchiver').unload('uptime/full_heartbeat')); - - const supertest = getService('supertest'); - - it('returns a list of pings for the given date range and default size', async () => { - const getPingsQuery = { - operationName: 'PingList', - query: pingsQueryString, - variables: { - dateRangeStart: '2019-01-28T17:40:08.078Z', - dateRangeEnd: '2025-01-28T19:00:16.078Z', - }, - }; - const { - body: { data }, - } = await supertest - .post('/api/uptime/graphql') - .set('kbn-xsrf', 'foo') - .send({ ...getPingsQuery }); - const { - allPings: { pings }, - } = data; - expect(pings).length(10); - - expectPingFixtureEql(data, 'ping_list'); - }); - - it('returns a list of pings for the date range and given size', async () => { - const SIZE = 50; - const getPingsQuery = { - operationName: 'PingList', - query: pingsQueryString, - variables: { - dateRangeStart: '2019-01-28T17:40:08.078Z', - dateRangeEnd: '2025-01-28T19:00:16.078Z', - size: SIZE, - }, - }; - const { - body: { data }, - } = await supertest - .post('/api/uptime/graphql') - .set('kbn-xsrf', 'foo') - .send({ ...getPingsQuery }); - const { - allPings: { pings }, - } = data; - expect(pings).length(SIZE); - expectPingFixtureEql(data, 'ping_list_count'); - }); - - it('returns a list of pings for a monitor ID', async () => { - const SIZE = 15; - const MONITOR_ID = '0001-up'; - const getPingsQuery = { - operationName: 'PingList', - query: pingsQueryString, - variables: { - dateRangeStart: '2019-01-28T17:40:08.078Z', - dateRangeEnd: '2025-01-28T19:00:16.078Z', - monitorId: MONITOR_ID, - size: SIZE, - }, - }; - const { - body: { data }, - } = await supertest - .post('/api/uptime/graphql') - .set('kbn-xsrf', 'foo') - .send({ ...getPingsQuery }); - expectPingFixtureEql(data, 'ping_list_monitor_id'); - }); - - it('returns a list of pings sorted ascending', async () => { - const SIZE = 5; - const MONITOR_ID = '0001-up'; - const getPingsQuery = { - operationName: 'PingList', - query: pingsQueryString, - variables: { - dateRangeStart: '2019-01-28T17:40:08.078Z', - dateRangeEnd: '2025-01-28T19:00:16.078Z', - monitorId: MONITOR_ID, - size: SIZE, - sort: 'asc', - }, - }; - const { - body: { data }, - } = await supertest - .post('/api/uptime/graphql') - .set('kbn-xsrf', 'foo') - .send({ ...getPingsQuery }); - - expectPingFixtureEql(data, 'ping_list_sort'); - }); - }); -} diff --git a/x-pack/test/api_integration/apis/uptime/rest/index.ts b/x-pack/test/api_integration/apis/uptime/rest/index.ts index b2236e1bb63083..08f4c92b576cf9 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts @@ -49,6 +49,7 @@ export default function({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./monitor_latest_status')); loadTestFile(require.resolve('./selected_monitor')); loadTestFile(require.resolve('./ping_histogram')); + loadTestFile(require.resolve('./ping_list')); loadTestFile(require.resolve('./monitor_duration')); loadTestFile(require.resolve('./doc_count')); }); diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts new file mode 100644 index 00000000000000..988c63ad62bfb5 --- /dev/null +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { expectFixtureEql } from '../graphql/helpers/expect_fixture_eql'; +import { FtrProviderContext } from '../../../ftr_provider_context'; + +export default function({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + describe('pingList query', () => { + before('load heartbeat data', () => getService('esArchiver').load('uptime/full_heartbeat')); + after('unload heartbeat index', () => getService('esArchiver').unload('uptime/full_heartbeat')); + + it('returns a list of pings for the given date range and default size', async () => { + const dateRangeStart = '2019-01-28T17:40:08.078Z'; + const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + + const apiResponse = await supertest.get( + `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}` + ); + + expectFixtureEql(apiResponse.body, 'ping_list'); + }); + + it('returns a list of pings for the date range and given size', async () => { + const dateRangeStart = '2019-01-28T17:40:08.078Z'; + const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + const size = 50; + + const apiResponse = await supertest.get( + `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&size=${size}` + ); + + expectFixtureEql(apiResponse.body, 'ping_list_count'); + }); + + it('returns a list of pings for a monitor ID', async () => { + const dateRangeStart = '2019-01-28T17:40:08.078Z'; + const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + const monitorId = '0001-up'; + const size = 15; + + const apiResponse = await supertest.get( + `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&monitorId=${monitorId}&size=${size}` + ); + + expectFixtureEql(apiResponse.body, 'ping_list_monitor_id'); + }); + + it('returns a list of pings sorted ascending', async () => { + const dateRangeStart = '2019-01-28T17:40:08.078Z'; + const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + const monitorId = '0001-up'; + const size = 5; + const sort = 'asc'; + + const apiResponse = await supertest.get( + `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&monitorId=${monitorId}&size=${size}&sort=${sort}` + ); + + expectFixtureEql(apiResponse.body, 'ping_list_sort'); + }); + }); +} From 69190d1afe8c9fff0877c1e38b2f8970217a2e54 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 25 Mar 2020 14:58:13 -0400 Subject: [PATCH 09/36] Update fixtures that rely on pings. --- .../test/api_integration/apis/uptime/index.js | 11 +- .../rest/fixtures/monitor_latest_status.json | 138 +++++++----------- .../rest/fixtures/selected_monitor.json | 30 ++-- .../api_integration/apis/uptime/rest/index.ts | 4 +- .../apis/uptime/rest/selected_monitor.ts | 2 +- 5 files changed, 73 insertions(+), 112 deletions(-) diff --git a/x-pack/test/api_integration/apis/uptime/index.js b/x-pack/test/api_integration/apis/uptime/index.js index 0b18f14cd7daf2..74157fa7795aac 100644 --- a/x-pack/test/api_integration/apis/uptime/index.js +++ b/x-pack/test/api_integration/apis/uptime/index.js @@ -8,11 +8,12 @@ export default function({ getService, loadTestFile }) { const es = getService('legacyEs'); describe('uptime', () => { - before(() => - es.indices.delete({ - index: 'heartbeat*', - ignore: [404], - }) + before( + async () => + await es.indices.delete({ + index: 'heartbeat*', + ignore: [404], + }) ); loadTestFile(require.resolve('./feature_controls')); diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json index 1702cb2c21007e..1bfac60e1f1793 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json @@ -1,89 +1,53 @@ { - "@timestamp": "2019-09-11T03:40:34.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { - "version": "1.1.0" - }, - "event": { - "dataset": "uptime" - }, - "host": { - "name": "avc-x1x" - }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { - "us": 57 - }, - "response_header": { - "us": 262 - }, - "total": { - "us": 20331 - }, - "validate": { - "us": 319 - }, - "write_request": { - "us": 82 - } - } - }, - "monitor": { - "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", - "duration": { - "us": 24627 - }, - "id": "0002-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "location": "37.926868, -78.024902", - "name": "mpls" - }, - "hostname": "avc-x1x" - }, - "resolve": { - "ip": "127.0.0.1", - "rtt": { - "us": 4218 - } - }, - "summary": { - "down": 0, - "up": 1 - }, - "tcp": { - "rtt": { - "connect": { - "us": 103 - } - } - }, - "timestamp": "2019-09-11T03:40:34.371Z", - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0" + }, + "ecs": { "version": "1.1.0" }, + "event": { "dataset": "uptime" }, + "host": { "name": "avc-x1x" }, + "http": { + "response": { + "body": { + "bytes": 3, + "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" + }, + "status_code": 200 + }, + "rtt": { + "content": { "us": 57 }, + "response_header": { "us": 262 }, + "total": { "us": 20331 }, + "validate": { "us": 319 }, + "write_request": { "us": 82 } + } + }, + "monitor": { + "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", + "duration": { "us": 24627 }, + "id": "0002-up", + "ip": "127.0.0.1", + "name": "", + "status": "up", + "type": "http" + }, + "observer": { + "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, + "hostname": "avc-x1x" + }, + "resolve": { "ip": "127.0.0.1", "rtt": { "us": 4218 } }, + "summary": { "down": 0, "up": 1 }, + "tcp": { "rtt": { "connect": { "us": 103 } } }, + "url": { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x1", + "scheme": "http" } +} diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/selected_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/selected_monitor.json index d8367ea67052fa..7f2dfcb40ff9d8 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/selected_monitor.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/selected_monitor.json @@ -1,28 +1,24 @@ { + "observer": { + "geo": { "name": "mpls", "location": "37.926868, -78.024902" }, + "hostname": "avc-x1x" + }, + "@timestamp": "2019-09-11T03:40:34.371Z", "monitor": { - "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", - "duration": { - "us": 24627 - }, - "id": "0002-up", + "duration": { "us": 24627 }, "ip": "127.0.0.1", "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "location": "37.926868, -78.024902", - "name": "mpls" - }, - "hostname": "avc-x1x" + "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", + "id": "0002-up", + "type": "http", + "status": "up" }, "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", "path": "/pattern", + "scheme": "http", "port": 5678, + "domain": "localhost", "query": "r=200x1", - "scheme": "http" + "full": "http://localhost:5678/pattern?r=200x1" } } diff --git a/x-pack/test/api_integration/apis/uptime/rest/index.ts b/x-pack/test/api_integration/apis/uptime/rest/index.ts index 08f4c92b576cf9..606f291a0323e6 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts @@ -44,8 +44,8 @@ export default function({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./dynamic_settings')); }); describe('with real-world data', () => { - before('load heartbeat data', async () => await esArchiver.load('uptime/full_heartbeat')); - after('unload', async () => await esArchiver.unload('uptime/full_heartbeat')); + beforeEach('load heartbeat data', async () => await esArchiver.load('uptime/full_heartbeat')); + afterEach('unload', async () => await esArchiver.unload('uptime/full_heartbeat')); loadTestFile(require.resolve('./monitor_latest_status')); loadTestFile(require.resolve('./selected_monitor')); loadTestFile(require.resolve('./ping_histogram')); diff --git a/x-pack/test/api_integration/apis/uptime/rest/selected_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/selected_monitor.ts index ed034f58a5f59c..fb980ef5d68802 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/selected_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/selected_monitor.ts @@ -13,7 +13,7 @@ export default function({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - it('returns the monitor for give ID', async () => { + it('returns the monitor for given ID', async () => { const apiResponse = await supertest.get( `/api/uptime/monitor/selected?monitorId=${monitorId}` ); From 2cd661c04f20e77e88e3411163288b4481c3099c Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 25 Mar 2020 15:13:52 -0400 Subject: [PATCH 10/36] Move ping types to runtime_types folder with rest of io-ts files. --- .../legacy/plugins/uptime/common/runtime_types/index.ts | 1 + .../common/{types => runtime_types}/ping/histogram.ts | 0 .../plugins/uptime/common/runtime_types/ping/index.ts | 8 ++++++++ .../uptime/common/{types => runtime_types}/ping/ping.ts | 0 x-pack/legacy/plugins/uptime/common/types/index.ts | 3 --- 5 files changed, 9 insertions(+), 3 deletions(-) rename x-pack/legacy/plugins/uptime/common/{types => runtime_types}/ping/histogram.ts (100%) create mode 100644 x-pack/legacy/plugins/uptime/common/runtime_types/ping/index.ts rename x-pack/legacy/plugins/uptime/common/{types => runtime_types}/ping/ping.ts (100%) diff --git a/x-pack/legacy/plugins/uptime/common/runtime_types/index.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/index.ts index 5e3fb2326bdb97..652d60cbe304de 100644 --- a/x-pack/legacy/plugins/uptime/common/runtime_types/index.ts +++ b/x-pack/legacy/plugins/uptime/common/runtime_types/index.ts @@ -8,5 +8,6 @@ export * from './alerts'; export * from './common'; export * from './monitor'; export * from './overview_filters'; +export * from './ping'; export * from './snapshot'; export * from './dynamic_settings'; diff --git a/x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/histogram.ts similarity index 100% rename from x-pack/legacy/plugins/uptime/common/types/ping/histogram.ts rename to x-pack/legacy/plugins/uptime/common/runtime_types/ping/histogram.ts diff --git a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/index.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/index.ts new file mode 100644 index 00000000000000..a2fc7c1b243ba6 --- /dev/null +++ b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './histogram'; +export * from './ping'; diff --git a/x-pack/legacy/plugins/uptime/common/types/ping/ping.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts similarity index 100% rename from x-pack/legacy/plugins/uptime/common/types/ping/ping.ts rename to x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts diff --git a/x-pack/legacy/plugins/uptime/common/types/index.ts b/x-pack/legacy/plugins/uptime/common/types/index.ts index d57c52c8394ee3..1d0003addd7618 100644 --- a/x-pack/legacy/plugins/uptime/common/types/index.ts +++ b/x-pack/legacy/plugins/uptime/common/types/index.ts @@ -41,6 +41,3 @@ export interface MonitorDurationResult { /** The maximum duration value in this chart. */ durationMaxValue: number; } - -export * from './ping/histogram'; -export * from './pings/ping'; From db88cd19f95e039f4aacceb7c196b8fe24a2f5a9 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 25 Mar 2020 16:41:48 -0400 Subject: [PATCH 11/36] Update Ping type location and imports, type checking. --- .../monitor/status_bar_container.tsx | 2 +- .../components/connected/pings/ping_list.tsx | 2 +- .../__test__/monitor_ssl_certificate.test.tsx | 2 +- .../__test__/monitor_status.bar.test.tsx | 2 +- .../monitor_ssl_certificate.tsx | 3 +-- .../monitor_status_bar/monitor_status_bar.tsx | 2 +- .../ping_list/__tests__/expanded_row.test.tsx | 2 +- .../ping_list/__tests__/ping_list.test.tsx | 2 +- .../functional/ping_list/expanded_row.tsx | 2 +- .../functional/ping_list/ping_list.tsx | 3 +-- .../plugins/uptime/public/pages/monitor.tsx | 2 +- .../uptime/public/state/actions/ping.ts | 8 +++++-- .../uptime/public/state/api/monitor_status.ts | 2 +- .../plugins/uptime/public/state/api/ping.ts | 21 +++++++------------ .../public/state/reducers/monitor_status.ts | 2 +- .../uptime/public/state/reducers/ping_list.ts | 2 +- .../server/lib/requests/get_latest_monitor.ts | 8 +++---- .../uptime/server/lib/requests/get_monitor.ts | 8 +++---- .../uptime/server/lib/requests/get_pings.ts | 8 +++---- .../server/lib/requests/uptime_requests.ts | 8 +++---- 20 files changed, 40 insertions(+), 51 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx index 825726d4d7e538..5d7c440f26b7be 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx @@ -12,7 +12,7 @@ import { monitorLocationsSelector, selectMonitorStatus } from '../../../state/se import { MonitorStatusBarComponent } from '../../functional/monitor_status_details/monitor_status_bar'; import { getMonitorStatusAction, getSelectedMonitorAction } from '../../../state/actions'; import { useUrlParams } from '../../../hooks'; -import { Ping } from '../../../../common/types/ping/ping'; +import { Ping } from '../../../../common/runtime_types'; import { MonitorLocations } from '../../../../common/runtime_types/monitor'; import { UptimeRefreshContext } from '../../../contexts'; diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx index b63e737470739f..f738656cdd51fc 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx @@ -8,7 +8,7 @@ import { useSelector, useDispatch } from 'react-redux'; import React, { useContext, useCallback } from 'react'; import { selectPingList } from '../../../state/selectors'; import { getPings } from '../../../state/actions'; -import { GetPingsParams } from '../../../../common/types/ping/ping'; +import { GetPingsParams } from '../../../../common/runtime_types'; import { UptimeSettingsContext } from '../../../contexts'; import { PingListComponent } from '../../functional'; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx index 3a54943e79cd33..57ed09cc30ef15 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_ssl_certificate.test.tsx @@ -9,7 +9,7 @@ import moment from 'moment'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { EuiBadge } from '@elastic/eui'; import { renderWithIntl } from 'test_utils/enzyme_helpers'; -import { Tls } from '../../../../../common/types/ping/ping'; +import { Tls } from '../../../../../common/runtime_types'; import { MonitorSSLCertificate } from '../monitor_status_bar'; describe('MonitorStatusBar component', () => { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx index 56951c991423c9..965c3b8bd4acf5 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx @@ -8,7 +8,7 @@ import moment from 'moment'; import React from 'react'; import { renderWithIntl } from 'test_utils/enzyme_helpers'; import { MonitorStatusBarComponent } from '../monitor_status_bar'; -import { Ping } from '../../../../../common/types/ping/ping'; +import { Ping } from '../../../../../common/runtime_types'; describe('MonitorStatusBar component', () => { let monitorStatus: Ping; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx index 0304169b81c90f..d92534aecd1754 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_ssl_certificate.tsx @@ -9,8 +9,7 @@ import moment from 'moment'; import { EuiSpacer, EuiText, EuiBadge } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; - -import { Tls } from '../../../../../common/types/ping/ping'; +import { Tls } from '../../../../../common/runtime_types'; interface Props { /** diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx index 993f9a0a23bc62..ac3cedc5179956 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/monitor_status_bar/monitor_status_bar.tsx @@ -17,7 +17,7 @@ import { import { MonitorSSLCertificate } from './monitor_ssl_certificate'; import * as labels from './translations'; import { StatusByLocations } from './status_by_location'; -import { Ping } from '../../../../../common/types/ping/ping'; +import { Ping } from '../../../../../common/runtime_types'; import { MonitorLocations } from '../../../../../common/runtime_types'; interface MonitorStatusBarProps { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx index 0ec9afc312222f..efcfcb780c6c28 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx @@ -7,7 +7,7 @@ import { mountWithIntl, renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { PingListExpandedRowComponent } from '../expanded_row'; -import { Ping } from '../../../../../common/types/ping/ping'; +import { Ping } from '../../../../../common/runtime_types'; import { DocLinkForBody } from '../doc_link_body'; describe('PingListExpandedRow', () => { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index 89e0b7e4f0c558..e2605f5f2bcd9e 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { PingListComponent, AllLocationOption, toggleDetails } from '../ping_list'; import { ExpandedRowMap } from '../../monitor_list/types'; -import { Ping, PingsResponse } from '../../../../../common/types/ping/ping'; +import { Ping, PingsResponse } from '../../../../../common/runtime_types'; describe('PingList component', () => { let response: PingsResponse; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx index a3b9501d170e23..28b96fcb1bf7b1 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/expanded_row.tsx @@ -16,7 +16,7 @@ import { } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Ping, HttpResponseBody } from '../../../../common/types/ping/ping'; +import { Ping, HttpResponseBody } from '../../../../common/runtime_types'; import { DocLinkForBody } from './doc_link_body'; interface Props { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index d1e62203197e2e..432d38fa4558bf 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -23,12 +23,11 @@ import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; import React, { useState, useEffect } from 'react'; import styled from 'styled-components'; -import { Ping } from '../../../../common/types/ping/ping'; +import { Ping, GetPingsParams } from '../../../../common/runtime_types'; import { convertMicrosecondsToMilliseconds as microsToMillis } from '../../../lib/helper'; import { LocationName } from './location_name'; import { Pagination } from './../monitor_list'; import { PingListExpandedRowComponent } from './expanded_row'; -import { GetPingsParams } from '../../../../common/types/ping/ping'; import { PingListProps } from '../../connected/pings'; interface ExpandedRowMap { diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 1d074a6a385e25..1873ab9861940d 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -12,7 +12,7 @@ import { UptimeRefreshContext } from '../contexts'; import { useUptimeTelemetry, useUrlParams, UptimePage } from '../hooks'; import { useTrackPageview } from '../../../../../plugins/observability/public'; import { MonitorStatusDetails } from '../components/connected'; -import { Ping } from '../../common/types/ping/ping'; +import { Ping } from '../../common/runtime_types'; import { AppState } from '../state'; import { selectSelectedMonitor } from '../state/selectors'; import { getSelectedMonitorAction } from '../state/actions'; diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts index 9752b56e6c4684..70918a4cc70e56 100644 --- a/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/actions/ping.ts @@ -5,8 +5,12 @@ */ import { createAction } from 'redux-actions'; -import { GetPingHistogramParams, HistogramResult } from '../../../common/types'; -import { PingsResponse, GetPingsParams } from '../../../common/types/ping/ping'; +import { + GetPingHistogramParams, + HistogramResult, + PingsResponse, + GetPingsParams, +} from '../../../common/runtime_types'; export const getPingHistogram = createAction('GET_PING_HISTOGRAM'); export const getPingHistogramSuccess = createAction('GET_PING_HISTOGRAM_SUCCESS'); diff --git a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts index 64dda66c451eb8..dc358b40096bf5 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts @@ -5,7 +5,7 @@ */ import { QueryParams } from '../actions/types'; -import { Ping } from '../../../common/types/ping/ping'; +import { Ping } from '../../../common/runtime_types'; import { API_URLS } from '../../../common/constants/rest_api'; import { apiService } from './utils'; diff --git a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts index 8aad99c256966e..7e41dff80f7c27 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts @@ -4,10 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ -import { PathReporter } from 'io-ts/lib/PathReporter'; import { APIFn } from './types'; -import { GetPingHistogramParams, HistogramResult } from '../../../common/types'; -import { PingsResponseType, PingsResponse, GetPingsParams } from '../../../common/types/ping/ping'; +import { + PingsResponseType, + PingsResponse, + GetPingsParams, + GetPingHistogramParams, + HistogramResult, +} from '../../../common/runtime_types'; import { apiService } from './utils'; import { API_URLS } from '../../../common/constants/rest_api'; @@ -36,20 +40,11 @@ export const fetchPings: APIFn = async ({ sort, status, }) => { - const apiPath = '/api/uptime/pings'; const params = mergeParams( { dateRangeStart, dateRangeEnd, monitorId }, { location, size, sort, status } ); - - const urlParams = new URLSearchParams(params).toString(); - const response = await fetch(`${apiPath}?${urlParams}`); - if (!response.ok) { - throw new Error(response.statusText); - } - const data = await response.json(); - PathReporter.report(PingsResponseType.decode(data)); - return data; + return await apiService.get(API_URLS.PINGS, params, PingsResponseType); }; export const fetchPingHistogram: APIFn = async ({ diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts index dcc8b62b0be41a..feced7dd811f4f 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts @@ -12,7 +12,7 @@ import { getMonitorStatusActionSuccess, getMonitorStatusActionFail, } from '../actions'; -import { Ping } from '../../../common/types/ping/ping'; +import { Ping } from '../../../common/runtime_types'; import { QueryParams } from '../actions/types'; export interface MonitorStatusState { diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts index 1f753c6e2c7d7f..934bdcd4ddbf7e 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts @@ -5,7 +5,7 @@ */ import { handleActions, Action } from 'redux-actions'; -import { PingsResponse } from '../../../common/types/ping/ping'; +import { PingsResponse } from '../../../common/runtime_types'; import { getPings, getPingsSuccess, getPingsFail } from '../actions'; export interface PingListState { 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 764ff85e529691..7e9267b3ed829a 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 @@ -5,9 +5,9 @@ */ import { isRight } from 'fp-ts/lib/Either'; -import { ThrowReporter } from 'io-ts/lib/ThrowReporter'; +import { PathReporter } from 'io-ts/lib/PathReporter'; import { UMElasticsearchQueryFn } from '../adapters'; -import { PingType, Ping } from '../../../../../legacy/plugins/uptime/common/types/ping/ping'; +import { PingType, Ping } from '../../../../../legacy/plugins/uptime/common/runtime_types'; export interface GetLatestMonitorParams { /** @member dateRangeStart timestamp bounds */ @@ -77,8 +77,6 @@ export const getLatestMonitor: UMElasticsearchQueryFn = async const decoded = PingType.decode(result.hits.hits[0]?._source); if (isRight(decoded)) { return decoded.right; - } else { - ThrowReporter.report(decoded); - throw new Error('Received invalid document'); } + throw new Error(JSON.stringify(PathReporter.report(decoded))); }; diff --git a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts index 923f65d2f89f41..99b807797c599b 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts @@ -5,14 +5,14 @@ */ import { isRight } from 'fp-ts/lib/Either'; -import { ThrowReporter } from 'io-ts/lib/ThrowReporter'; +import { PathReporter } from 'io-ts/lib/PathReporter'; import { UMElasticsearchQueryFn } from '../adapters/framework'; import { HttpResponseBody, PingsResponse, PingsResponseType, Ping, -} from '../../../../../legacy/plugins/uptime/common/types/ping/ping'; +} from '../../../../../legacy/plugins/uptime/common/runtime_types'; export interface GetPingsParams { /** @member dateRangeStart timestamp bounds */ @@ -110,8 +110,6 @@ export const getPings: UMElasticsearchQueryFn = a }); if (isRight(decoded)) { return decoded.right; - } else { - ThrowReporter.report(decoded); - throw new Error('Unable to parse data'); } + throw new Error(JSON.stringify(PathReporter.report(decoded))); }; diff --git a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts index 738301c2a495d4..44f789ed3bf746 100644 --- a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts +++ b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts @@ -6,9 +6,10 @@ import { UMElasticsearchQueryFn } from '../adapters'; import { + HistogramResult, Ping, PingsResponse as PingResults, -} from '../../../../../legacy/plugins/uptime/common/types/ping/ping'; +} from '../../../../../legacy/plugins/uptime/common/runtime_types'; import { GetFilterBarParams, GetLatestMonitorParams, @@ -31,10 +32,7 @@ import { } from '../../../../../legacy/plugins/uptime/common/runtime_types'; import { GetMonitorStatesResult } from './get_monitor_states'; import { GetSnapshotCountParams } from './get_snapshot_counts'; -import { - HistogramResult, - MonitorDurationResult, -} from '../../../../../legacy/plugins/uptime/common/types'; +import { MonitorDurationResult } from '../../../../../legacy/plugins/uptime/common/types'; type ESQ = UMElasticsearchQueryFn; From 4937eefd9ec979b14ae3855d54f16ea19274c61e Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 25 Mar 2020 16:42:19 -0400 Subject: [PATCH 12/36] Remove reliance on fixtures for ping functional API tests. --- .../uptime/graphql/fixtures/ping_list.json | 536 ---- .../graphql/fixtures/ping_list_count.json | 2665 ----------------- .../fixtures/ping_list_monitor_id.json | 801 ----- .../graphql/fixtures/ping_list_sort.json | 271 -- .../apis/uptime/rest/ping_list.ts | 124 +- 5 files changed, 119 insertions(+), 4278 deletions(-) delete mode 100644 x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json delete mode 100644 x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json delete mode 100644 x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json delete mode 100644 x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json deleted file mode 100644 index 575c0d19771b07..00000000000000 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list.json +++ /dev/null @@ -1,536 +0,0 @@ -{ - "total": 2000, - "locations": ["mpls"], - "pings": [ - { - "@timestamp": "2019-09-11T03:40:34.410Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 32 }, - "response_header": { "us": 148 }, - "total": { "us": 363 }, - "validate": { "us": 180 }, - "write_request": { "us": 36 } - } - }, - "monitor": { - "check_group": "d77146ac-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 413 }, - "id": "0074-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 144 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 20 }, - "response_header": { "us": 153 }, - "total": { "us": 357 }, - "validate": { "us": 173 }, - "write_request": { "us": 33 } - } - }, - "monitor": { - "check_group": "d76f7d42-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 441 }, - "id": "0073-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 28 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 127 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 38 }, - "response_header": { "us": 186 }, - "total": { "us": 429 }, - "validate": { "us": 224 }, - "write_request": { "us": 34 } - } - }, - "monitor": { - "check_group": "d76f56d9-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 482 }, - "id": "0099-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 150 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 47 }, - "response_header": { "us": 218 }, - "total": { "us": 495 }, - "validate": { "us": 265 }, - "write_request": { "us": 53 } - } - }, - "monitor": { - "check_group": "d7714bae-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 558 }, - "id": "0098-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 189 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 25 }, - "response_header": { "us": 151 }, - "total": { "us": 256 }, - "validate": { "us": 176 }, - "write_request": { "us": 22 } - } - }, - "monitor": { - "check_group": "d77163e6-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 304 }, - "id": "0075-intermittent", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 53 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.405Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 216 }, - "total": { "us": 425 }, - "validate": { "us": 249 }, - "write_request": { "us": 26 } - } - }, - "monitor": { - "check_group": "d7715ccb-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 487 }, - "id": "0097-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 16 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 144 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.405Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 40 }, - "response_header": { "us": 283 }, - "total": { "us": 545 }, - "validate": { "us": 323 }, - "write_request": { "us": 33 } - } - }, - "monitor": { - "check_group": "d7715e1f-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 602 }, - "id": "0049-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 25 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 168 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.390Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 29 }, - "response_header": { "us": 186 }, - "total": { "us": 323 }, - "validate": { "us": 215 }, - "write_request": { "us": 43 } - } - }, - "monitor": { - "check_group": "d7713de2-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 365 }, - "id": "0047-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 85 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.389Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 44 }, - "response_header": { "us": 278 }, - "total": { "us": 813 }, - "validate": { "us": 322 }, - "write_request": { "us": 23 } - } - }, - "monitor": { - "check_group": "d7714c9b-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 870 }, - "id": "0077-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 27 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 74 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.387Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 39 }, - "response_header": { "us": 119 }, - "total": { "us": 2751 }, - "validate": { "us": 159 }, - "write_request": { "us": 63 } - } - }, - "monitor": { - "check_group": "d76f8c60-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 2808 }, - "id": "0076-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 21 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 97 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - } - ] -} diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json deleted file mode 100644 index 6af0daa719e0a5..00000000000000 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_count.json +++ /dev/null @@ -1,2665 +0,0 @@ -{ - "total": 2000, - "locations": ["mpls"], - "pings": [ - { - "@timestamp": "2019-09-11T03:40:34.410Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 32 }, - "response_header": { "us": 148 }, - "total": { "us": 363 }, - "validate": { "us": 180 }, - "write_request": { "us": 36 } - } - }, - "monitor": { - "check_group": "d77146ac-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 413 }, - "id": "0074-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 144 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 20 }, - "response_header": { "us": 153 }, - "total": { "us": 357 }, - "validate": { "us": 173 }, - "write_request": { "us": 33 } - } - }, - "monitor": { - "check_group": "d76f7d42-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 441 }, - "id": "0073-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 28 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 127 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 38 }, - "response_header": { "us": 186 }, - "total": { "us": 429 }, - "validate": { "us": 224 }, - "write_request": { "us": 34 } - } - }, - "monitor": { - "check_group": "d76f56d9-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 482 }, - "id": "0099-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 150 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 47 }, - "response_header": { "us": 218 }, - "total": { "us": 495 }, - "validate": { "us": 265 }, - "write_request": { "us": 53 } - } - }, - "monitor": { - "check_group": "d7714bae-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 558 }, - "id": "0098-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 20 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 189 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.406Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 25 }, - "response_header": { "us": 151 }, - "total": { "us": 256 }, - "validate": { "us": 176 }, - "write_request": { "us": 22 } - } - }, - "monitor": { - "check_group": "d77163e6-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 304 }, - "id": "0075-intermittent", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 23 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 53 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.405Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 216 }, - "total": { "us": 425 }, - "validate": { "us": 249 }, - "write_request": { "us": 26 } - } - }, - "monitor": { - "check_group": "d7715ccb-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 487 }, - "id": "0097-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 16 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 144 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.405Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 40 }, - "response_header": { "us": 283 }, - "total": { "us": 545 }, - "validate": { "us": 323 }, - "write_request": { "us": 33 } - } - }, - "monitor": { - "check_group": "d7715e1f-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 602 }, - "id": "0049-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 25 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 168 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.390Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 29 }, - "response_header": { "us": 186 }, - "total": { "us": 323 }, - "validate": { "us": 215 }, - "write_request": { "us": 43 } - } - }, - "monitor": { - "check_group": "d7713de2-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 365 }, - "id": "0047-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 85 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.389Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 44 }, - "response_header": { "us": 278 }, - "total": { "us": 813 }, - "validate": { "us": 322 }, - "write_request": { "us": 23 } - } - }, - "monitor": { - "check_group": "d7714c9b-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 870 }, - "id": "0077-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 27 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 74 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.387Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 39 }, - "response_header": { "us": 119 }, - "total": { "us": 2751 }, - "validate": { "us": 159 }, - "write_request": { "us": 63 } - } - }, - "monitor": { - "check_group": "d76f8c60-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 2808 }, - "id": "0076-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 21 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 97 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.386Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "error": { "message": "400 Bad Request", "type": "validate" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - "content_bytes": 3 - }, - "status_code": 400 - }, - "rtt": { - "content": { "us": 36 }, - "response_header": { "us": 213 }, - "total": { "us": 1011 }, - "validate": { "us": 249 }, - "write_request": { "us": 20 } - } - }, - "monitor": { - "check_group": "d76f9a0c-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 4258 }, - "id": "0050-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 3215 } }, - "summary": { "down": 1, "up": 0 }, - "tcp": { "rtt": { "connect": { "us": 84 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.386Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 30 }, - "response_header": { "us": 281 }, - "total": { "us": 1150 }, - "validate": { "us": 311 }, - "write_request": { "us": 22 } - } - }, - "monitor": { - "check_group": "d7715654-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 4784 }, - "id": "0048-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 3604 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 83 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.376Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 35 }, - "response_header": { "us": 102 }, - "total": { "us": 1078 }, - "validate": { "us": 137 }, - "write_request": { "us": 23 } - } - }, - "monitor": { - "check_group": "d7714e76-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 14580 }, - "id": "0072-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13443 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 83 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.376Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 34 }, - "response_header": { "us": 142 }, - "total": { "us": 1325 }, - "validate": { "us": 176 }, - "write_request": { "us": 20 } - } - }, - "monitor": { - "check_group": "d77161ee-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 14679 }, - "id": "0096-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13298 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 97 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 34 }, - "response_header": { "us": 112 }, - "total": { "us": 2186 }, - "validate": { "us": 146 }, - "write_request": { "us": 22 } - } - }, - "monitor": { - "check_group": "d7713d04-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15308 }, - "id": "0092-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13087 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 90 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 37 }, - "response_header": { "us": 101 }, - "total": { "us": 2053 }, - "validate": { "us": 139 }, - "write_request": { "us": 22 } - } - }, - "monitor": { - "check_group": "d771594f-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15183 }, - "id": "0069-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13079 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 95 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 103 }, - "total": { "us": 1817 }, - "validate": { "us": 136 }, - "write_request": { "us": 39 } - } - }, - "monitor": { - "check_group": "d7712fe9-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15013 }, - "id": "0093-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13154 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 85 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "error": { "message": "400 Bad Request", "type": "validate" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - "content_bytes": 3 - }, - "status_code": 400 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 190 }, - "total": { "us": 2015 }, - "validate": { "us": 223 }, - "write_request": { "us": 21 } - } - }, - "monitor": { - "check_group": "d7712c5a-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15117 }, - "id": "0070-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13061 } }, - "summary": { "down": 1, "up": 0 }, - "tcp": { "rtt": { "connect": { "us": 84 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 204 }, - "total": { "us": 1613 }, - "validate": { "us": 237 }, - "write_request": { "us": 17 } - } - }, - "monitor": { - "check_group": "d7715562-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 14875 }, - "id": "0071-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13213 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 82 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 34 }, - "response_header": { "us": 231 }, - "total": { "us": 1525 }, - "validate": { "us": 265 }, - "write_request": { "us": 15 } - } - }, - "monitor": { - "check_group": "d7714e85-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 14801 }, - "id": "0095-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13245 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 84 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 34 }, - "response_header": { "us": 302 }, - "total": { "us": 1929 }, - "validate": { "us": 337 }, - "write_request": { "us": 24 } - } - }, - "monitor": { - "check_group": "d77164ad-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15065 }, - "id": "0032-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13096 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 85 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 38 }, - "response_header": { "us": 291 }, - "total": { "us": 1798 }, - "validate": { "us": 329 }, - "write_request": { "us": 33 } - } - }, - "monitor": { - "check_group": "d7716713-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 14911 }, - "id": "0094-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13082 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 84 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.374Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 32 }, - "response_header": { "us": 72 }, - "total": { "us": 2740 }, - "validate": { "us": 104 }, - "write_request": { "us": 27 } - } - }, - "monitor": { - "check_group": "d7713116-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 16135 }, - "id": "0046-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 13358 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 84 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.374Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 22 }, - "response_header": { "us": 79 }, - "total": { "us": 2518 }, - "validate": { "us": 101 }, - "write_request": { "us": 22 } - } - }, - "monitor": { - "check_group": "d76f7de5-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15428 }, - "id": "0091-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 12873 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 86 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.374Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 43 }, - "response_header": { "us": 74 }, - "total": { "us": 2653 }, - "validate": { "us": 117 }, - "write_request": { "us": 24 } - } - }, - "monitor": { - "check_group": "d76f5dc4-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15499 }, - "id": "0067-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 12810 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 97 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.374Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 50 }, - "response_header": { "us": 87 }, - "total": { "us": 2448 }, - "validate": { "us": 137 }, - "write_request": { "us": 23 } - } - }, - "monitor": { - "check_group": "d7712ff7-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15464 }, - "id": "0068-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 12979 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 194 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.374Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 30 }, - "response_header": { "us": 155 }, - "total": { "us": 17495 }, - "validate": { "us": 185 }, - "write_request": { "us": 26 } - } - }, - "monitor": { - "check_group": "d76f6d4a-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 21736 }, - "id": "0090-intermittent", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 29 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 17180 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.374Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 29 }, - "response_header": { "us": 116 }, - "total": { "us": 16475 }, - "validate": { "us": 145 }, - "write_request": { "us": 23 } - } - }, - "monitor": { - "check_group": "d76f9f33-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 21874 }, - "id": "0031-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 32 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 855 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.374Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 21 }, - "response_header": { "us": 272 }, - "total": { "us": 36515 }, - "validate": { "us": 293 }, - "write_request": { "us": 46 } - } - }, - "monitor": { - "check_group": "d76f47b3-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 36584 }, - "id": "0066-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 31 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 36164 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 68 }, - "response_header": { "us": 432 }, - "total": { "us": 3065 }, - "validate": { "us": 501 }, - "write_request": { "us": 91 } - } - }, - "monitor": { - "check_group": "d7713a6e-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 3148 }, - "id": "0084-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 34 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 1839 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 42 }, - "response_header": { "us": 384 }, - "total": { "us": 13373 }, - "validate": { "us": 427 }, - "write_request": { "us": 73 } - } - }, - "monitor": { - "check_group": "d7713952-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 13442 }, - "id": "0083-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 22 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 12887 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 38 }, - "response_header": { "us": 12643 }, - "total": { "us": 13591 }, - "validate": { "us": 12681 }, - "write_request": { "us": 46 } - } - }, - "monitor": { - "check_group": "d76f65db-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 13666 }, - "id": "0041-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 32 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 771 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 36 }, - "response_header": { "us": 100 }, - "total": { "us": 16215 }, - "validate": { "us": 136 }, - "write_request": { "us": 55 } - } - }, - "monitor": { - "check_group": "d7712bcf-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 16290 }, - "id": "0045-intermittent", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 31 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 13440 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 16441 }, - "total": { "us": 17177 }, - "validate": { "us": 16474 }, - "write_request": { "us": 55 } - } - }, - "monitor": { - "check_group": "d76f68c4-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 17255 }, - "id": "0042-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 171 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "error": { "message": "500 Internal Server Error", "type": "validate" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "content": "500", - "hash": "0604cd3138feed202ef293e062da2f4720f77a05d25ee036a7a01c9cfcdd1f0a", - "content_bytes": 3 - }, - "status_code": 500 - }, - "rtt": { - "content": { "us": 28 }, - "response_header": { "us": 197 }, - "total": { "us": 17068 }, - "validate": { "us": 225 }, - "write_request": { "us": 58 } - } - }, - "monitor": { - "check_group": "d771299d-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 17146 }, - "id": "0030-intermittent", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, - "summary": { "down": 1, "up": 0 }, - "tcp": { "rtt": { "connect": { "us": 16662 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 31 }, - "response_header": { "us": 237 }, - "total": { "us": 17695 }, - "validate": { "us": 269 }, - "write_request": { "us": 19 } - } - }, - "monitor": { - "check_group": "d76f934d-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 17770 }, - "id": "0063-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 17371 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 60 }, - "total": { "us": 263 }, - "validate": { "us": 93 }, - "write_request": { "us": 25 } - } - }, - "monitor": { - "check_group": "d76f45b0-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 18194 }, - "id": "0061-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 17894 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 121 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 46 }, - "response_header": { "us": 91 }, - "total": { "us": 314 }, - "validate": { "us": 138 }, - "write_request": { "us": 24 } - } - }, - "monitor": { - "check_group": "d76f6b5c-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 17587 }, - "id": "0065-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 17231 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 80 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 4309 }, - "response_header": { "us": 16631 }, - "total": { "us": 22567 }, - "validate": { "us": 20941 }, - "write_request": { "us": 93 } - } - }, - "monitor": { - "check_group": "d7715f00-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 22666 }, - "id": "0062-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 755 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 30 }, - "response_header": { "us": 32463 }, - "total": { "us": 33244 }, - "validate": { "us": 32494 }, - "write_request": { "us": 55 } - } - }, - "monitor": { - "check_group": "d7712d77-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 33311 }, - "id": "0026-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 28 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 441 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 37 }, - "response_header": { "us": 32543 }, - "total": { "us": 33420 }, - "validate": { "us": 32581 }, - "write_request": { "us": 1876 } - } - }, - "monitor": { - "check_group": "d76f4be5-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 33506 }, - "id": "0085-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 31 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 633 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 29 }, - "response_header": { "us": 32957 }, - "total": { "us": 33876 }, - "validate": { "us": 32986 }, - "write_request": { "us": 59 } - } - }, - "monitor": { - "check_group": "d7712642-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 33974 }, - "id": "0025-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 29 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 752 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 32 }, - "response_header": { "us": 134 }, - "total": { "us": 33626 }, - "validate": { "us": 167 }, - "write_request": { "us": 83 } - } - }, - "monitor": { - "check_group": "d77135e8-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 33693 }, - "id": "0088-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 10 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 33374 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 29 }, - "response_header": { "us": 62 }, - "total": { "us": 33750 }, - "validate": { "us": 92 }, - "write_request": { "us": 26 } - } - }, - "monitor": { - "check_group": "d76f7475-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 33833 }, - "id": "0089-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 29 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 33362 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 25 }, - "response_header": { "us": 128 }, - "total": { "us": 34465 }, - "validate": { "us": 153 }, - "write_request": { "us": 52 } - } - }, - "monitor": { - "check_group": "d76f5b68-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 34600 }, - "id": "0087-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 97 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 34111 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 42 }, - "response_header": { "us": 183 }, - "total": { "us": 35499 }, - "validate": { "us": 225 }, - "write_request": { "us": 57 } - } - }, - "monitor": { - "check_group": "d7713a0f-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 35573 }, - "id": "0028-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 32 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 35069 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 36 }, - "response_header": { "us": 163 }, - "total": { "us": 363 }, - "validate": { "us": 199 }, - "write_request": { "us": 36 } - } - }, - "monitor": { - "check_group": "d7712898-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 35830 }, - "id": "0086-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 35425 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 118 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 39 }, - "response_header": { "us": 200 }, - "total": { "us": 35558 }, - "validate": { "us": 240 }, - "write_request": { "us": 62 } - } - }, - "monitor": { - "check_group": "d7715777-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 35698 }, - "id": "0064-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 38 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 35230 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 38 }, - "response_header": { "us": 146 }, - "total": { "us": 35516 }, - "validate": { "us": 184 }, - "write_request": { "us": 30 } - } - }, - "monitor": { - "check_group": "d7714a08-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 35594 }, - "id": "0029-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 35 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 35171 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 51 }, - "response_header": { "us": 99 }, - "total": { "us": 35574 }, - "validate": { "us": 151 }, - "write_request": { "us": 56 } - } - }, - "monitor": { - "check_group": "d7714fb0-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 35652 }, - "id": "0044-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 33 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 35223 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - } - ] -} diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json deleted file mode 100644 index 823c2e474da71a..00000000000000 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_monitor_id.json +++ /dev/null @@ -1,801 +0,0 @@ -{ - "total": 20, - "locations": ["mpls"], - "pings": [ - { - "@timestamp": "2019-09-11T03:40:34.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 27 }, - "response_header": { "us": 213 }, - "total": { "us": 446 }, - "validate": { "us": 241 }, - "write_request": { "us": 77 } - } - }, - "monitor": { - "check_group": "d76f46bc-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 35534 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 35021 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 55 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:40:04.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 1187 }, - "response_header": { "us": 1465 }, - "total": { "us": 2993 }, - "validate": { "us": 2653 }, - "write_request": { "us": 382 } - } - }, - "monitor": { - "check_group": "c58e66d4-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 3080 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 7 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 294 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:39:34.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 127 }, - "response_header": { "us": 4267 }, - "total": { "us": 7078 }, - "validate": { "us": 4395 }, - "write_request": { "us": 70 } - } - }, - "monitor": { - "check_group": "b3abe52b-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 7810 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 622 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 2434 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:39:04.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 61 }, - "response_header": { "us": 1063 }, - "total": { "us": 1294 }, - "validate": { "us": 1125 }, - "write_request": { "us": 39 } - } - }, - "monitor": { - "check_group": "a1ca3676-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 1575 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 211 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 96 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:38:34.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 48 }, - "response_header": { "us": 929 }, - "total": { "us": 1372 }, - "validate": { "us": 977 }, - "write_request": { "us": 25 } - } - }, - "monitor": { - "check_group": "8fe85c49-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 1787 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 385 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 360 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:38:04.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 27 }, - "response_header": { "us": 190 }, - "total": { "us": 361 }, - "validate": { "us": 217 }, - "write_request": { "us": 23 } - } - }, - "monitor": { - "check_group": "7e091979-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 654 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 264 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 102 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:37:34.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 61 }, - "response_header": { "us": 166 }, - "total": { "us": 350 }, - "validate": { "us": 227 }, - "write_request": { "us": 28 } - } - }, - "monitor": { - "check_group": "6c256fdb-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 15915 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15519 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 74 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:37:04.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 69 }, - "response_header": { "us": 1652 }, - "total": { "us": 2196 }, - "validate": { "us": 1721 }, - "write_request": { "us": 61 } - } - }, - "monitor": { - "check_group": "5a43bd3a-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 2679 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 413 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 350 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:36:34.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 44 }, - "response_header": { "us": 1155 }, - "total": { "us": 2053 }, - "validate": { "us": 1199 }, - "write_request": { "us": 35 } - } - }, - "monitor": { - "check_group": "48629ee3-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 2104 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 16 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 795 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:36:04.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 33 }, - "response_header": { "us": 189 }, - "total": { "us": 383 }, - "validate": { "us": 223 }, - "write_request": { "us": 35 } - } - }, - "monitor": { - "check_group": "368192e1-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 5759 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 5330 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 102 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:35:34.373Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 111 }, - "response_header": { "us": 426 }, - "total": { "us": 4544 }, - "validate": { "us": 537 }, - "write_request": { "us": 34 } - } - }, - "monitor": { - "check_group": "24a2a15c-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 7166 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 2555 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 3812 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:35:04.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 37 }, - "response_header": { "us": 6616 }, - "total": { "us": 26512 }, - "validate": { "us": 6654 }, - "write_request": { "us": 32 } - } - }, - "monitor": { - "check_group": "12c3c9dc-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 26830 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 273 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 96 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:34:34.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 49 }, - "response_header": { "us": 349 }, - "total": { "us": 916 }, - "validate": { "us": 398 }, - "write_request": { "us": 121 } - } - }, - "monitor": { - "check_group": "00dd66e2-d445-11e9-88e3-3e80641b9c71", - "duration": { "us": 993 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 15 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 343 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:34:04.381Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 67 }, - "response_header": { "us": 2443 }, - "total": { "us": 3325 }, - "validate": { "us": 2510 }, - "write_request": { "us": 38 } - } - }, - "monitor": { - "check_group": "eef9da64-d444-11e9-88e3-3e80641b9c71", - "duration": { "us": 3880 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 489 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 760 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:33:34.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 58 }, - "response_header": { "us": 1148 }, - "total": { "us": 1499 }, - "validate": { "us": 1207 }, - "write_request": { "us": 69 } - } - }, - "monitor": { - "check_group": "dd18462b-d444-11e9-88e3-3e80641b9c71", - "duration": { "us": 1604 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 40 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 199 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - } - ] -} diff --git a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json b/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json deleted file mode 100644 index 578384074c9ff3..00000000000000 --- a/x-pack/test/api_integration/apis/uptime/graphql/fixtures/ping_list_sort.json +++ /dev/null @@ -1,271 +0,0 @@ -{ - "total": 20, - "locations": ["mpls"], - "pings": [ - { - "@timestamp": "2019-09-11T03:31:04.380Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 40 }, - "response_header": { "us": 200 }, - "total": { "us": 56793 }, - "validate": { "us": 241 }, - "write_request": { "us": 11 } - } - }, - "monitor": { - "check_group": "83acd094-d444-11e9-88e3-3e80641b9c71", - "duration": { "us": 56940 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 92 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 2260 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:31:34.366Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 89 }, - "response_header": { "us": 996 }, - "total": { "us": 2268 }, - "validate": { "us": 1086 }, - "write_request": { "us": 109 } - } - }, - "monitor": { - "check_group": "959b955d-d444-11e9-88e3-3e80641b9c71", - "duration": { "us": 9861 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 7466 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 363 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:32:04.372Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 132 }, - "response_header": { "us": 1486 }, - "total": { "us": 2724 }, - "validate": { "us": 1619 }, - "write_request": { "us": 103 } - } - }, - "monitor": { - "check_group": "a773d911-d444-11e9-88e3-3e80641b9c71", - "duration": { "us": 2924 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 47 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 802 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:32:34.375Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 32 }, - "response_header": { "us": 204 }, - "total": { "us": 20654 }, - "validate": { "us": 237 }, - "write_request": { "us": 55 } - } - }, - "monitor": { - "check_group": "b9554b41-d444-11e9-88e3-3e80641b9c71", - "duration": { "us": 21665 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 970 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 791 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - }, - { - "@timestamp": "2019-09-11T03:33:04.370Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { "version": "1.1.0" }, - "event": { "dataset": "uptime" }, - "host": { "name": "avc-x1x" }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { "us": 72 }, - "response_header": { "us": 1316 }, - "total": { "us": 1646 }, - "validate": { "us": 1389 }, - "write_request": { "us": 40 } - } - }, - "monitor": { - "check_group": "cb3a5b9e-d444-11e9-88e3-3e80641b9c71", - "duration": { "us": 2128 }, - "id": "0001-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { "location": "37.926868, -78.024902", "name": "mpls" }, - "hostname": "avc-x1x" - }, - "resolve": { "ip": "127.0.0.1", "rtt": { "us": 427 } }, - "summary": { "down": 0, "up": 1 }, - "tcp": { "rtt": { "connect": { "us": 140 } } }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } - } - ] -} diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts index 988c63ad62bfb5..2a8bb302bd8574 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts @@ -4,9 +4,20 @@ * you may not use this file except in compliance with the Elastic License. */ -import { expectFixtureEql } from '../graphql/helpers/expect_fixture_eql'; +import expect from '@kbn/expect'; +import { isLeft } from 'fp-ts/lib/Either'; +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { PingsResponseType } from '../../../../../legacy/plugins/uptime/common/runtime_types'; import { FtrProviderContext } from '../../../ftr_provider_context'; +function decodePingsResponseData(response: any) { + const decoded = PingsResponseType.decode(response); + if (isLeft(decoded)) { + throw Error(JSON.stringify(PathReporter.report(decoded), null, 2)); + } + return decoded.right; +} + export default function({ getService }: FtrProviderContext) { const supertest = getService('supertest'); describe('pingList query', () => { @@ -21,7 +32,23 @@ export default function({ getService }: FtrProviderContext) { `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}` ); - expectFixtureEql(apiResponse.body, 'ping_list'); + const { total, locations, pings } = decodePingsResponseData(apiResponse.body); + + expect(total).to.be(2000); + expect(locations).to.eql(['mpls']); + expect(pings).length(10); + expect(pings.map(({ monitor: { id } }) => id)).to.eql([ + '0074-up', + '0073-up', + '0099-up', + '0098-up', + '0075-intermittent', + '0097-up', + '0049-up', + '0047-up', + '0077-up', + '0076-up', + ]); }); it('returns a list of pings for the date range and given size', async () => { @@ -33,7 +60,63 @@ export default function({ getService }: FtrProviderContext) { `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&size=${size}` ); - expectFixtureEql(apiResponse.body, 'ping_list_count'); + const { total, locations, pings } = decodePingsResponseData(apiResponse.body); + + expect(total).to.be(2000); + expect(locations).to.eql(['mpls']); + expect(pings).length(50); + expect(pings.map(({ monitor: { id } }) => id)).to.eql([ + '0074-up', + '0073-up', + '0099-up', + '0098-up', + '0075-intermittent', + '0097-up', + '0049-up', + '0047-up', + '0077-up', + '0076-up', + '0050-down', + '0048-up', + '0072-up', + '0096-up', + '0092-up', + '0069-up', + '0093-up', + '0070-down', + '0071-up', + '0095-up', + '0032-up', + '0094-up', + '0046-up', + '0091-up', + '0067-up', + '0068-up', + '0090-intermittent', + '0031-up', + '0066-up', + '0084-up', + '0083-up', + '0041-up', + '0045-intermittent', + '0042-up', + '0030-intermittent', + '0063-up', + '0061-up', + '0065-up', + '0062-up', + '0026-up', + '0085-up', + '0025-up', + '0088-up', + '0089-up', + '0087-up', + '0028-up', + '0086-up', + '0064-up', + '0029-up', + '0044-up', + ]); }); it('returns a list of pings for a monitor ID', async () => { @@ -46,7 +129,28 @@ export default function({ getService }: FtrProviderContext) { `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&monitorId=${monitorId}&size=${size}` ); - expectFixtureEql(apiResponse.body, 'ping_list_monitor_id'); + const { total, locations, pings } = decodePingsResponseData(apiResponse.body); + + expect(total).to.be(20); + expect(locations).to.eql(['mpls']); + pings.forEach(({ monitor: { id } }) => expect(id).to.eql('0001-up')); + expect(pings.map(({ '@timestamp': timestamp }) => timestamp)).to.eql([ + '2019-09-11T03:40:34.371Z', + '2019-09-11T03:40:04.370Z', + '2019-09-11T03:39:34.370Z', + '2019-09-11T03:39:04.371Z', + '2019-09-11T03:38:34.370Z', + '2019-09-11T03:38:04.370Z', + '2019-09-11T03:37:34.370Z', + '2019-09-11T03:37:04.370Z', + '2019-09-11T03:36:34.371Z', + '2019-09-11T03:36:04.370Z', + '2019-09-11T03:35:34.373Z', + '2019-09-11T03:35:04.371Z', + '2019-09-11T03:34:34.371Z', + '2019-09-11T03:34:04.381Z', + '2019-09-11T03:33:34.371Z', + ]); }); it('returns a list of pings sorted ascending', async () => { @@ -60,7 +164,17 @@ export default function({ getService }: FtrProviderContext) { `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&monitorId=${monitorId}&size=${size}&sort=${sort}` ); - expectFixtureEql(apiResponse.body, 'ping_list_sort'); + const { total, locations, pings } = decodePingsResponseData(apiResponse.body); + + expect(total).to.be(20); + expect(locations).to.eql(['mpls']); + expect(pings.map(({ '@timestamp': timestamp }) => timestamp)).to.eql([ + '2019-09-11T03:31:04.380Z', + '2019-09-11T03:31:34.366Z', + '2019-09-11T03:32:04.372Z', + '2019-09-11T03:32:34.375Z', + '2019-09-11T03:33:04.370Z', + ]); }); }); } From d4b53c636e4cd7b41379fbdeef38aef506d72606 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 25 Mar 2020 16:57:24 -0400 Subject: [PATCH 13/36] Fix broken unit tests. --- .../__snapshots__/ping_list.test.tsx.snap | 10 ++++---- .../ping_list/__tests__/ping_list.test.tsx | 2 +- .../lib/requests/__tests__/get_pings.test.ts | 24 ++++++++++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap index f32d84bc154177..4202c760e6efa3 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap @@ -149,7 +149,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "duration": Object { "us": 1430, }, - "id": "auto-tcp-0X81440A68E839814C", + "id": "auto-tcp-0X81440A68E839814F", "ip": "127.0.0.1", "name": "", "status": "down", @@ -179,7 +179,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "duration": Object { "us": 1452, }, - "id": "auto-tcp-0X81440A68E839814E", + "id": "auto-tcp-0X81440A68E839814D", "ip": "127.0.0.1", "name": "", "status": "up", @@ -196,7 +196,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "duration": Object { "us": 1094, }, - "id": "auto-tcp-0X81440A68E839814F", + "id": "auto-tcp-0X81440A68E839814E", "ip": "127.0.0.1", "name": "", "status": "down", @@ -282,7 +282,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "duration": Object { "us": 127511, }, - "id": "auto-http-0X131221E73F825974", + "id": "auto-tcp-0X81440A68E839814C", "ip": "172.217.7.4", "name": "", "status": "up", @@ -300,7 +300,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "duration": Object { "us": 287543, }, - "id": "auto-http-0X9CB71300ABD5A2A8", + "id": "auto-http-0X131221E73F825974", "ip": "192.30.253.112", "name": "", "status": "up", diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index e2605f5f2bcd9e..bdfa59e63ed15c 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -215,7 +215,7 @@ describe('PingList component', () => { "duration": Object { "us": 1430, }, - "id": "auto-tcp-0X81440A68E839814C", + "id": "auto-tcp-0X81440A68E839814F", "ip": "127.0.0.1", "name": "", "status": "down", diff --git a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts index 9145ccca1b6d17..6bfc4b8332f388 100644 --- a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts @@ -17,16 +17,34 @@ describe('getAll', () => { { _source: { '@timestamp': '2018-10-30T18:51:59.792Z', + monitor: { + duration: { us: 2134 }, + id: 'foo', + status: 'up', + type: 'http', + }, }, }, { _source: { '@timestamp': '2018-10-30T18:53:59.792Z', + monitor: { + duration: { us: 2131 }, + id: 'foo', + status: 'up', + type: 'http', + }, }, }, { _source: { '@timestamp': '2018-10-30T18:55:59.792Z', + monitor: { + duration: { us: 2132 }, + id: 'foo', + status: 'up', + type: 'http', + }, }, }, ]; @@ -83,9 +101,9 @@ describe('getAll', () => { const pings = result.pings!; expect(pings).toHaveLength(count); - expect(pings[0].timestamp).toBe('2018-10-30T18:51:59.792Z'); - expect(pings[1].timestamp).toBe('2018-10-30T18:53:59.792Z'); - expect(pings[2].timestamp).toBe('2018-10-30T18:55:59.792Z'); + expect(pings[0]['@timestamp']).toBe('2018-10-30T18:51:59.792Z'); + expect(pings[1]['@timestamp']).toBe('2018-10-30T18:53:59.792Z'); + expect(pings[2]['@timestamp']).toBe('2018-10-30T18:55:59.792Z'); expect(mockEsClient).toHaveBeenCalledTimes(1); }); From 8df46a85151adab9b270029329512b26c40f829b Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 25 Mar 2020 17:13:36 -0400 Subject: [PATCH 14/36] Fix broken types. --- .../components/connected/charts/ping_histogram.tsx | 2 +- .../components/functional/charts/ping_histogram.tsx | 2 +- .../uptime/public/state/actions/monitor_status.ts | 2 +- .../legacy/plugins/uptime/public/state/reducers/ping.ts | 2 +- .../public/state/selectors/__tests__/index.test.ts | 9 +++++++++ .../uptime/server/lib/requests/get_ping_histogram.ts | 6 ++++-- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx index 50f91be4ff09f3..0bffd9b2d35e8a 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx @@ -14,7 +14,7 @@ import { import { getPingHistogram } from '../../../state/actions'; import { selectPingHistogram } from '../../../state/selectors'; import { withResponsiveWrapper, ResponsiveWrapperProps } from '../../higher_order'; -import { GetPingHistogramParams, HistogramResult } from '../../../../common/types'; +import { GetPingHistogramParams, HistogramResult } from '../../../../common/runtime_types'; import { useUrlParams } from '../../../hooks'; type Props = ResponsiveWrapperProps & diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/ping_histogram.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/charts/ping_histogram.tsx index 17fa8781b828b6..abf124a217a2c1 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/ping_histogram.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/ping_histogram.tsx @@ -13,7 +13,7 @@ import moment from 'moment'; import { getChartDateLabel } from '../../../lib/helper'; import { ChartWrapper } from './chart_wrapper'; import { UptimeThemeContext } from '../../../contexts'; -import { HistogramResult } from '../../../../common/types'; +import { HistogramResult } from '../../../../common/runtime_types'; import { useUrlParams } from '../../../hooks'; import { ChartEmptyState } from './chart_empty_state'; diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts index 7917628abf7dae..303a6d4afe5458 100644 --- a/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts @@ -5,7 +5,7 @@ */ import { createAction } from 'redux-actions'; import { QueryParams } from './types'; -import { Ping } from '../../../common/graphql/types'; +import { Ping } from '../../../common/runtime_types'; export const getSelectedMonitorAction = createAction<{ monitorId: string }>('GET_SELECTED_MONITOR'); export const getSelectedMonitorActionSuccess = createAction('GET_SELECTED_MONITOR_SUCCESS'); diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/ping.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/ping.ts index 76775e6a0a3550..4c8715038ce360 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/ping.ts @@ -6,7 +6,7 @@ import { handleActions, Action } from 'redux-actions'; import { getPingHistogram, getPingHistogramSuccess, getPingHistogramFail } from '../actions'; -import { HistogramResult } from '../../../common/types'; +import { HistogramResult } from '../../../common/runtime_types'; export interface PingState { pingHistogram: HistogramResult | null; diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts index 573d5b1906082f..56c4fbdf174756 100644 --- a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts +++ b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts @@ -59,6 +59,15 @@ describe('state selectors', () => { loading: false, errors: [], }, + pingList: { + errors: [], + loading: false, + pingList: { + total: 0, + locations: [], + pings: [], + }, + }, monitorDuration: { durationLines: null, loading: false, diff --git a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts b/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts index 00f1fc7de4c121..ebf0457a86ac97 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts @@ -7,8 +7,10 @@ import { UMElasticsearchQueryFn } from '../adapters'; import { QUERY } from '../../../../../legacy/plugins/uptime/common/constants'; import { getFilterClause } from '../helper'; -import { HistogramQueryResult } from './types'; -import { HistogramResult } from '../../../../../legacy/plugins/uptime/common/types'; +import { + HistogramResult, + HistogramQueryResult, +} from '../../../../../legacy/plugins/uptime/common/runtime_types'; export interface GetPingHistogramParams { /** @member dateRangeStart timestamp bounds */ From 507dcf78122a6aa94973af1453816c792586a6cd Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 27 Mar 2020 18:21:17 -0400 Subject: [PATCH 15/36] Remove local state storage from parent components. --- .../components/connected/pings/ping_list.tsx | 9 +- .../functional/ping_list/ping_list.tsx | 84 ++++++++----------- .../plugins/uptime/public/pages/monitor.tsx | 28 +------ 3 files changed, 37 insertions(+), 84 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx index f738656cdd51fc..cd12a06e2041f8 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx @@ -14,15 +14,8 @@ import { PingListComponent } from '../../functional'; export interface PingListProps { monitorId: string; - onSelectedStatusChange: (status: string | undefined) => void; - onSelectedLocationChange: (location: any) => void; - onPageCountChange: (itemCount: number) => void; - pageSize: number; - selectedOption: string; - selectedLocation: string | undefined; - size: number; - status: string; } + export const PingList = (props: PingListProps) => { const { loading, diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index 432d38fa4558bf..72dbe32b10c85f 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -66,24 +66,34 @@ interface Props extends PingListProps { pings: Ping[]; } +const DEFAULT_PAGE_SIZE = 10; + +const statusOptions = [ + { + text: i18n.translate('xpack.uptime.pingList.statusOptions.allStatusOptionLabel', { + defaultMessage: 'All', + }), + value: '', + }, + { + text: i18n.translate('xpack.uptime.pingList.statusOptions.upStatusOptionLabel', { + defaultMessage: 'Up', + }), + value: 'up', + }, + { + text: i18n.translate('xpack.uptime.pingList.statusOptions.downStatusOptionLabel', { + defaultMessage: 'Down', + }), + value: 'down', + }, +]; + export const PingListComponent = (props: Props) => { - const { - dateRangeStart, - dateRangeEnd, - getPings, - loading, - locations, - monitorId, - onPageCountChange, - onSelectedLocationChange, - onSelectedStatusChange, - pageSize, - pings, - selectedLocation, - selectedOption, - size, - status, - } = props; + const [selectedLocation, setSelectedLocation] = useState(''); + const [status, setStatus] = useState(''); + const [size, setSize] = useState(DEFAULT_PAGE_SIZE); + const { dateRangeStart, dateRangeEnd, getPings, loading, locations, monitorId, pings } = props; useEffect(() => { getPings({ @@ -98,26 +108,6 @@ export const PingListComponent = (props: Props) => { const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); - const statusOptions = [ - { - text: i18n.translate('xpack.uptime.pingList.statusOptions.allStatusOptionLabel', { - defaultMessage: 'All', - }), - value: '', - }, - { - text: i18n.translate('xpack.uptime.pingList.statusOptions.upStatusOptionLabel', { - defaultMessage: 'Up', - }), - value: 'up', - }, - { - text: i18n.translate('xpack.uptime.pingList.statusOptions.downStatusOptionLabel', { - defaultMessage: 'Down', - }), - value: 'down', - }, - ]; const locationOptions = !locations ? [AllLocationOption] : [AllLocationOption].concat( @@ -243,13 +233,13 @@ export const PingListComponent = (props: Props) => { const pagination: Pagination = { initialPageSize: 20, pageIndex: 0, - pageSize, + pageSize: size, pageSizeOptions: [5, 10, 20, 50, 100], /** * we're not currently supporting pagination in this component * so the first page is the only page */ - totalItemCount: pageSize, + totalItemCount: size, }; return ( @@ -273,15 +263,9 @@ export const PingListComponent = (props: Props) => { aria-label={i18n.translate('xpack.uptime.pingList.statusLabel', { defaultMessage: 'Status', })} - value={selectedOption} + value={status} onChange={selected => { - if (typeof selected.target.value === 'string') { - onSelectedStatusChange( - selected.target && selected.target.value !== '' - ? selected.target.value - : undefined - ); - } + setStatus(selected.target.value); }} /> @@ -300,9 +284,7 @@ export const PingListComponent = (props: Props) => { defaultMessage: 'Location', })} onChange={selected => { - onSelectedLocationChange( - selected.target && selected.target.value !== '' ? selected.target.value : null - ); + setSelectedLocation(selected.target.value); }} /> @@ -318,7 +300,7 @@ export const PingListComponent = (props: Props) => { itemId="@timestamp" itemIdToExpandedRowMap={itemIdToExpandedRowMap} pagination={pagination} - onChange={(criteria: any) => onPageCountChange(criteria.page!.size)} + onChange={(criteria: any) => setSize(criteria.page!.size)} /> ); diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 1873ab9861940d..9ccf14b46f49d5 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -5,11 +5,10 @@ */ import { EuiSpacer } from '@elastic/eui'; -import React, { useContext, useState, useEffect } from 'react'; +import React, { useEffect } from 'react'; import { useParams } from 'react-router-dom'; import { connect, MapDispatchToPropsFunction, MapStateToPropsParam } from 'react-redux'; -import { UptimeRefreshContext } from '../contexts'; -import { useUptimeTelemetry, useUrlParams, UptimePage } from '../hooks'; +import { useUptimeTelemetry, UptimePage } from '../hooks'; import { useTrackPageview } from '../../../../../plugins/observability/public'; import { MonitorStatusDetails } from '../components/connected'; import { Ping } from '../../common/runtime_types'; @@ -45,14 +44,6 @@ export const MonitorPageComponent: React.FC = ({ } }, [dispatchGetMonitorStatus, monitorId]); - const [pingListPageCount, setPingListPageCount] = useState(10); - const { refreshApp } = useContext(UptimeRefreshContext); - const [getUrlParams, updateUrlParams] = useUrlParams(); - const { absoluteDateRangeStart, absoluteDateRangeEnd, ...params } = getUrlParams(); - const { selectedPingStatus } = params; - - const [selectedLocation, setSelectedLocation] = useState(undefined); - useUptimeTelemetry(UptimePage.Monitor); useTrackPageview({ app: 'uptime', path: 'monitor' }); @@ -68,20 +59,7 @@ export const MonitorPageComponent: React.FC = ({ - { - updateUrlParams({ selectedPingStatus: selectedStatus || '' }); - refreshApp(); - }} - pageSize={pingListPageCount} - selectedOption={selectedPingStatus} - selectedLocation={selectedLocation} - monitorId={monitorId} - size={pingListPageCount} - status={selectedPingStatus} - /> + ); }; From c164fbd54c7aa5eb31376121fd03a6a1e0ad59a2 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Tue, 31 Mar 2020 18:39:46 -0400 Subject: [PATCH 16/36] Add functional test to cover Ping List functionality. --- .../functional/ping_list/ping_list.tsx | 21 ++++++++++++---- x-pack/test/functional/apps/uptime/monitor.ts | 24 +++++++++++++++++++ .../functional/page_objects/uptime_page.ts | 14 +++++++++++ x-pack/test/functional/services/uptime.ts | 17 +++++++++++++ 4 files changed, 71 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index 8c955dac838c0f..a41228cb306825 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -34,7 +34,11 @@ interface ExpandedRowMap { [key: string]: JSX.Element; } -export const AllLocationOption = { text: 'All', value: '' }; +export const AllLocationOption = { + 'data-test-subj': 'xpack.uptime.pingList.locationOptions.all', + text: 'All', + value: '', +}; export const toggleDetails = ( ping: Ping, @@ -71,18 +75,21 @@ const DEFAULT_PAGE_SIZE = 10; const statusOptions = [ { + 'data-test-subj': 'xpack.uptime.pingList.statusOptions.all', text: i18n.translate('xpack.uptime.pingList.statusOptions.allStatusOptionLabel', { defaultMessage: 'All', }), value: '', }, { + 'data-test-subj': 'xpack.uptime.pingList.statusOptions.up', text: i18n.translate('xpack.uptime.pingList.statusOptions.upStatusOptionLabel', { defaultMessage: 'Up', }), value: 'up', }, { + 'data-test-subj': 'xpack.uptime.pingList.statusOptions.down', text: i18n.translate('xpack.uptime.pingList.statusOptions.downStatusOptionLabel', { defaultMessage: 'Down', }), @@ -122,9 +129,11 @@ export const PingListComponent = (props: Props) => { const locationOptions = !locations ? [AllLocationOption] : [AllLocationOption].concat( - locations.map(name => { - return { text: name, value: name }; - }) + locations.map(name => ({ + text: name, + 'data-test-subj': `xpack.uptime.pingList.locationOptions.${name}`, + value: name, + })) ); const hasStatus: boolean = pings.reduce( @@ -140,7 +149,7 @@ export const PingListComponent = (props: Props) => { defaultMessage: 'Status', }), render: (pingStatus: string, item: Ping) => ( -
+
{pingStatus === 'up' ? i18n.translate('xpack.uptime.pingList.statusColumnHealthUpLabel', { @@ -274,6 +283,7 @@ export const PingListComponent = (props: Props) => { aria-label={i18n.translate('xpack.uptime.pingList.statusLabel', { defaultMessage: 'Status', })} + data-test-subj="xpack.uptime.pingList.statusSelect" value={status} onChange={selected => { setStatus(selected.target.value); @@ -294,6 +304,7 @@ export const PingListComponent = (props: Props) => { aria-label={i18n.translate('xpack.uptime.pingList.locationLabel', { defaultMessage: 'Location', })} + data-test-subj="xpack.uptime.pingList.locationSelect" onChange={selected => { setSelectedLocation(selected.target.value); }} diff --git a/x-pack/test/functional/apps/uptime/monitor.ts b/x-pack/test/functional/apps/uptime/monitor.ts index 034ccad4815a1f..a496bf5128ace8 100644 --- a/x-pack/test/functional/apps/uptime/monitor.ts +++ b/x-pack/test/functional/apps/uptime/monitor.ts @@ -25,5 +25,29 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { '0000-intermittent' ); }); + + it('displays ping data as expected', async () => { + await pageObjects.uptime.loadDataAndGoToMonitorPage( + 'Sep 10, 2019 @ 12:40:08.078', + 'Sep 11, 2019 @ 19:40:08.078', + '0000-intermittent' + ); + await pageObjects.uptime.checkPingListInteractions( + [ + '2019-09-11T03:40:34.371Z', + '2019-09-11T03:40:04.370Z', + '2019-09-11T03:39:34.370Z', + '2019-09-11T03:39:04.370Z', + '2019-09-11T03:38:34.370Z', + '2019-09-11T03:38:04.370Z', + '2019-09-11T03:37:34.370Z', + '2019-09-11T03:37:04.371Z', + '2019-09-11T03:36:34.370Z', + '2019-09-11T03:36:04.370Z', + ], + 'mpls', + 'up' + ); + }); }); }; diff --git a/x-pack/test/functional/page_objects/uptime_page.ts b/x-pack/test/functional/page_objects/uptime_page.ts index 0b8e994ba80955..055597e68f504a 100644 --- a/x-pack/test/functional/page_objects/uptime_page.ts +++ b/x-pack/test/functional/page_objects/uptime_page.ts @@ -151,5 +151,19 @@ export function UptimePageProvider({ getPageObjects, getService }: FtrProviderCo await uptimeService.openPageSizeSelectPopover(); return uptimeService.clickPageSizeSelectPopoverItem(size); } + + public async checkPingListInteractions( + timestamps: string[], + location?: string, + status?: string + ): Promise { + if (location) { + await uptimeService.setPingListLocation(location); + } + if (status) { + await uptimeService.setPingListStatus(status); + } + return uptimeService.checkForPingListTimestamps(timestamps); + } })(); } diff --git a/x-pack/test/functional/services/uptime.ts b/x-pack/test/functional/services/uptime.ts index 5a24a51f967fd8..5d59ee70ccb824 100644 --- a/x-pack/test/functional/services/uptime.ts +++ b/x-pack/test/functional/services/uptime.ts @@ -203,5 +203,22 @@ export function UptimeProvider({ getService }: FtrProviderContext) { 5000 ); }, + async setPingListLocation(location: string) { + await testSubjects.click('xpack.uptime.pingList.locationSelect', 5000); + return testSubjects.click(`xpack.uptime.pingList.locationOptions.${location}`, 5000); + }, + async setPingListStatus(status: string) { + await testSubjects.click('xpack.uptime.pingList.statusSelect', 5000); + return testSubjects.click(`xpack.uptime.pingList.statusOptions.${status}`, 5000); + }, + async checkForPingListTimestamps(timestamps: string[]): Promise { + return retry.tryForTime(10000, async () => { + await Promise.all( + timestamps.map(timestamp => + testSubjects.existOrFail(`xpack.uptime.pingList.ping-${timestamp}`) + ) + ); + }); + }, }; } From 46cc1e51e588a69da526f4f194079187e2049d41 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 1 Apr 2020 10:43:47 -0400 Subject: [PATCH 17/36] Fix monitor page functional test that was broken by merge conflicts. --- x-pack/test/functional/apps/uptime/monitor.ts | 4 ++-- .../test/functional/page_objects/uptime_page.ts | 8 ++++---- .../test/functional/services/uptime/monitor.ts | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/x-pack/test/functional/apps/uptime/monitor.ts b/x-pack/test/functional/apps/uptime/monitor.ts index 2ff15bac3db19d..baa9acbbdcd78a 100644 --- a/x-pack/test/functional/apps/uptime/monitor.ts +++ b/x-pack/test/functional/apps/uptime/monitor.ts @@ -33,12 +33,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('displays ping data as expected', async () => { - await pageObjects.uptime.loadDataAndGoToMonitorPage( + await uptime.loadDataAndGoToMonitorPage( 'Sep 10, 2019 @ 12:40:08.078', 'Sep 11, 2019 @ 19:40:08.078', '0000-intermittent' ); - await pageObjects.uptime.checkPingListInteractions( + await uptime.checkPingListInteractions( [ '2019-09-11T03:40:34.371Z', '2019-09-11T03:40:04.370Z', diff --git a/x-pack/test/functional/page_objects/uptime_page.ts b/x-pack/test/functional/page_objects/uptime_page.ts index c2c3c099903ec5..9219bb3e477859 100644 --- a/x-pack/test/functional/page_objects/uptime_page.ts +++ b/x-pack/test/functional/page_objects/uptime_page.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../ftr_provider_context'; export function UptimePageProvider({ getPageObjects, getService }: FtrProviderContext) { const pageObjects = getPageObjects(['common', 'timePicker']); - const { common: commonService, navigation, alerts } = getService('uptime'); + const { alerts, common: commonService, monitor, navigation } = getService('uptime'); const retry = getService('retry'); return new (class UptimePage { @@ -143,12 +143,12 @@ export function UptimePageProvider({ getPageObjects, getService }: FtrProviderCo status?: string ): Promise { if (location) { - await uptimeService.setPingListLocation(location); + await monitor.setPingListLocation(location); } if (status) { - await uptimeService.setPingListStatus(status); + await monitor.setPingListStatus(status); } - return uptimeService.checkForPingListTimestamps(timestamps); + return monitor.checkForPingListTimestamps(timestamps); } })(); } diff --git a/x-pack/test/functional/services/uptime/monitor.ts b/x-pack/test/functional/services/uptime/monitor.ts index 3bdec4b6749d42..a3e3d953e2eb76 100644 --- a/x-pack/test/functional/services/uptime/monitor.ts +++ b/x-pack/test/functional/services/uptime/monitor.ts @@ -27,5 +27,22 @@ export function UptimeMonitorProvider({ getService }: FtrProviderContext) { await find.descendantExistsByCssSelector('canvas.mapboxgl-canvas', mapPanel); }); }, + async setPingListLocation(location: string) { + await testSubjects.click('xpack.uptime.pingList.locationSelect', 5000); + return testSubjects.click(`xpack.uptime.pingList.locationOptions.${location}`, 5000); + }, + async setPingListStatus(status: string) { + await testSubjects.click('xpack.uptime.pingList.statusSelect', 5000); + return testSubjects.click(`xpack.uptime.pingList.statusOptions.${status}`, 5000); + }, + async checkForPingListTimestamps(timestamps: string[]): Promise { + return retry.tryForTime(10000, async () => { + await Promise.all( + timestamps.map(timestamp => + testSubjects.existOrFail(`xpack.uptime.pingList.ping-${timestamp}`) + ) + ); + }); + }, }; } From 18bd1542696a5151fe423823fa6c9b22d4d88819 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Thu, 2 Apr 2020 17:27:04 -0400 Subject: [PATCH 18/36] Fix broken tests. --- .../__snapshots__/ping_list.test.tsx.snap | 6 ++++ .../__tests__/get_latest_monitor.test.ts | 36 +++++++------------ 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap index 528ca072e56cd9..a4d8496c122e46 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap @@ -34,18 +34,22 @@ exports[`PingList component renders sorted list without errors 1`] = ` > { }, }; mockEsSearchResult = { - aggregations: { - by_id: { - buckets: [ - { - latest: { - hits: { - hits: [ - { - _source: { - '@timestamp': '123456', - monitor: { - duration: { - us: 12345, - }, - id: 'testMonitor', - status: 'down', - type: 'http', - }, - }, - }, - ], + hits: { + hits: [ + { + _source: { + '@timestamp': '123456', + monitor: { + duration: { + us: 12345, }, + id: 'testMonitor', + status: 'down', + type: 'http', }, }, - ], - }, + }, + ], }, }; }); From b3b5b345c8b03ad2a39006a1a8dabdb5da4be4f0 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Thu, 2 Apr 2020 17:47:16 -0400 Subject: [PATCH 19/36] Fix broken API test. --- .../uptime/rest/fixtures/monitor_latest_status.json | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json index 2e5854f4d98665..7f2dfcb40ff9d8 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json @@ -1,16 +1,11 @@ { - "timestamp": "2019-09-11T03:40:34.371Z", "observer": { - "geo": { - "name": "mpls", - "location": "37.926868, -78.024902" - }, + "geo": { "name": "mpls", "location": "37.926868, -78.024902" }, "hostname": "avc-x1x" }, + "@timestamp": "2019-09-11T03:40:34.371Z", "monitor": { - "duration": { - "us": 24627 - }, + "duration": { "us": 24627 }, "ip": "127.0.0.1", "name": "", "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", From 496aa53d3619ace0d15325eb361b7114ca121302 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 8 Apr 2020 10:07:56 -0400 Subject: [PATCH 20/36] Replace a test with a describe block that will pre-navigate all tests. --- x-pack/test/functional/apps/uptime/monitor.ts | 47 +++++++++---------- .../functional/page_objects/uptime_page.ts | 4 +- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/x-pack/test/functional/apps/uptime/monitor.ts b/x-pack/test/functional/apps/uptime/monitor.ts index baa9acbbdcd78a..7cfa5cbec1107b 100644 --- a/x-pack/test/functional/apps/uptime/monitor.ts +++ b/x-pack/test/functional/apps/uptime/monitor.ts @@ -28,32 +28,29 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await esArchiver.unload(archive); }); - it('loads and displays uptime data based on date range', async () => { - await uptime.loadDataAndGoToMonitorPage(dateStart, dateEnd, monitorId, monitorName); - }); + describe('navigation to monitor page', () => { + before(async () => { + await uptime.loadDataAndGoToMonitorPage(dateStart, dateEnd, monitorId, monitorName); + }); - it('displays ping data as expected', async () => { - await uptime.loadDataAndGoToMonitorPage( - 'Sep 10, 2019 @ 12:40:08.078', - 'Sep 11, 2019 @ 19:40:08.078', - '0000-intermittent' - ); - await uptime.checkPingListInteractions( - [ - '2019-09-11T03:40:34.371Z', - '2019-09-11T03:40:04.370Z', - '2019-09-11T03:39:34.370Z', - '2019-09-11T03:39:04.370Z', - '2019-09-11T03:38:34.370Z', - '2019-09-11T03:38:04.370Z', - '2019-09-11T03:37:34.370Z', - '2019-09-11T03:37:04.371Z', - '2019-09-11T03:36:34.370Z', - '2019-09-11T03:36:04.370Z', - ], - 'mpls', - 'up' - ); + it('displays ping data as expected', async () => { + await uptime.checkPingListInteractions( + [ + '2019-09-11T03:40:34.371Z', + '2019-09-11T03:40:04.370Z', + '2019-09-11T03:39:34.370Z', + '2019-09-11T03:39:04.370Z', + '2019-09-11T03:38:34.370Z', + '2019-09-11T03:38:04.370Z', + '2019-09-11T03:37:34.370Z', + '2019-09-11T03:37:04.371Z', + '2019-09-11T03:36:34.370Z', + '2019-09-11T03:36:04.370Z', + ], + 'mpls', + 'up' + ); + }); }); }); }; diff --git a/x-pack/test/functional/page_objects/uptime_page.ts b/x-pack/test/functional/page_objects/uptime_page.ts index bdb5e753c6e4b9..5044882c6f38b4 100644 --- a/x-pack/test/functional/page_objects/uptime_page.ts +++ b/x-pack/test/functional/page_objects/uptime_page.ts @@ -42,9 +42,9 @@ export function UptimePageProvider({ getPageObjects, getService }: FtrProviderCo datePickerEndValue: string, monitorId: string, monitorName?: string - ) { + ): Promise { await pageObjects.timePicker.setAbsoluteRange(datePickerStartValue, datePickerEndValue); - await navigation.goToMonitor(monitorId, monitorName); + return navigation.goToMonitor(monitorId, monitorName); } public async inputFilterQuery(filterQuery: string) { From 9f4423da489bf8b5c03d7bca06e25b4574810a0c Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 8 Apr 2020 12:42:15 -0400 Subject: [PATCH 21/36] Delete unused reducer keys. --- .../legacy/plugins/uptime/public/state/reducers/ping_list.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts index 934bdcd4ddbf7e..cebcb0dfa1951c 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts @@ -30,19 +30,16 @@ export const pingListReducer = handleActions( { [String(getPings)]: state => ({ ...state, - pingListLoading: true, }), [String(getPingsSuccess)]: (state, action: Action) => ({ ...state, pingList: { ...action.payload }, - pingListLoading: false, }), [String(getPingsFail)]: (state, action: Action) => ({ ...state, - pingListErrors: [...state.errors, action.payload], - pingListLoading: false, + errors: [...state.errors, action.payload], }), }, initialState From bf8d347cf0ddb706e53ca8e12140cc9f6494e8c2 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 8 Apr 2020 13:01:37 -0400 Subject: [PATCH 22/36] Re-introduce loading to ping list reducer. --- .../legacy/plugins/uptime/public/state/reducers/ping_list.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts index cebcb0dfa1951c..6ea978afa41050 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/ping_list.ts @@ -30,16 +30,19 @@ export const pingListReducer = handleActions( { [String(getPings)]: state => ({ ...state, + loading: true, }), [String(getPingsSuccess)]: (state, action: Action) => ({ ...state, pingList: { ...action.payload }, + loading: false, }), [String(getPingsFail)]: (state, action: Action) => ({ ...state, errors: [...state.errors, action.payload], + loading: false, }), }, initialState From 9b7c6b0f50f47269fe5fe198491dd22ec58e6e4e Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 8 Apr 2020 13:12:39 -0400 Subject: [PATCH 23/36] Inroduce code that will cause PingList to re-fetch when refresh button is pressed. --- .../public/components/connected/pings/ping_list.tsx | 8 ++++++-- .../components/functional/ping_list/ping_list.tsx | 13 ++++++++++++- .../plugins/uptime/public/state/selectors/index.ts | 5 ++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx index 94a67c98474576..fb9006794f75c5 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx @@ -18,8 +18,11 @@ export interface PingListProps { export const PingList = (props: PingListProps) => { const { - loading, - pingList: { locations, pings, total }, + lastRefresh, + pings: { + loading, + pingList: { locations, pings, total }, + }, } = useSelector(selectPingList); const { dateRangeStart: from, dateRangeEnd: to } = useContext(UptimeSettingsContext); @@ -45,6 +48,7 @@ export const PingList = (props: PingListProps) => { dateRangeStart={from} dateRangeEnd={to} getPings={getPingsCallback} + lastRefresh={lastRefresh} loading={loading} locations={locations} pings={pings} diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index a41228cb306825..1dbb3ad0931503 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -65,6 +65,7 @@ interface Props extends PingListProps { dateRangeStart: string; dateRangeEnd: string; getPings: (props: GetPingsParams) => void; + lastRefresh: number; loading: boolean; locations: string[]; pings: Ping[]; @@ -106,6 +107,7 @@ export const PingListComponent = (props: Props) => { dateRangeStart, dateRangeEnd, getPings, + lastRefresh, loading, locations, monitorId, @@ -122,7 +124,16 @@ export const PingListComponent = (props: Props) => { size: pageSize, status: status !== 'all' ? status : '', }); - }, [dateRangeStart, dateRangeEnd, getPings, monitorId, selectedLocation, pageSize, status]); + }, [ + dateRangeStart, + dateRangeEnd, + getPings, + monitorId, + lastRefresh, + selectedLocation, + pageSize, + status, + ]); const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts index 1c06973c863ba2..37695e42743066 100644 --- a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts +++ b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts @@ -41,7 +41,10 @@ export const selectPingHistogram = ({ ping, ui }: AppState) => { }; }; -export const selectPingList = ({ pingList }: AppState) => pingList; +export const selectPingList = ({ pingList, ui: { lastRefresh } }: AppState) => ({ + pings: pingList, + lastRefresh, +}); const mlCapabilitiesSelector = (state: AppState) => state.ml.mlCapabilities.data; From 433bb7475a367ec6b573e7fadc94ce578733d468 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Thu, 9 Apr 2020 12:35:13 -0400 Subject: [PATCH 24/36] Update expanded rows to support multiple concurrent expanded rows. --- .../functional/ping_list/ping_list.tsx | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index 1dbb3ad0931503..32e1027f30731e 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -30,10 +30,6 @@ import { Pagination } from './../monitor_list'; import { PingListExpandedRowComponent } from './expanded_row'; import { PingListProps } from '../../connected/pings'; -interface ExpandedRowMap { - [key: string]: JSX.Element; -} - export const AllLocationOption = { 'data-test-subj': 'xpack.uptime.pingList.locationOptions.all', text: 'All', @@ -42,19 +38,21 @@ export const AllLocationOption = { export const toggleDetails = ( ping: Ping, - itemIdToExpandedRowMap: ExpandedRowMap, - setItemIdToExpandedRowMap: (update: ExpandedRowMap) => any + expandedRows: Record, + setExpandedRows: (update: Record) => any ) => { - // If the user has clicked on the expanded map, close all expanded rows. - if (itemIdToExpandedRowMap[ping['@timestamp']]) { - setItemIdToExpandedRowMap({}); + // If already expanded, collapse + if (expandedRows[ping['@timestamp']]) { + delete expandedRows[ping['@timestamp']]; + setExpandedRows({ ...expandedRows }); return; } // Otherwise expand this row - const newItemIdToExpandedRowMap: ExpandedRowMap = {}; - newItemIdToExpandedRowMap[ping['@timestamp']] = ; - setItemIdToExpandedRowMap(newItemIdToExpandedRowMap); + setExpandedRows({ + ...expandedRows, + [ping['@timestamp']]: , + }); }; const SpanWithMargin = styled.span` @@ -135,7 +133,7 @@ export const PingListComponent = (props: Props) => { status, ]); - const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); + const [expandedRows, setExpandedRows] = useState>({}); const locationOptions = !locations ? [AllLocationOption] @@ -245,16 +243,16 @@ export const PingListComponent = (props: Props) => { render: (item: Ping) => { return ( toggleDetails(item, itemIdToExpandedRowMap, setItemIdToExpandedRowMap)} + onClick={() => toggleDetails(item, expandedRows, setExpandedRows)} disabled={!item.error && !(item.http?.response?.body?.content_bytes ?? 0 > 0)} aria-label={ - itemIdToExpandedRowMap[item.monitor.id] + expandedRows[item['@timestamp']] ? i18n.translate('xpack.uptime.pingList.collapseRow', { defaultMessage: 'Collapse', }) : i18n.translate('xpack.uptime.pingList.expandRow', { defaultMessage: 'Expand' }) } - iconType={itemIdToExpandedRowMap[item.monitor.id] ? 'arrowUp' : 'arrowDown'} + iconType={expandedRows[item['@timestamp']] ? 'arrowUp' : 'arrowDown'} /> ); }, @@ -331,7 +329,7 @@ export const PingListComponent = (props: Props) => { hasActions={true} items={pings} itemId="@timestamp" - itemIdToExpandedRowMap={itemIdToExpandedRowMap} + itemIdToExpandedRowMap={expandedRows} pagination={pagination} onChange={(criteria: any) => { setPageSize(criteria.page!.size); From 0995904099c996ea47be82b5901969b26ca6f55d Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Thu, 9 Apr 2020 18:35:27 -0400 Subject: [PATCH 25/36] Modify pingList reducer to have singular optional error field. --- .../uptime/public/components/connected/pings/ping_list.tsx | 2 ++ .../public/components/functional/ping_list/ping_list.tsx | 5 ++++- .../legacy/plugins/uptime/public/state/reducers/ping_list.ts | 5 ++--- .../uptime/public/state/selectors/__tests__/index.test.ts | 1 - 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx index fb9006794f75c5..fccb8946e91329 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx @@ -20,6 +20,7 @@ export const PingList = (props: PingListProps) => { const { lastRefresh, pings: { + error, loading, pingList: { locations, pings, total }, }, @@ -47,6 +48,7 @@ export const PingList = (props: PingListProps) => { void; lastRefresh: number; loading: boolean; @@ -104,6 +105,7 @@ export const PingListComponent = (props: Props) => { const { dateRangeStart, dateRangeEnd, + error, getPings, lastRefresh, loading, @@ -213,7 +215,7 @@ export const PingListComponent = (props: Props) => { name: i18n.translate('xpack.uptime.pingList.errorTypeColumnLabel', { defaultMessage: 'Error type', }), - render: (error: string) => error ?? '-', + render: (errorType: string) => errorType ?? '-', }, // Only add this column is there is any status present in list ...(hasStatus @@ -325,6 +327,7 @@ export const PingListComponent = (props: Props) => { ( [String(getPingsFail)]: (state, action: Action) => ({ ...state, - errors: [...state.errors, action.payload], + error: action.payload, loading: false, }), }, diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts index 742712278777f9..77902f347f6f93 100644 --- a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts +++ b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts @@ -59,7 +59,6 @@ describe('state selectors', () => { errors: [], }, pingList: { - errors: [], loading: false, pingList: { total: 0, From adf02e3e72e3e083e71d401a179cd206ad1d9ce1 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 10 Apr 2020 09:13:02 -0400 Subject: [PATCH 26/36] Delete unnecessary helper code. --- .../plugins/uptime/public/state/api/ping.ts | 40 +++++-------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts index 7e41dff80f7c27..bb30057e0b534a 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts @@ -15,22 +15,6 @@ import { import { apiService } from './utils'; import { API_URLS } from '../../../common/constants/rest_api'; -export const mergeParams = ( - params: Record, - maybeParams: Record -): Record => { - let definedParams = params; - Object.keys(maybeParams).forEach(param => { - if (maybeParams[param]) { - definedParams = { - ...definedParams, - [param]: maybeParams[param], - }; - } - }); - return definedParams; -}; - export const fetchPings: APIFn = async ({ dateRangeStart, dateRangeEnd, @@ -40,10 +24,8 @@ export const fetchPings: APIFn = async ({ sort, status, }) => { - const params = mergeParams( - { dateRangeStart, dateRangeEnd, monitorId }, - { location, size, sort, status } - ); + const params = { dateRangeStart, dateRangeEnd, monitorId, location, size, sort, status }; + return await apiService.get(API_URLS.PINGS, params, PingsResponseType); }; @@ -54,17 +36,13 @@ export const fetchPingHistogram: APIFn statusFilter, filters, }) => { - const queryParams = mergeParams( - { - dateStart, - dateEnd, - }, - { - monitorId, - statusFilter, - filters, - } - ); + const queryParams = { + dateStart, + dateEnd, + monitorId, + statusFilter, + filters, + }; return await apiService.get(API_URLS.PING_HISTOGRAM, queryParams); }; From b0ca803956f9a2d9114ea5ee659eb94eb107e76f Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 10 Apr 2020 09:20:34 -0400 Subject: [PATCH 27/36] Delete unused interface. --- .../legacy/plugins/uptime/public/state/api/monitor_status.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts index 33495c89450c86..7c8ab3518b5a07 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts @@ -9,10 +9,6 @@ import { Ping } from '../../../common/runtime_types'; import { API_URLS } from '../../../common/constants'; import { apiService } from './utils'; -export interface APIParams { - monitorId: string; -} - export const fetchMonitorStatus = async ({ monitorId, dateStart, From 1df28d66e4cf2e0a6217cca8d37ed8b3dfbcf2da Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 10 Apr 2020 11:09:43 -0400 Subject: [PATCH 28/36] Add runtime_type to parse getPings params, fix pagination index. --- .../uptime/common/runtime_types/common.ts | 6 +++ .../uptime/common/runtime_types/ping/ping.ts | 25 +++++++---- .../components/connected/pings/ping_list.tsx | 25 ++++------- .../functional/ping_list/ping_list.tsx | 28 +++++------- .../plugins/uptime/public/state/api/ping.ts | 15 ++----- .../uptime/server/lib/requests/get_pings.ts | 44 +++++-------------- .../uptime/server/rest_api/pings/get_pings.ts | 24 +++++----- 7 files changed, 67 insertions(+), 100 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/common/runtime_types/common.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/common.ts index 37101b5b46fd2b..9018f4acaa3204 100644 --- a/x-pack/legacy/plugins/uptime/common/runtime_types/common.ts +++ b/x-pack/legacy/plugins/uptime/common/runtime_types/common.ts @@ -27,7 +27,13 @@ export const StatesIndexStatusType = t.type({ docCount: t.number, }); +export const DateRangeType = t.type({ + from: t.string, + to: t.string, +}); + export type Summary = t.TypeOf; export type CheckGeo = t.TypeOf; export type Location = t.TypeOf; export type StatesIndexStatus = t.TypeOf; +export type DateRange = t.TypeOf; diff --git a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts index b8ff2c6e76cd82..a1253b84cb5ee8 100644 --- a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts @@ -5,6 +5,7 @@ */ import * as t from 'io-ts'; +import { DateRangeType } from '../common'; export const HttpResponseBodyType = t.partial({ bytes: t.number, @@ -158,12 +159,18 @@ export const PingsResponseType = t.type({ export type PingsResponse = t.TypeOf; -export interface GetPingsParams { - dateRangeStart: string; - dateRangeEnd: string; - location?: string; - monitorId?: string; - size?: number; - sort?: string; - status?: string; -} +export const GetPingsParamsType = t.intersection([ + t.type({ + dateRange: DateRangeType, + }), + t.partial({ + index: t.number, + size: t.number, + location: t.string, + monitorId: t.string, + sort: t.string, + status: t.string, + }), +]); + +export type GetPingsParams = t.TypeOf; diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx index fccb8946e91329..5b32a623495f16 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/pings/ping_list.tsx @@ -26,28 +26,19 @@ export const PingList = (props: PingListProps) => { }, } = useSelector(selectPingList); - const { dateRangeStart: from, dateRangeEnd: to } = useContext(UptimeSettingsContext); + const { dateRangeStart: drs, dateRangeEnd: dre } = useContext(UptimeSettingsContext); const dispatch = useDispatch(); - const getPingsCallback = useCallback( - ({ dateRangeStart, dateRangeEnd, location, monitorId, size, status }: GetPingsParams) => - dispatch( - getPings({ - dateRangeStart, - dateRangeEnd, - location, - monitorId, - size, - status, - }) - ), - [dispatch] - ); + const getPingsCallback = useCallback((params: GetPingsParams) => dispatch(getPings(params)), [ + dispatch, + ]); return ( void; lastRefresh: number; @@ -103,8 +102,7 @@ export const PingListComponent = (props: Props) => { const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE); const [pageIndex, setPageIndex] = useState(0); const { - dateRangeStart, - dateRangeEnd, + dateRange: { from, to }, error, getPings, lastRefresh, @@ -117,23 +115,17 @@ export const PingListComponent = (props: Props) => { useEffect(() => { getPings({ - dateRangeStart, - dateRangeEnd, + dateRange: { + from, + to, + }, location: selectedLocation, monitorId, + index: pageIndex, size: pageSize, status: status !== 'all' ? status : '', }); - }, [ - dateRangeStart, - dateRangeEnd, - getPings, - monitorId, - lastRefresh, - selectedLocation, - pageSize, - status, - ]); + }, [from, to, getPings, monitorId, lastRefresh, selectedLocation, pageIndex, pageSize, status]); const [expandedRows, setExpandedRows] = useState>({}); @@ -246,7 +238,7 @@ export const PingListComponent = (props: Props) => { return ( toggleDetails(item, expandedRows, setExpandedRows)} - disabled={!item.error && !(item.http?.response?.body?.content_bytes ?? 0 > 0)} + disabled={!item.error && !(item.http?.response?.body?.bytes ?? 0 > 0)} aria-label={ expandedRows[item['@timestamp']] ? i18n.translate('xpack.uptime.pingList.collapseRow', { diff --git a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts index bb30057e0b534a..bbd3ddf399dcc6 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/ping.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/ping.ts @@ -16,18 +16,9 @@ import { apiService } from './utils'; import { API_URLS } from '../../../common/constants/rest_api'; export const fetchPings: APIFn = async ({ - dateRangeStart, - dateRangeEnd, - location, - monitorId, - size, - sort, - status, -}) => { - const params = { dateRangeStart, dateRangeEnd, monitorId, location, size, sort, status }; - - return await apiService.get(API_URLS.PINGS, params, PingsResponseType); -}; + dateRange: { from, to }, + ...optional +}) => await apiService.get(API_URLS.PINGS, { from, to, ...optional }, PingsResponseType); export const fetchPingHistogram: APIFn = async ({ monitorId, diff --git a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts index 690888ccc0a37a..8ccf772a941368 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_pings.ts @@ -8,53 +8,29 @@ import { isRight } from 'fp-ts/lib/Either'; import { PathReporter } from 'io-ts/lib/PathReporter'; import { UMElasticsearchQueryFn } from '../adapters/framework'; import { + GetPingsParams, HttpResponseBody, PingsResponse, PingsResponseType, Ping, } from '../../../../../legacy/plugins/uptime/common/runtime_types'; -export interface GetPingsParams { - /** @member dateRangeStart timestamp bounds */ - dateRangeStart: string; - - /** @member dateRangeEnd timestamp bounds */ - dateRangeEnd: string; - - /** @member monitorId optional limit by monitorId */ - monitorId?: string | null; - - /** @member status optional limit by check statuses */ - status?: string | null; - - /** @member sort optional sort by timestamp */ - sort?: string | null; - - /** @member size optional limit query size */ - size?: number | null; - - /** @member location optional location value for use in filtering*/ - location?: string | null; - - /** @member page the number to provide to Elasticsearch as the "from" parameter */ - page?: number; -} +const DEFAULT_PAGE_SIZE = 25; export const getPings: UMElasticsearchQueryFn = async ({ callES, dynamicSettings, - dateRangeStart, - dateRangeEnd, + dateRange: { from, to }, + index, monitorId, status, sort, - size, + size: sizeParam, location, - page, }) => { + const size = sizeParam ?? DEFAULT_PAGE_SIZE; const sortParam = { sort: [{ '@timestamp': { order: sort ?? 'desc' } }] }; - const sizeParam = size ? { size } : undefined; - const filter: any[] = [{ range: { '@timestamp': { gte: dateRangeStart, lte: dateRangeEnd } } }]; + const filter: any[] = [{ range: { '@timestamp': { gte: from, lte: to } } }]; if (monitorId) { filter.push({ term: { 'monitor.id': monitorId } }); } @@ -74,7 +50,7 @@ export const getPings: UMElasticsearchQueryFn = a ...queryContext, }, ...sortParam, - ...sizeParam, + size, aggregations: { locations: { terms: { @@ -88,8 +64,8 @@ export const getPings: UMElasticsearchQueryFn = a }, }; - if (page) { - params.body.from = page * (size ?? 25); + if (index) { + params.body.from = index * size; } const { diff --git a/x-pack/plugins/uptime/server/rest_api/pings/get_pings.ts b/x-pack/plugins/uptime/server/rest_api/pings/get_pings.ts index cde9a8c4e47ead..80a887a7f64a9d 100644 --- a/x-pack/plugins/uptime/server/rest_api/pings/get_pings.ts +++ b/x-pack/plugins/uptime/server/rest_api/pings/get_pings.ts @@ -5,37 +5,41 @@ */ import { schema } from '@kbn/config-schema'; +import { isLeft } from 'fp-ts/lib/Either'; +import { PathReporter } from 'io-ts/lib/PathReporter'; import { UMServerLibs } from '../../lib/lib'; import { UMRestApiRouteFactory } from '../types'; import { API_URLS } from '../../../../../legacy/plugins/uptime/common/constants/rest_api'; +import { GetPingsParamsType } from '../../../../../legacy/plugins/uptime/common/runtime_types'; export const createGetPingsRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', path: API_URLS.PINGS, validate: { query: schema.object({ - dateRangeStart: schema.string(), - dateRangeEnd: schema.string(), + from: schema.string(), + to: schema.string(), location: schema.maybe(schema.string()), monitorId: schema.maybe(schema.string()), + index: schema.maybe(schema.number()), size: schema.maybe(schema.number()), sort: schema.maybe(schema.string()), status: schema.maybe(schema.string()), }), }, handler: async ({ callES, dynamicSettings }, _context, request, response): Promise => { - const { dateRangeStart, dateRangeEnd, location, monitorId, size, sort, status } = request.query; + const { from, to, ...optional } = request.query; + const params = GetPingsParamsType.decode({ dateRange: { from, to }, ...optional }); + if (isLeft(params)) { + // eslint-disable-next-line no-console + console.error(new Error(PathReporter.report(params).join(';'))); + return response.badRequest({ body: { message: 'Received invalid request parameters.' } }); + } const result = await libs.requests.getPings({ callES, dynamicSettings, - dateRangeStart, - dateRangeEnd, - monitorId, - status, - sort, - size, - location, + ...params.right, }); return response.ok({ From 55ac2aab4dae9f98bdf4eeda8c99542b5826155a Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 10 Apr 2020 11:31:33 -0400 Subject: [PATCH 29/36] Add dedicated monitor type to runtime_types. --- .../uptime/common/runtime_types/ping/ping.ts | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts index a1253b84cb5ee8..aa3298e649b3af 100644 --- a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts @@ -23,28 +23,32 @@ export const TlsType = t.partial({ export type Tls = t.TypeOf; +export const MonitorType = t.intersection([ + t.type({ + duration: t.type({ + us: t.number, + }), + id: t.string, + status: t.string, + type: t.string, + }), + t.partial({ + check_group: t.string, + ip: t.string, + name: t.string, + timespan: t.partial({ + gte: t.string, + lte: t.string, + }), + }), +]); + +export type Monitor = t.TypeOf; + export const PingType = t.intersection([ t.type({ '@timestamp': t.string, - monitor: t.intersection([ - t.type({ - duration: t.type({ - us: t.number, - }), - id: t.string, - status: t.string, - type: t.string, - }), - t.partial({ - check_group: t.string, - ip: t.string, - name: t.string, - timespan: t.partial({ - gte: t.string, - lte: t.string, - }), - }), - ]), + monitor: MonitorType, }), t.partial({ agent: t.intersection([ From 7426fc7a9f3294ad844e4fee7e1fe538998e27bc Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 10 Apr 2020 13:08:33 -0400 Subject: [PATCH 30/36] Fix broken tests. --- .../ping_list/__tests__/ping_list.test.tsx | 7 +++-- .../public/state/api/__tests__/ping.test.ts | 29 ------------------- .../lib/requests/__tests__/get_pings.test.ts | 18 ++++-------- .../uptime/server/lib/requests/index.ts | 2 +- .../server/lib/requests/uptime_requests.ts | 2 +- 5 files changed, 13 insertions(+), 45 deletions(-) delete mode 100644 x-pack/legacy/plugins/uptime/public/state/api/__tests__/ping.test.ts diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index 658c3a9143de58..f916920b5bb489 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -167,9 +167,12 @@ describe('PingList component', () => { it('renders sorted list without errors', () => { const component = shallowWithIntl( { - describe('mergeParams', () => { - it('returns the guaranteed params if there are no falsy params', () => { - expect(mergeParams({ foo: 'bar' }, {})).toMatchInlineSnapshot(` - Object { - "foo": "bar", - } - `); - }); - - it('adds truthy params while ignoring falsy params', () => { - expect(mergeParams({ young: 'star' }, { h: 1, he: 2, li: undefined })).toMatchInlineSnapshot(` - Object { - "h": 1, - "he": 2, - "young": "star", - } - `); - }); - }); -}); diff --git a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts index 6bfc4b8332f388..41eba626ae3ecd 100644 --- a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts @@ -90,8 +90,7 @@ describe('getAll', () => { const result = await getPings({ callES: mockEsClient, dynamicSettings: defaultDynamicSettings, - dateRangeStart: 'now-1h', - dateRangeEnd: 'now', + dateRange: { from: 'now-1h', to: 'now' }, sort: 'asc', size: 12, }); @@ -113,8 +112,7 @@ describe('getAll', () => { await getPings({ callES: mockEsClient, dynamicSettings: defaultDynamicSettings, - dateRangeStart: 'now-1h', - dateRangeEnd: 'now', + dateRange: { from: 'now-1h', to: 'now' }, sort: 'asc', size: 12, }); @@ -130,8 +128,7 @@ describe('getAll', () => { await getPings({ callES: mockEsClient, dynamicSettings: defaultDynamicSettings, - dateRangeStart: 'now-1h', - dateRangeEnd: 'now', + dateRange: { from: 'now-1h', to: 'now' }, size: 12, }); @@ -144,8 +141,7 @@ describe('getAll', () => { await getPings({ callES: mockEsClient, dynamicSettings: defaultDynamicSettings, - dateRangeStart: 'now-1h', - dateRangeEnd: 'now', + dateRange: { from: 'now-1h', to: 'now' }, sort: 'desc', }); delete expectedGetAllParams.body.size; @@ -160,8 +156,7 @@ describe('getAll', () => { await getPings({ callES: mockEsClient, dynamicSettings: defaultDynamicSettings, - dateRangeStart: 'now-1h', - dateRangeEnd: 'now', + dateRange: { from: 'now-1h', to: 'now' }, monitorId: 'testmonitorid', }); delete expectedGetAllParams.body.size; @@ -176,8 +171,7 @@ describe('getAll', () => { await getPings({ callES: mockEsClient, dynamicSettings: defaultDynamicSettings, - dateRangeStart: 'now-1h', - dateRangeEnd: 'now', + dateRange: { from: 'now-1h', to: 'now' }, status: 'down', }); delete expectedGetAllParams.body.size; diff --git a/x-pack/plugins/uptime/server/lib/requests/index.ts b/x-pack/plugins/uptime/server/lib/requests/index.ts index 445adc3c15a930..6317f665d377f4 100644 --- a/x-pack/plugins/uptime/server/lib/requests/index.ts +++ b/x-pack/plugins/uptime/server/lib/requests/index.ts @@ -13,7 +13,7 @@ export { getMonitorLocations, GetMonitorLocationsParams } from './get_monitor_lo export { getMonitorStates, GetMonitorStatesParams } from './get_monitor_states'; export { getMonitorStatus, GetMonitorStatusParams } from './get_monitor_status'; export * from './get_monitor_status'; -export { getPings, GetPingsParams } from './get_pings'; +export { getPings } from './get_pings'; export { getPingHistogram, GetPingHistogramParams } from './get_ping_histogram'; export { UptimeRequests } from './uptime_requests'; export { getSnapshotCount, GetSnapshotCountParams } from './get_snapshot_counts'; diff --git a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts index 00399a5d959974..e9a7aa94dd3aa8 100644 --- a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts +++ b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts @@ -9,6 +9,7 @@ import { HistogramResult, Ping, PingsResponse as PingResults, + GetPingsParams, } from '../../../../../legacy/plugins/uptime/common/runtime_types'; import { GetFilterBarParams, @@ -17,7 +18,6 @@ import { GetMonitorDetailsParams, GetMonitorLocationsParams, GetMonitorStatesParams, - GetPingsParams, GetPingHistogramParams, GetMonitorStatusParams, GetMonitorStatusResult, From 59bc38f4b175bb6c9e35071c60bb8d8b3b16e055 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 10 Apr 2020 14:11:25 -0400 Subject: [PATCH 31/36] Fix broken tests. --- .../lib/requests/__tests__/get_pings.test.ts | 231 +++++++++++++++++- .../apis/uptime/feature_controls.ts | 2 +- .../apis/uptime/get_all_pings.ts | 14 +- .../apis/uptime/rest/ping_list.ts | 26 +- 4 files changed, 238 insertions(+), 35 deletions(-) diff --git a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts index 41eba626ae3ecd..3a74a43170e040 100644 --- a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts @@ -79,7 +79,6 @@ describe('getAll', () => { }, }, sort: [{ '@timestamp': { order: 'desc' } }], - size: 12, }, }; }); @@ -119,7 +118,47 @@ describe('getAll', () => { set(expectedGetAllParams, 'body.sort[0]', { '@timestamp': { order: 'asc' } }); expect(mockEsClient).toHaveBeenCalledTimes(1); - expect(mockEsClient).toHaveBeenCalledWith('search', expectedGetAllParams); + expect(mockEsClient.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "search", + Object { + "body": Object { + "aggregations": Object { + "locations": Object { + "terms": Object { + "field": "observer.geo.name", + "missing": "N/A", + "size": 1000, + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "gte": "now-1h", + "lte": "now", + }, + }, + }, + ], + }, + }, + "size": 12, + "sort": Array [ + Object { + "@timestamp": Object { + "order": "asc", + }, + }, + ], + }, + "index": "heartbeat-8*", + }, + ] + `); }); it('omits the sort param when no sort passed', async () => { @@ -132,7 +171,48 @@ describe('getAll', () => { size: 12, }); - expect(mockEsClient).toHaveBeenCalledWith('search', expectedGetAllParams); + expect(mockEsClient).toHaveBeenCalledTimes(1); + expect(mockEsClient.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "search", + Object { + "body": Object { + "aggregations": Object { + "locations": Object { + "terms": Object { + "field": "observer.geo.name", + "missing": "N/A", + "size": 1000, + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "gte": "now-1h", + "lte": "now", + }, + }, + }, + ], + }, + }, + "size": 12, + "sort": Array [ + Object { + "@timestamp": Object { + "order": "desc", + }, + }, + ], + }, + "index": "heartbeat-8*", + }, + ] + `); }); it('omits the size param when no size passed', async () => { @@ -144,10 +224,49 @@ describe('getAll', () => { dateRange: { from: 'now-1h', to: 'now' }, sort: 'desc', }); - delete expectedGetAllParams.body.size; - set(expectedGetAllParams, 'body.sort[0].@timestamp.order', 'desc'); - expect(mockEsClient).toHaveBeenCalledWith('search', expectedGetAllParams); + expect(mockEsClient).toHaveBeenCalledTimes(1); + expect(mockEsClient.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "search", + Object { + "body": Object { + "aggregations": Object { + "locations": Object { + "terms": Object { + "field": "observer.geo.name", + "missing": "N/A", + "size": 1000, + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "gte": "now-1h", + "lte": "now", + }, + }, + }, + ], + }, + }, + "size": 25, + "sort": Array [ + Object { + "@timestamp": Object { + "order": "desc", + }, + }, + ], + }, + "index": "heartbeat-8*", + }, + ] + `); }); it('adds a filter for monitor ID', async () => { @@ -159,10 +278,54 @@ describe('getAll', () => { dateRange: { from: 'now-1h', to: 'now' }, monitorId: 'testmonitorid', }); - delete expectedGetAllParams.body.size; - expectedGetAllParams.body.query.bool.filter.push({ term: { 'monitor.id': 'testmonitorid' } }); - expect(mockEsClient).toHaveBeenCalledWith('search', expectedGetAllParams); + expect(mockEsClient).toHaveBeenCalledTimes(1); + expect(mockEsClient.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "search", + Object { + "body": Object { + "aggregations": Object { + "locations": Object { + "terms": Object { + "field": "observer.geo.name", + "missing": "N/A", + "size": 1000, + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "gte": "now-1h", + "lte": "now", + }, + }, + }, + Object { + "term": Object { + "monitor.id": "testmonitorid", + }, + }, + ], + }, + }, + "size": 25, + "sort": Array [ + Object { + "@timestamp": Object { + "order": "desc", + }, + }, + ], + }, + "index": "heartbeat-8*", + }, + ] + `); }); it('adds a filter for monitor status', async () => { @@ -174,9 +337,53 @@ describe('getAll', () => { dateRange: { from: 'now-1h', to: 'now' }, status: 'down', }); - delete expectedGetAllParams.body.size; - expectedGetAllParams.body.query.bool.filter.push({ term: { 'monitor.status': 'down' } }); - expect(mockEsClient).toHaveBeenCalledWith('search', expectedGetAllParams); + expect(mockEsClient).toHaveBeenCalledTimes(1); + expect(mockEsClient.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "search", + Object { + "body": Object { + "aggregations": Object { + "locations": Object { + "terms": Object { + "field": "observer.geo.name", + "missing": "N/A", + "size": 1000, + }, + }, + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "range": Object { + "@timestamp": Object { + "gte": "now-1h", + "lte": "now", + }, + }, + }, + Object { + "term": Object { + "monitor.status": "down", + }, + }, + ], + }, + }, + "size": 25, + "sort": Array [ + Object { + "@timestamp": Object { + "order": "desc", + }, + }, + ], + }, + "index": "heartbeat-8*", + }, + ] + `); }); }); diff --git a/x-pack/test/api_integration/apis/uptime/feature_controls.ts b/x-pack/test/api_integration/apis/uptime/feature_controls.ts index 4c3b7f97c9544f..8b82735fc38b05 100644 --- a/x-pack/test/api_integration/apis/uptime/feature_controls.ts +++ b/x-pack/test/api_integration/apis/uptime/feature_controls.ts @@ -40,7 +40,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext) const executePingsRequest = async (username: string, password: string, spaceId?: string) => { const basePath = spaceId ? `/s/${spaceId}` : ''; - const url = `${basePath}${API_URLS.PINGS}?sort=desc&dateRangeStart=${PINGS_DATE_RANGE_START}&dateRangeEnd=${PINGS_DATE_RANGE_END}`; + const url = `${basePath}${API_URLS.PINGS}?sort=desc&from=${PINGS_DATE_RANGE_START}&to=${PINGS_DATE_RANGE_END}`; return await supertest .get(url) .auth(username, password) diff --git a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts index 949d03abaf7adc..0b3f5faccb044d 100644 --- a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts +++ b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts @@ -22,7 +22,7 @@ export default function({ getService }: FtrProviderContext) { it('should get all pings stored in index', async () => { const { body: apiResponse } = await supertest .get( - `/api/uptime/pings?sort=desc&dateRangeStart=${PINGS_DATE_RANGE_START}&dateRangeEnd=${PINGS_DATE_RANGE_END}` + `/api/uptime/pings?sort=desc&from=${PINGS_DATE_RANGE_START}&to=${PINGS_DATE_RANGE_END}` ) .expect(200); @@ -33,9 +33,7 @@ export default function({ getService }: FtrProviderContext) { it('should sort pings according to timestamp', async () => { const { body: apiResponse } = await supertest - .get( - `/api/uptime/pings?sort=asc&dateRangeStart=${PINGS_DATE_RANGE_START}&dateRangeEnd=${PINGS_DATE_RANGE_END}` - ) + .get(`/api/uptime/pings?sort=asc&from=${PINGS_DATE_RANGE_START}&to=${PINGS_DATE_RANGE_END}`) .expect(200); expect(apiResponse.total).to.be(2); @@ -47,7 +45,7 @@ export default function({ getService }: FtrProviderContext) { it('should return results of n length', async () => { const { body: apiResponse } = await supertest .get( - `/api/uptime/pings?sort=desc&size=1&dateRangeStart=${PINGS_DATE_RANGE_START}&dateRangeEnd=${PINGS_DATE_RANGE_END}` + `/api/uptime/pings?sort=desc&size=1&from=${PINGS_DATE_RANGE_START}&to=${PINGS_DATE_RANGE_END}` ) .expect(200); @@ -57,10 +55,10 @@ export default function({ getService }: FtrProviderContext) { }); it('should miss pings outside of date range', async () => { - const dateRangeStart = moment('2002-01-01').valueOf(); - const dateRangeEnd = moment('2002-01-02').valueOf(); + const from = moment('2002-01-01').valueOf(); + const to = moment('2002-01-02').valueOf(); const { body: apiResponse } = await supertest - .get(`/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}`) + .get(`/api/uptime/pings?from=${from}&to=${to}`) .expect(200); expect(apiResponse.total).to.be(0); diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts index 2a8bb302bd8574..e3662fe718557d 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts @@ -25,12 +25,10 @@ export default function({ getService }: FtrProviderContext) { after('unload heartbeat index', () => getService('esArchiver').unload('uptime/full_heartbeat')); it('returns a list of pings for the given date range and default size', async () => { - const dateRangeStart = '2019-01-28T17:40:08.078Z'; - const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + const from = '2019-01-28T17:40:08.078Z'; + const to = '2025-01-28T19:00:16.078Z'; - const apiResponse = await supertest.get( - `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}` - ); + const apiResponse = await supertest.get(`/api/uptime/pings?from=${from}&to=${to}&size=10`); const { total, locations, pings } = decodePingsResponseData(apiResponse.body); @@ -52,12 +50,12 @@ export default function({ getService }: FtrProviderContext) { }); it('returns a list of pings for the date range and given size', async () => { - const dateRangeStart = '2019-01-28T17:40:08.078Z'; - const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + const from = '2019-01-28T17:40:08.078Z'; + const to = '2025-01-28T19:00:16.078Z'; const size = 50; const apiResponse = await supertest.get( - `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&size=${size}` + `/api/uptime/pings?from=${from}&to=${to}&size=${size}` ); const { total, locations, pings } = decodePingsResponseData(apiResponse.body); @@ -120,13 +118,13 @@ export default function({ getService }: FtrProviderContext) { }); it('returns a list of pings for a monitor ID', async () => { - const dateRangeStart = '2019-01-28T17:40:08.078Z'; - const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + const from = '2019-01-28T17:40:08.078Z'; + const to = '2025-01-28T19:00:16.078Z'; const monitorId = '0001-up'; const size = 15; const apiResponse = await supertest.get( - `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&monitorId=${monitorId}&size=${size}` + `/api/uptime/pings?from=${from}&to=${to}&monitorId=${monitorId}&size=${size}` ); const { total, locations, pings } = decodePingsResponseData(apiResponse.body); @@ -154,14 +152,14 @@ export default function({ getService }: FtrProviderContext) { }); it('returns a list of pings sorted ascending', async () => { - const dateRangeStart = '2019-01-28T17:40:08.078Z'; - const dateRangeEnd = '2025-01-28T19:00:16.078Z'; + const from = '2019-01-28T17:40:08.078Z'; + const to = '2025-01-28T19:00:16.078Z'; const monitorId = '0001-up'; const size = 5; const sort = 'asc'; const apiResponse = await supertest.get( - `/api/uptime/pings?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}&monitorId=${monitorId}&size=${size}&sort=${sort}` + `/api/uptime/pings?from=${from}&to=${to}&monitorId=${monitorId}&size=${size}&sort=${sort}` ); const { total, locations, pings } = decodePingsResponseData(apiResponse.body); From 1062e415543f73129b43091db7fe1df43bcbefc5 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 10 Apr 2020 15:23:13 -0400 Subject: [PATCH 32/36] Rename '@timestamp' property to 'timestamp' on Ping type. --- .../uptime/common/runtime_types/ping/ping.ts | 2 +- .../__test__/monitor_status.bar.test.tsx | 2 +- .../__snapshots__/ping_list.test.tsx.snap | 22 +++++++-------- .../ping_list/__tests__/expanded_row.test.tsx | 2 +- .../ping_list/__tests__/ping_list.test.tsx | 28 +++++++++---------- .../functional/ping_list/ping_list.tsx | 16 +++++------ .../__tests__/get_latest_monitor.test.ts | 3 +- .../lib/requests/__tests__/get_pings.test.ts | 12 ++++---- .../server/lib/requests/get_latest_monitor.ts | 3 +- .../uptime/server/lib/requests/get_pings.ts | 2 +- .../rest/fixtures/monitor_latest_status.json | 3 +- .../apis/uptime/rest/ping_list.ts | 4 +-- 12 files changed, 51 insertions(+), 48 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts index aa3298e649b3af..f32a411b7d23a9 100644 --- a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts @@ -47,7 +47,7 @@ export type Monitor = t.TypeOf; export const PingType = t.intersection([ t.type({ - '@timestamp': t.string, + timestamp: t.string, monitor: MonitorType, }), t.partial({ diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx index 965c3b8bd4acf5..01f8d848edc466 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx @@ -16,7 +16,7 @@ describe('MonitorStatusBar component', () => { beforeEach(() => { monitorStatus = { - '@timestamp': moment(new Date()) + timestamp: moment(new Date()) .subtract(15, 'm') .toString(), monitor: { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap index a4d8496c122e46..58ab89f5497ab0 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap @@ -141,12 +141,11 @@ exports[`PingList component renders sorted list without errors 1`] = ` } hasActions={true} isExpandable={true} - itemId="@timestamp" + itemId="timestamp" itemIdToExpandedRowMap={Object {}} items={ Array [ Object { - "@timestamp": "2019-01-28T17:47:08.078Z", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -161,9 +160,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "down", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:08.078Z", }, Object { - "@timestamp": "2019-01-28T17:47:09.075Z", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -178,9 +177,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "down", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:09.075Z", }, Object { - "@timestamp": "2019-01-28T17:47:06.077Z", "monitor": Object { "duration": Object { "us": 1452, @@ -191,9 +190,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "up", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:06.077Z", }, Object { - "@timestamp": "2019-01-28T17:47:07.075Z", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -208,9 +207,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "down", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:07.075Z", }, Object { - "@timestamp": "2019-01-28T17:47:07.074Z", "error": Object { "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", "type": "io", @@ -225,9 +224,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "down", "type": "http", }, + "timestamp": "2019-01-28T17:47:07.074Z", }, Object { - "@timestamp": "2019-01-28T17:47:18.080Z", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -242,9 +241,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "down", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:18.080Z", }, Object { - "@timestamp": "2019-01-28T17:47:19.076Z", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -259,9 +258,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "down", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:19.076Z", }, Object { - "@timestamp": "2019-01-28T17:47:19.076Z", "error": Object { "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", "type": "io", @@ -276,9 +275,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "down", "type": "http", }, + "timestamp": "2019-01-28T17:47:19.076Z", }, Object { - "@timestamp": "2019-01-28T17:47:19.077Z", "http": Object { "response": Object { "status_code": 200, @@ -294,9 +293,9 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "up", "type": "http", }, + "timestamp": "2019-01-28T17:47:19.077Z", }, Object { - "@timestamp": "2019-01-28T17:47:19.077Z", "http": Object { "response": Object { "status_code": 200, @@ -312,6 +311,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "status": "up", "type": "http", }, + "timestamp": "2019-01-28T17:47:19.077Z", }, ] } diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx index efcfcb780c6c28..038721d8900722 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx @@ -14,7 +14,7 @@ describe('PingListExpandedRow', () => { let ping: Ping; beforeEach(() => { ping = { - '@timestamp': '19290310', + timestamp: '19290310', monitor: { duration: { us: 12345, diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index f916920b5bb489..c60ec6b6b4fa7f 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -19,7 +19,7 @@ describe('PingList component', () => { locations: ['nyc'], pings: [ { - '@timestamp': '2019-01-28T17:47:08.078Z', + timestamp: '2019-01-28T17:47:08.078Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', type: 'io', @@ -34,7 +34,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:09.075Z', + timestamp: '2019-01-28T17:47:09.075Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', type: 'io', @@ -49,7 +49,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:06.077Z', + timestamp: '2019-01-28T17:47:06.077Z', monitor: { duration: { us: 1452 }, id: 'auto-tcp-0X81440A68E839814D', @@ -60,7 +60,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:07.075Z', + timestamp: '2019-01-28T17:47:07.075Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', type: 'io', @@ -75,7 +75,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:07.074Z', + timestamp: '2019-01-28T17:47:07.074Z', error: { message: 'Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused', @@ -91,7 +91,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:18.080Z', + timestamp: '2019-01-28T17:47:18.080Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', type: 'io', @@ -106,7 +106,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:19.076Z', + timestamp: '2019-01-28T17:47:19.076Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', type: 'io', @@ -121,7 +121,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:19.076Z', + timestamp: '2019-01-28T17:47:19.076Z', error: { message: 'Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused', @@ -137,7 +137,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:19.077Z', + timestamp: '2019-01-28T17:47:19.077Z', http: { response: { status_code: 200 } }, monitor: { duration: { us: 127511 }, @@ -149,7 +149,7 @@ describe('PingList component', () => { }, }, { - '@timestamp': '2019-01-28T17:47:19.077Z', + timestamp: '2019-01-28T17:47:19.077Z', http: { response: { status_code: 200 } }, monitor: { duration: { us: 287543 }, @@ -202,7 +202,6 @@ describe('PingList component', () => { "2019-01-28T17:47:08.078Z": { "status": "down", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:08.078Z", } } />, @@ -236,12 +236,11 @@ describe('PingList component', () => { const pingB = pings[1]; toggleDetails(pingA, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); toggleDetails(pingB, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); - expect(pingA['@timestamp']).not.toEqual(pingB['@timestamp']); - expect(itemIdToExpandedRowMap[pingB['@timestamp']]).toMatchInlineSnapshot(` + expect(pingA.timestamp).not.toEqual(pingB.timestamp); + expect(itemIdToExpandedRowMap[pingB.timestamp]).toMatchInlineSnapshot(` { "status": "down", "type": "tcp", }, + "timestamp": "2019-01-28T17:47:09.075Z", } } /> diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index cf8c2ef64cba30..2f4c7bb8a3ebfa 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -42,8 +42,8 @@ export const toggleDetails = ( setExpandedRows: (update: Record) => any ) => { // If already expanded, collapse - if (expandedRows[ping['@timestamp']]) { - delete expandedRows[ping['@timestamp']]; + if (expandedRows[ping.timestamp]) { + delete expandedRows[ping.timestamp]; setExpandedRows({ ...expandedRows }); return; } @@ -51,7 +51,7 @@ export const toggleDetails = ( // Otherwise expand this row setExpandedRows({ ...expandedRows, - [ping['@timestamp']]: , + [ping.timestamp]: , }); }; @@ -152,7 +152,7 @@ export const PingListComponent = (props: Props) => { defaultMessage: 'Status', }), render: (pingStatus: string, item: Ping) => ( -
+
{pingStatus === 'up' ? i18n.translate('xpack.uptime.pingList.statusColumnHealthUpLabel', { @@ -164,7 +164,7 @@ export const PingListComponent = (props: Props) => { {i18n.translate('xpack.uptime.pingList.recencyMessage', { - values: { fromNow: moment(item['@timestamp']).fromNow() }, + values: { fromNow: moment(item.timestamp).fromNow() }, defaultMessage: 'Checked {fromNow}', description: 'A string used to inform our users how long ago Heartbeat pinged the selected host.', @@ -240,13 +240,13 @@ export const PingListComponent = (props: Props) => { onClick={() => toggleDetails(item, expandedRows, setExpandedRows)} disabled={!item.error && !(item.http?.response?.body?.bytes ?? 0 > 0)} aria-label={ - expandedRows[item['@timestamp']] + expandedRows[item.timestamp] ? i18n.translate('xpack.uptime.pingList.collapseRow', { defaultMessage: 'Collapse', }) : i18n.translate('xpack.uptime.pingList.expandRow', { defaultMessage: 'Expand' }) } - iconType={expandedRows[item['@timestamp']] ? 'arrowUp' : 'arrowDown'} + iconType={expandedRows[item.timestamp] ? 'arrowUp' : 'arrowDown'} /> ); }, @@ -323,7 +323,7 @@ export const PingListComponent = (props: Props) => { isExpandable={true} hasActions={true} items={pings} - itemId="@timestamp" + itemId="timestamp" itemIdToExpandedRowMap={expandedRows} pagination={pagination} onChange={(criteria: any) => { 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 7161629b14daa1..00f393ffe515df 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 @@ -80,9 +80,10 @@ describe('getLatestMonitor', () => { "status": "down", "type": "http", }, + "timestamp": "123456", } `); - expect(result['@timestamp']).toBe('123456'); + expect(result.timestamp).toBe('123456'); expect(result.monitor).not.toBeFalsy(); expect(result?.monitor?.id).toBe('testMonitor'); expect(mockEsClient).toHaveBeenCalledWith('search', expectedGetLatestSearchParams); diff --git a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts index 3a74a43170e040..fcf773db23de67 100644 --- a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_pings.test.ts @@ -66,7 +66,7 @@ describe('getAll', () => { body: { query: { bool: { - filter: [{ range: { '@timestamp': { gte: 'now-1h', lte: 'now' } } }], + filter: [{ range: { timestamp: { gte: 'now-1h', lte: 'now' } } }], }, }, aggregations: { @@ -78,7 +78,7 @@ describe('getAll', () => { }, }, }, - sort: [{ '@timestamp': { order: 'desc' } }], + sort: [{ timestamp: { order: 'desc' } }], }, }; }); @@ -99,9 +99,9 @@ describe('getAll', () => { const pings = result.pings!; expect(pings).toHaveLength(count); - expect(pings[0]['@timestamp']).toBe('2018-10-30T18:51:59.792Z'); - expect(pings[1]['@timestamp']).toBe('2018-10-30T18:53:59.792Z'); - expect(pings[2]['@timestamp']).toBe('2018-10-30T18:55:59.792Z'); + expect(pings[0].timestamp).toBe('2018-10-30T18:51:59.792Z'); + expect(pings[1].timestamp).toBe('2018-10-30T18:53:59.792Z'); + expect(pings[2].timestamp).toBe('2018-10-30T18:55:59.792Z'); expect(mockEsClient).toHaveBeenCalledTimes(1); }); @@ -115,7 +115,7 @@ describe('getAll', () => { sort: 'asc', size: 12, }); - set(expectedGetAllParams, 'body.sort[0]', { '@timestamp': { order: 'asc' } }); + set(expectedGetAllParams, 'body.sort[0]', { timestamp: { order: 'asc' } }); expect(mockEsClient).toHaveBeenCalledTimes(1); expect(mockEsClient.mock.calls[0]).toMatchInlineSnapshot(` 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 a47203b7db3083..b7cdb0c592fceb 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 @@ -55,8 +55,9 @@ export const getLatestMonitor: UMElasticsearchQueryFn = a httpBody.content_bytes = Buffer.byteLength(httpBody.content); } - return _source; + return { ..._source, timestamp: _source['@timestamp'] }; }); const decoded = PingsResponseType.decode({ diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json index 7f2dfcb40ff9d8..dca3bc546d64d1 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json @@ -20,5 +20,6 @@ "domain": "localhost", "query": "r=200x1", "full": "http://localhost:5678/pattern?r=200x1" - } + }, + "timestamp": "2019-09-11T03:40:34.371Z" } diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts index e3662fe718557d..a261763d5991f9 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts @@ -132,7 +132,7 @@ export default function({ getService }: FtrProviderContext) { expect(total).to.be(20); expect(locations).to.eql(['mpls']); pings.forEach(({ monitor: { id } }) => expect(id).to.eql('0001-up')); - expect(pings.map(({ '@timestamp': timestamp }) => timestamp)).to.eql([ + expect(pings.map(({ timestamp }) => timestamp)).to.eql([ '2019-09-11T03:40:34.371Z', '2019-09-11T03:40:04.370Z', '2019-09-11T03:39:34.370Z', @@ -166,7 +166,7 @@ export default function({ getService }: FtrProviderContext) { expect(total).to.be(20); expect(locations).to.eql(['mpls']); - expect(pings.map(({ '@timestamp': timestamp }) => timestamp)).to.eql([ + expect(pings.map(({ timestamp }) => timestamp)).to.eql([ '2019-09-11T03:31:04.380Z', '2019-09-11T03:31:34.366Z', '2019-09-11T03:32:04.372Z', From 70ecdfa298ece6739ae4eac478ab2ba0ee9a611b Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 13 Apr 2020 13:28:22 -0400 Subject: [PATCH 33/36] Fix broken type and key pings list table on document ID instead of timestamp. --- .../uptime/common/runtime_types/ping/ping.ts | 3 ++- .../functional/ping_list/ping_list.tsx | 14 +++++++------- .../server/lib/requests/get_latest_monitor.ts | 14 +++++--------- .../uptime/server/lib/requests/get_pings.ts | 16 +++++----------- 4 files changed, 19 insertions(+), 28 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts index f32a411b7d23a9..ee14b298f38104 100644 --- a/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts +++ b/x-pack/legacy/plugins/uptime/common/runtime_types/ping/ping.ts @@ -49,6 +49,7 @@ export const PingType = t.intersection([ t.type({ timestamp: t.string, monitor: MonitorType, + docId: t.string, }), t.partial({ agent: t.intersection([ @@ -134,7 +135,7 @@ export const PingType = t.intersection([ down: t.number, up: t.number, }), - tags: t.string, + tags: t.array(t.string), tcp: t.partial({ rtt: t.partial({ connect: t.partial({ diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx index 2f4c7bb8a3ebfa..934dfd961f9e08 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/ping_list.tsx @@ -42,8 +42,8 @@ export const toggleDetails = ( setExpandedRows: (update: Record) => any ) => { // If already expanded, collapse - if (expandedRows[ping.timestamp]) { - delete expandedRows[ping.timestamp]; + if (expandedRows[ping.docId]) { + delete expandedRows[ping.docId]; setExpandedRows({ ...expandedRows }); return; } @@ -51,7 +51,7 @@ export const toggleDetails = ( // Otherwise expand this row setExpandedRows({ ...expandedRows, - [ping.timestamp]: , + [ping.docId]: , }); }; @@ -152,7 +152,7 @@ export const PingListComponent = (props: Props) => { defaultMessage: 'Status', }), render: (pingStatus: string, item: Ping) => ( -
+
{pingStatus === 'up' ? i18n.translate('xpack.uptime.pingList.statusColumnHealthUpLabel', { @@ -240,13 +240,13 @@ export const PingListComponent = (props: Props) => { onClick={() => toggleDetails(item, expandedRows, setExpandedRows)} disabled={!item.error && !(item.http?.response?.body?.bytes ?? 0 > 0)} aria-label={ - expandedRows[item.timestamp] + expandedRows[item.docId] ? i18n.translate('xpack.uptime.pingList.collapseRow', { defaultMessage: 'Collapse', }) : i18n.translate('xpack.uptime.pingList.expandRow', { defaultMessage: 'Expand' }) } - iconType={expandedRows[item.timestamp] ? 'arrowUp' : 'arrowDown'} + iconType={expandedRows[item.docId] ? 'arrowUp' : 'arrowDown'} /> ); }, @@ -323,7 +323,7 @@ export const PingListComponent = (props: Props) => { isExpandable={true} hasActions={true} items={pings} - itemId="timestamp" + itemId="docId" itemIdToExpandedRowMap={expandedRows} pagination={pagination} onChange={(criteria: any) => { 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 b7cdb0c592fceb..a8e9ccb875a08c 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 @@ -4,10 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { isRight } from 'fp-ts/lib/Either'; -import { PathReporter } from 'io-ts/lib/PathReporter'; import { UMElasticsearchQueryFn } from '../adapters'; -import { PingType, Ping } from '../../../../../legacy/plugins/uptime/common/runtime_types'; +import { Ping } from '../../../../../legacy/plugins/uptime/common/runtime_types'; export interface GetLatestMonitorParams { /** @member dateRangeStart timestamp bounds */ @@ -55,11 +53,9 @@ export const getLatestMonitor: UMElasticsearchQueryFn = a const locations = aggs?.locations ?? { buckets: [{ key: 'N/A', doc_count: 0 }] }; - const pings: Ping[] = hits.map(({ _source }: any) => { + const pings: Ping[] = hits.map((doc: any) => { + const { _id, _source } = doc; // Calculate here the length of the content string in bytes, this is easier than in client JS, where // we don't have access to Buffer.byteLength. There are some hacky ways to do this in the // client but this is cleaner. @@ -84,16 +82,12 @@ export const getPings: UMElasticsearchQueryFn = a httpBody.content_bytes = Buffer.byteLength(httpBody.content); } - return { ..._source, timestamp: _source['@timestamp'] }; + return { ..._source, timestamp: _source['@timestamp'], docId: _id }; }); - const decoded = PingsResponseType.decode({ + return { total: total.value, locations: locations.buckets.map((bucket: { key: string }) => bucket.key), pings, - }); - if (isRight(decoded)) { - return decoded.right; - } - throw new Error(JSON.stringify(PathReporter.report(decoded))); + }; }; From e7904dc584f1e80c47b149b98073c55449a4966c Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 13 Apr 2020 14:52:27 -0400 Subject: [PATCH 34/36] Fix broken unit tests. --- .../__snapshots__/ping_list.test.tsx.snap | 12 +++++++++++- .../ping_list/__tests__/ping_list.test.tsx | 18 +++++++++++++++--- .../__tests__/get_latest_monitor.test.ts | 2 ++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap index 58ab89f5497ab0..154ab6399452d6 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/__snapshots__/ping_list.test.tsx.snap @@ -141,11 +141,12 @@ exports[`PingList component renders sorted list without errors 1`] = ` } hasActions={true} isExpandable={true} - itemId="timestamp" + itemId="docId" itemIdToExpandedRowMap={Object {}} items={ Array [ Object { + "docId": "fewjio21", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -163,6 +164,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:08.078Z", }, Object { + "docId": "fewjoo21", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -180,6 +182,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:09.075Z", }, Object { + "docId": "fejjio21", "monitor": Object { "duration": Object { "us": 1452, @@ -193,6 +196,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:06.077Z", }, Object { + "docId": "fewzio21", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -210,6 +214,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:07.075Z", }, Object { + "docId": "fewpi321", "error": Object { "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", "type": "io", @@ -227,6 +232,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:07.074Z", }, Object { + "docId": "0ewjio21", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -244,6 +250,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:18.080Z", }, Object { + "docId": "3ewjio21", "error": Object { "message": "dial tcp 127.0.0.1:9200: connect: connection refused", "type": "io", @@ -261,6 +268,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:19.076Z", }, Object { + "docId": "fewjip21", "error": Object { "message": "Get http://localhost:12349/: dial tcp 127.0.0.1:12349: connect: connection refused", "type": "io", @@ -278,6 +286,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:19.076Z", }, Object { + "docId": "fewjio21", "http": Object { "response": Object { "status_code": 200, @@ -296,6 +305,7 @@ exports[`PingList component renders sorted list without errors 1`] = ` "timestamp": "2019-01-28T17:47:19.077Z", }, Object { + "docId": "fewjik81", "http": Object { "response": Object { "status_code": 200, diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx index c60ec6b6b4fa7f..ec256a886aa16b 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/ping_list.test.tsx @@ -19,6 +19,7 @@ describe('PingList component', () => { locations: ['nyc'], pings: [ { + docId: 'fewjio21', timestamp: '2019-01-28T17:47:08.078Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', @@ -34,6 +35,7 @@ describe('PingList component', () => { }, }, { + docId: 'fewjoo21', timestamp: '2019-01-28T17:47:09.075Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', @@ -49,6 +51,7 @@ describe('PingList component', () => { }, }, { + docId: 'fejjio21', timestamp: '2019-01-28T17:47:06.077Z', monitor: { duration: { us: 1452 }, @@ -60,6 +63,7 @@ describe('PingList component', () => { }, }, { + docId: 'fewzio21', timestamp: '2019-01-28T17:47:07.075Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', @@ -75,6 +79,7 @@ describe('PingList component', () => { }, }, { + docId: 'fewpi321', timestamp: '2019-01-28T17:47:07.074Z', error: { message: @@ -91,6 +96,7 @@ describe('PingList component', () => { }, }, { + docId: '0ewjio21', timestamp: '2019-01-28T17:47:18.080Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', @@ -106,6 +112,7 @@ describe('PingList component', () => { }, }, { + docId: '3ewjio21', timestamp: '2019-01-28T17:47:19.076Z', error: { message: 'dial tcp 127.0.0.1:9200: connect: connection refused', @@ -121,6 +128,7 @@ describe('PingList component', () => { }, }, { + docId: 'fewjip21', timestamp: '2019-01-28T17:47:19.076Z', error: { message: @@ -137,6 +145,7 @@ describe('PingList component', () => { }, }, { + docId: 'fewjio21', timestamp: '2019-01-28T17:47:19.077Z', http: { response: { status_code: 200 } }, monitor: { @@ -149,6 +158,7 @@ describe('PingList component', () => { }, }, { + docId: 'fewjik81', timestamp: '2019-01-28T17:47:19.077Z', http: { response: { status_code: 200 } }, monitor: { @@ -199,9 +209,10 @@ describe('PingList component', () => { toggleDetails(ping, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); expect(itemIdToExpandedRowMap).toMatchInlineSnapshot(` Object { - "2019-01-28T17:47:08.078Z": { const pingB = pings[1]; toggleDetails(pingA, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); toggleDetails(pingB, itemIdToExpandedRowMap, setItemIdToExpandedRowMap); - expect(pingA.timestamp).not.toEqual(pingB.timestamp); - expect(itemIdToExpandedRowMap[pingB.timestamp]).toMatchInlineSnapshot(` + expect(pingA.docId).not.toEqual(pingB.docId); + expect(itemIdToExpandedRowMap[pingB.docId]).toMatchInlineSnapshot(` { hits: { hits: [ { + _id: 'fejwio32', _source: { '@timestamp': '123456', monitor: { @@ -72,6 +73,7 @@ describe('getLatestMonitor', () => { expect(result).toMatchInlineSnapshot(` Object { "@timestamp": "123456", + "docId": "fejwio32", "monitor": Object { "duration": Object { "us": 12345, From c1aea4ac1e463929d06eb7bafee16e202cf8344b Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 13 Apr 2020 15:22:14 -0400 Subject: [PATCH 35/36] Fix broken tests and types. --- .../monitor_status_details/__test__/monitor_status.bar.test.tsx | 1 + .../functional/ping_list/__tests__/expanded_row.test.tsx | 1 + x-pack/legacy/plugins/uptime/public/hooks/index.ts | 1 + .../apis/uptime/rest/fixtures/monitor_latest_status.json | 1 + 4 files changed, 4 insertions(+) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx index 01f8d848edc466..5fd32c808da42c 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_status_details/__test__/monitor_status.bar.test.tsx @@ -16,6 +16,7 @@ describe('MonitorStatusBar component', () => { beforeEach(() => { monitorStatus = { + docId: 'few213kl', timestamp: moment(new Date()) .subtract(15, 'm') .toString(), diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx index 038721d8900722..2c1434cfd64bd5 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list/__tests__/expanded_row.test.tsx @@ -14,6 +14,7 @@ describe('PingListExpandedRow', () => { let ping: Ping; beforeEach(() => { ping = { + docId: 'fdeio12', timestamp: '19290310', monitor: { duration: { diff --git a/x-pack/legacy/plugins/uptime/public/hooks/index.ts b/x-pack/legacy/plugins/uptime/public/hooks/index.ts index e022248df407a7..1f50e995eda495 100644 --- a/x-pack/legacy/plugins/uptime/public/hooks/index.ts +++ b/x-pack/legacy/plugins/uptime/public/hooks/index.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +export * from './use_monitor'; export * from './use_url_params'; export * from './use_telemetry'; export * from './update_kuery_string'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json index dca3bc546d64d1..6a832ad8536f7f 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json @@ -21,5 +21,6 @@ "query": "r=200x1", "full": "http://localhost:5678/pattern?r=200x1" }, + "docId": "h5toHm0B0I9WX_CznN_V", "timestamp": "2019-09-11T03:40:34.371Z" } From 46f856e2973b841aba7d72977953c1a73d77f254 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 13 Apr 2020 16:33:36 -0400 Subject: [PATCH 36/36] Fix broken functional test. --- x-pack/test/functional/apps/uptime/monitor.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/x-pack/test/functional/apps/uptime/monitor.ts b/x-pack/test/functional/apps/uptime/monitor.ts index 4ec64a06cd90ff..388d660f21eb3a 100644 --- a/x-pack/test/functional/apps/uptime/monitor.ts +++ b/x-pack/test/functional/apps/uptime/monitor.ts @@ -35,16 +35,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('displays ping data as expected', async () => { await uptime.checkPingListInteractions( [ - '2019-09-11T03:40:34.371Z', - '2019-09-11T03:40:04.370Z', - '2019-09-11T03:39:34.370Z', - '2019-09-11T03:39:04.370Z', - '2019-09-11T03:38:34.370Z', - '2019-09-11T03:38:04.370Z', - '2019-09-11T03:37:34.370Z', - '2019-09-11T03:37:04.371Z', - '2019-09-11T03:36:34.370Z', - '2019-09-11T03:36:04.370Z', + 'XZtoHm0B0I9WX_CznN-6', + '7ZtoHm0B0I9WX_CzJ96M', + 'pptnHm0B0I9WX_Czst5X', + 'I5tnHm0B0I9WX_CzPd46', + 'y5tmHm0B0I9WX_Czx93x', + 'XZtmHm0B0I9WX_CzUt3H', + '-JtlHm0B0I9WX_Cz3dyX', + 'k5tlHm0B0I9WX_CzaNxm', + 'NZtkHm0B0I9WX_Cz89w9', + 'zJtkHm0B0I9WX_CzftsN', ], 'mpls', 'up'