From 07801ba8ee347c64f210d70e6a9992ec77578916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Louv-Jansen?= Date: Fri, 9 Nov 2018 16:07:15 +0100 Subject: [PATCH] Typescript migration --- package.json | 3 +- src/ui/public/kfetch/index.ts | 2 +- src/ui/public/kfetch/kfetch.ts | 2 +- .../app/TransactionDetails/view.tsx | 4 +- .../CustomPlot/test/responseWithData.json | 11 +- ...onStorageMock.js => SessionStorageMock.ts} | 12 +- .../{callApi.test.js => callApi.test.ts} | 5 +- .../plugins/apm/public/services/rest/apm.ts | 2 +- .../services/rest/{callApi.js => callApi.ts} | 8 +- .../public/store/mockData/mockTraceList.json | 30 - ...Charts.js => transactionDetailsCharts.tsx} | 32 +- ...harts.js => transactionOverviewCharts.tsx} | 29 +- ...st.js.snap => chartSelectors.test.ts.snap} | 0 ...lectors.test.js => chartSelectors.test.ts} | 23 +- .../{chartSelectors.js => chartSelectors.ts} | 120 +- x-pack/plugins/apm/public/store/urlParams.ts | 4 +- .../get_bucket_size/{index.js => index.ts} | 26 +- .../apm/server/lib/helpers/setup_request.ts | 9 +- .../__test__/get_timeseries_data.test.js | 63 - .../response_time_anomaly_response.json | 1175 ------- .../charts/__test__/timeseries_response.json | 2821 ---------------- ..._with_initial_anomaly_bounds.test.ts.snap} | 0 .../__test__/get_anomaly_aggs.test.ts | 6 +- ...> get_avg_response_time_anomalies.test.ts} | 16 +- ...ckets_with_initial_anomaly_bounds.test.ts} | 8 +- ...et_anomaly_aggs.js => get_anomaly_aggs.ts} | 45 +- ....js => get_avg_response_time_anomalies.ts} | 33 +- ...et_buckets_with_initial_anomaly_bounds.ts} | 31 +- .../get_timeseries_data.test.ts.snap} | 168 +- .../__test__/get_timeseries_data.test.ts | 127 + .../response_time_anomaly_response.ts | 1180 +++++++ .../__test__/timeseries_response.ts | 2827 +++++++++++++++++ .../get_timeseries_data.ts} | 204 +- .../plugins/apm/server/routes/transactions.ts | 2 +- x-pack/plugins/apm/typings/lodash.mean.d.ts | 10 + yarn.lock | 216 +- 36 files changed, 4657 insertions(+), 4597 deletions(-) rename x-pack/plugins/apm/public/services/__test__/{SessionStorageMock.js => SessionStorageMock.ts} (65%) rename x-pack/plugins/apm/public/services/__test__/{callApi.test.js => callApi.test.ts} (98%) rename x-pack/plugins/apm/public/services/rest/{callApi.js => callApi.ts} (86%) delete mode 100644 x-pack/plugins/apm/public/store/mockData/mockTraceList.json rename x-pack/plugins/apm/public/store/reactReduxRequest/{transactionDetailsCharts.js => transactionDetailsCharts.tsx} (64%) rename x-pack/plugins/apm/public/store/reactReduxRequest/{transactionOverviewCharts.js => transactionOverviewCharts.tsx} (69%) rename x-pack/plugins/apm/public/store/selectors/__tests__/__snapshots__/{chartSelectors.test.js.snap => chartSelectors.test.ts.snap} (100%) rename x-pack/plugins/apm/public/store/selectors/__tests__/{chartSelectors.test.js => chartSelectors.test.ts} (88%) rename x-pack/plugins/apm/public/store/selectors/{chartSelectors.js => chartSelectors.ts} (62%) rename x-pack/plugins/apm/server/lib/helpers/get_bucket_size/{index.js => index.ts} (58%) delete mode 100644 x-pack/plugins/apm/server/lib/transactions/charts/__test__/get_timeseries_data.test.js delete mode 100644 x-pack/plugins/apm/server/lib/transactions/charts/__test__/response_time_anomaly_response.json delete mode 100644 x-pack/plugins/apm/server/lib/transactions/charts/__test__/timeseries_response.json rename x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/__snapshots__/{get_buckets_with_initial_anomaly_bounds.test.js.snap => get_buckets_with_initial_anomaly_bounds.test.ts.snap} (100%) rename x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/{get_avg_response_time_anomalies.test.js => get_avg_response_time_anomalies.test.ts} (79%) rename x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/{get_buckets_with_initial_anomaly_bounds.test.js => get_buckets_with_initial_anomaly_bounds.test.ts} (88%) rename x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/{get_anomaly_aggs.js => get_anomaly_aggs.ts} (66%) rename x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/{get_avg_response_time_anomalies.js => get_avg_response_time_anomalies.ts} (79%) rename x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/{get_buckets_with_initial_anomaly_bounds.js => get_buckets_with_initial_anomaly_bounds.ts} (67%) rename x-pack/plugins/apm/server/lib/transactions/charts/{__test__/__snapshots__/get_timeseries_data.test.js.snap => get_timeseries_data/__test__/__snapshots__/get_timeseries_data.test.ts.snap} (89%) create mode 100644 x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/get_timeseries_data.test.ts create mode 100644 x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/response_time_anomaly_response.ts create mode 100644 x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/timeseries_response.ts rename x-pack/plugins/apm/server/lib/transactions/charts/{get_timeseries_data.js => get_timeseries_data/get_timeseries_data.ts} (50%) create mode 100644 x-pack/plugins/apm/typings/lodash.mean.d.ts diff --git a/package.json b/package.json index bb04bc804fcc8..b56a62fec150e 100644 --- a/package.json +++ b/package.json @@ -244,7 +244,7 @@ "@types/boom": "^7.2.0", "@types/chance": "^1.0.0", "@types/classnames": "^2.2.3", - "@types/d3": "^5.0.0", + "@types/d3": "^3.5.41", "@types/dedent": "^0.7.0", "@types/del": "^3.0.1", "@types/elasticsearch": "^5.0.26", @@ -258,6 +258,7 @@ "@types/hapi": "^17.0.18", "@types/has-ansi": "^3.0.0", "@types/hoek": "^4.1.3", + "@types/humps": "^1.1.2", "@types/jest": "^23.3.1", "@types/joi": "^13.4.2", "@types/jquery": "^3.3.6", diff --git a/src/ui/public/kfetch/index.ts b/src/ui/public/kfetch/index.ts index 1b0861da9fc1b..f871d97f0fd54 100644 --- a/src/ui/public/kfetch/index.ts +++ b/src/ui/public/kfetch/index.ts @@ -17,5 +17,5 @@ * under the License. */ -export { kfetch, addInterceptor } from './kfetch'; +export { kfetch, addInterceptor, KFetchOptions } from './kfetch'; export { kfetchAbortable } from './kfetch_abortable'; diff --git a/src/ui/public/kfetch/kfetch.ts b/src/ui/public/kfetch/kfetch.ts index 2d93c89f57d2b..06edae2d9e756 100644 --- a/src/ui/public/kfetch/kfetch.ts +++ b/src/ui/public/kfetch/kfetch.ts @@ -26,7 +26,7 @@ import chrome from '../chrome'; import { KFetchError } from './kfetch_error'; interface KFetchQuery { - [key: string]: string | number | boolean; + [key: string]: string | number | boolean | undefined; } export interface KFetchOptions extends RequestInit { diff --git a/x-pack/plugins/apm/public/components/app/TransactionDetails/view.tsx b/x-pack/plugins/apm/public/components/app/TransactionDetails/view.tsx index 2f7c5a64a37cd..e21de6418e517 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionDetails/view.tsx +++ b/x-pack/plugins/apm/public/components/app/TransactionDetails/view.tsx @@ -6,9 +6,7 @@ import { EuiSpacer } from '@elastic/eui'; import React from 'react'; -import { RRRRenderResponse } from 'react-redux-request'; import { TransactionDetailsRequest } from '../../../store/reactReduxRequest/transactionDetails'; -// @ts-ignore import { TransactionDetailsChartsRequest } from '../../../store/reactReduxRequest/transactionDetailsCharts'; import { TransactionDistributionRequest } from '../../../store/reactReduxRequest/transactionDistribution'; import { WaterfallRequest } from '../../../store/reactReduxRequest/waterfall'; @@ -39,7 +37,7 @@ export function TransactionDetailsView({ urlParams, location }: Props) { ) => ( + render={({ data }) => ( { - let kfetchSpy; + let kfetchSpy: jest.Mock; beforeEach(() => { kfetchSpy = jest.spyOn(kfetchModule, 'kfetch').mockResolvedValue({ my_key: 'hello world' }); + // @ts-ignore global.sessionStorage = new SessionStorageMock(); }); diff --git a/x-pack/plugins/apm/public/services/rest/apm.ts b/x-pack/plugins/apm/public/services/rest/apm.ts index d065be4fa28a2..03a9527e1d233 100644 --- a/x-pack/plugins/apm/public/services/rest/apm.ts +++ b/x-pack/plugins/apm/public/services/rest/apm.ts @@ -291,7 +291,7 @@ export async function loadErrorGroupDetails({ camelcase: false } ); - const camelizedRes = camelizeKeys(res); + const camelizedRes: any = camelizeKeys(res); if (res.error.context) { camelizedRes.error.context = res.error.context; } diff --git a/x-pack/plugins/apm/public/services/rest/callApi.js b/x-pack/plugins/apm/public/services/rest/callApi.ts similarity index 86% rename from x-pack/plugins/apm/public/services/rest/callApi.js rename to x-pack/plugins/apm/public/services/rest/callApi.ts index d33bea0644d5d..257cb078a352f 100644 --- a/x-pack/plugins/apm/public/services/rest/callApi.js +++ b/x-pack/plugins/apm/public/services/rest/callApi.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import 'isomorphic-fetch'; import { camelizeKeys } from 'humps'; -import { kfetch } from 'ui/kfetch'; +import 'isomorphic-fetch'; import { startsWith } from 'lodash'; +import { kfetch, KFetchOptions } from 'ui/kfetch'; -function fetchOptionsWithDebug(fetchOptions) { +function fetchOptionsWithDebug(fetchOptions: KFetchOptions) { const debugEnabled = sessionStorage.getItem('apm_debug') === 'true' && startsWith(fetchOptions.pathname, '/api/apm'); @@ -28,7 +28,7 @@ function fetchOptionsWithDebug(fetchOptions) { } export async function callApi( - fetchOptions, + fetchOptions: KFetchOptions, { camelcase = true, prependBasePath = true } = {} ) { const combinedFetchOptions = fetchOptionsWithDebug(fetchOptions); diff --git a/x-pack/plugins/apm/public/store/mockData/mockTraceList.json b/x-pack/plugins/apm/public/store/mockData/mockTraceList.json deleted file mode 100644 index 4e97a030a2621..0000000000000 --- a/x-pack/plugins/apm/public/store/mockData/mockTraceList.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "name": "log", - "serviceName": "flask-server", - "averageResponseTime": 1329, - "tracesPerMinute": 3201, - "impact": 70 - }, - { - "name": "products/item", - "serviceName": "client", - "averageResponseTime": 2301, - "tracesPerMinute": 5432, - "impact": 42 - }, - { - "name": "billing/payment", - "serviceName": "client", - "averageResponseTime": 789, - "tracesPerMinute": 1201, - "impact": 14 - }, - { - "name": "user/profile", - "serviceName": "client", - "averageResponseTime": 1212, - "tracesPerMinute": 904, - "impact": 92 - } -] diff --git a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.js b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.tsx similarity index 64% rename from x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.js rename to x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.tsx index 484555bf86328..b1e466d5e1fe1 100644 --- a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.js +++ b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.tsx @@ -5,36 +5,44 @@ */ import React from 'react'; +import { Request, RRRRender } from 'react-redux-request'; import { createSelector } from 'reselect'; -import { getCharts } from '../selectors/chartSelectors'; -import { getUrlParams } from '../urlParams'; -import { Request } from 'react-redux-request'; +import { TimeSeriesResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/get_timeseries_data'; import { loadCharts } from '../../services/rest/apm'; -import { createInitialDataSelector } from './helpers'; +import { IReduxState } from '../rootReducer'; +import { getCharts } from '../selectors/chartSelectors'; +import { getUrlParams, IUrlParams } from '../urlParams'; const ID = 'transactionDetailsCharts'; const INITIAL_DATA = { totalHits: 0, dates: [], - responseTimes: {}, + responseTimes: { + avg: [], + p95: [], + p99: [] + }, tpmBuckets: [], - overallAvgDuration: null + overallAvgDuration: undefined }; -const withInitialData = createInitialDataSelector(INITIAL_DATA); - export const getTransactionDetailsCharts = createSelector( getUrlParams, - state => withInitialData(state.reactReduxRequest[ID]), - (urlParams, detailCharts) => { + (state: IReduxState) => state.reactReduxRequest[ID], + (urlParams, detailCharts = {}) => { return { ...detailCharts, - data: getCharts(urlParams, detailCharts.data) + data: getCharts(urlParams, detailCharts.data || INITIAL_DATA) }; } ); -export function TransactionDetailsChartsRequest({ urlParams, render }) { +interface Props { + urlParams: IUrlParams; + render: RRRRender; +} + +export function TransactionDetailsChartsRequest({ urlParams, render }: Props) { const { serviceName, start, diff --git a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.js b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.tsx similarity index 69% rename from x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.js rename to x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.tsx index a5313c7efda10..a1ecb09c5f2c1 100644 --- a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.js +++ b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.tsx @@ -4,26 +4,32 @@ * you may not use this file except in compliance with the Elastic License. */ +import { get, isEmpty } from 'lodash'; import React from 'react'; +import { Request, RRRRender } from 'react-redux-request'; import { createSelector } from 'reselect'; -import { get, isEmpty } from 'lodash'; -import { getCharts } from '../selectors/chartSelectors'; -import { getUrlParams } from '../urlParams'; -import { Request } from 'react-redux-request'; +import { TimeSeriesResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/get_timeseries_data'; import { loadCharts } from '../../services/rest/apm'; +import { IReduxState } from '../rootReducer'; +import { getCharts } from '../selectors/chartSelectors'; +import { getUrlParams, IUrlParams } from '../urlParams'; const ID = 'transactionOverviewCharts'; const INITIAL_DATA = { totalHits: 0, dates: [], - responseTimes: {}, + responseTimes: { + avg: [], + p95: [], + p99: [] + }, tpmBuckets: [], - overallAvgDuration: null + overallAvgDuration: undefined }; export const getTransactionOverviewCharts = createSelector( getUrlParams, - state => state.reactReduxRequest[ID], + (state: IReduxState) => state.reactReduxRequest[ID], (urlParams, overviewCharts = {}) => { return { ...overviewCharts, @@ -32,7 +38,7 @@ export const getTransactionOverviewCharts = createSelector( } ); -export function hasDynamicBaseline(state) { +export function hasDynamicBaseline(state: IReduxState) { return !isEmpty( get( state, @@ -41,7 +47,12 @@ export function hasDynamicBaseline(state) { ); } -export function TransactionOverviewChartsRequest({ urlParams, render }) { +interface Props { + urlParams: IUrlParams; + render: RRRRender; +} + +export function TransactionOverviewChartsRequest({ urlParams, render }: Props) { const { serviceName, start, end, transactionType, kuery } = urlParams; if (!(serviceName && start && end && transactionType)) { diff --git a/x-pack/plugins/apm/public/store/selectors/__tests__/__snapshots__/chartSelectors.test.js.snap b/x-pack/plugins/apm/public/store/selectors/__tests__/__snapshots__/chartSelectors.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/public/store/selectors/__tests__/__snapshots__/chartSelectors.test.js.snap rename to x-pack/plugins/apm/public/store/selectors/__tests__/__snapshots__/chartSelectors.test.ts.snap diff --git a/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.js b/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.ts similarity index 88% rename from x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.js rename to x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.ts index 1850fd990c957..c59dff1c3aaf6 100644 --- a/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.js +++ b/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.ts @@ -5,12 +5,16 @@ */ import { + getAnomalyBoundaryValues, getAnomalyScoreValues, getResponseTimeSeries, - getTpmSeries, - getAnomalyBoundaryValues + getTpmSeries } from '../chartSelectors'; +import { + AvgAnomalyBuckets, + TimeSeriesResponse +} from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/get_timeseries_data'; import anomalyData from './mockData/anomalyData.json'; describe('chartSelectors', () => { @@ -39,7 +43,7 @@ describe('chartSelectors', () => { { anomalyScore: 0 } - ]; + ] as AvgAnomalyBuckets[]; expect(getAnomalyScoreValues(dates, buckets, 1000)).toEqual([ { x: 1000, y: 1 }, @@ -58,11 +62,10 @@ describe('chartSelectors', () => { responseTimes: { avg: [100, 200, 150, 250, 100, 50], p95: [200, 300, 250, 350, 200, 150], - p99: [300, 400, 350, 450, 100, 50], - avgAnomalies: {} + p99: [300, 400, 350, 450, 100, 50] }, overallAvgDuration: 200 - }; + } as TimeSeriesResponse; it('should match snapshot', () => { expect(getResponseTimeSeries(chartsData)).toMatchSnapshot(); @@ -93,7 +96,7 @@ describe('chartSelectors', () => { values: [0, 1, 2, 1, 0, 2] } ] - }; + } as TimeSeriesResponse; const transactionType = 'MyTransactionType'; @@ -129,9 +132,9 @@ describe('chartSelectors', () => { expect(secondLastBuckets.y).toBe(lastBucket.y); expect(secondLastBuckets.y0).toBe(lastBucket.y0); - expect(lastBucket.x - secondLastBuckets.x).toBeLessThanOrEqual( - bucketSpan - ); + expect( + (lastBucket.x as number) - (secondLastBuckets.x as number) + ).toBeLessThanOrEqual(bucketSpan); }); }); }); diff --git a/x-pack/plugins/apm/public/store/selectors/chartSelectors.js b/x-pack/plugins/apm/public/store/selectors/chartSelectors.ts similarity index 62% rename from x-pack/plugins/apm/public/store/selectors/chartSelectors.js rename to x-pack/plugins/apm/public/store/selectors/chartSelectors.ts index 534da52262d16..53a54f01da065 100644 --- a/x-pack/plugins/apm/public/store/selectors/chartSelectors.js +++ b/x-pack/plugins/apm/public/store/selectors/chartSelectors.ts @@ -5,10 +5,25 @@ */ import d3 from 'd3'; -import { last, zipObject, difference, memoize, get, isEmpty } from 'lodash'; -import { colors } from '../../style/variables'; -import { asMillis, asDecimal, tpmUnit } from '../../utils/formatters'; +import { difference, last, memoize, zipObject } from 'lodash'; import { rgba } from 'polished'; +import { + AvgAnomalyBuckets, + TimeSeriesResponse +} from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/get_timeseries_data'; +import { StringMap } from 'x-pack/plugins/apm/typings/common'; +import { colors } from '../../style/variables'; +import { asDecimal, asMillis, tpmUnit } from '../../utils/formatters'; +import { IUrlParams } from '../urlParams'; + +interface Coordinate { + x: number; + y?: number | null; +} + +interface BoundaryCoordinate extends Coordinate { + y0: number | null; +} export const getEmptySerie = memoize( (start = Date.now() - 3600000, end = Date.now()) => { @@ -26,10 +41,10 @@ export const getEmptySerie = memoize( } ]; }, - (...args) => args.join('_') + (start: number, end: number) => [start, end].join('_') ); -export function getCharts(urlParams, charts) { +export function getCharts(urlParams: IUrlParams, charts: TimeSeriesResponse) { const { start, end, transactionType } = urlParams; const noHits = charts.totalHits === 0; const tpmSeries = noHits @@ -47,11 +62,23 @@ export function getCharts(urlParams, charts) { }; } -export function getResponseTimeSeries(chartsData) { +interface TimeSerie { + title: string; + titleShort?: string; + hideLegend?: boolean; + hideTooltipValue?: boolean; + data: Coordinate[]; + legendValue?: string; + type: string; + color: string; + areaColor?: string; +} + +export function getResponseTimeSeries(chartsData: TimeSeriesResponse) { const { dates, overallAvgDuration } = chartsData; const { avg, p95, p99, avgAnomalies } = chartsData.responseTimes; - const series = [ + const series: TimeSerie[] = [ { title: 'Avg.', data: getChartValues(dates, avg), @@ -75,7 +102,7 @@ export function getResponseTimeSeries(chartsData) { } ]; - if (!isEmpty(avgAnomalies.buckets)) { + if (avgAnomalies) { // insert after Avg. serie series.splice(1, 0, { title: 'Anomaly Boundaries', @@ -109,10 +136,14 @@ export function getResponseTimeSeries(chartsData) { return series; } -export function getTpmSeries(chartsData, transactionType) { +export function getTpmSeries( + chartsData: TimeSeriesResponse, + transactionType?: string +) { const { dates, tpmBuckets } = chartsData; - const getColor = getColorByKey(tpmBuckets.map(({ key }) => key)); - const getTpmLegendTitle = bucketKey => { + const bucketKeys = tpmBuckets.map(({ key }) => key); + const getColor = getColorByKey(bucketKeys); + const getTpmLegendTitle = (bucketKey: string) => { // hide legend text for transactions without "result" if (bucketKey === 'transaction_result_missing') { return ''; @@ -125,15 +156,15 @@ export function getTpmSeries(chartsData, transactionType) { return { title: getTpmLegendTitle(bucket.key), data: getChartValues(dates, bucket.values), - legendValue: `${asDecimal(bucket.avg)} ${tpmUnit(transactionType)}`, + legendValue: `${asDecimal(bucket.avg)} ${tpmUnit(transactionType || '')}`, type: 'line', color: getColor(bucket.key) }; }); } -function getColorByKey(keys) { - const assignedColors = { +function getColorByKey(keys: string[]) { + const assignedColors: StringMap = { 'HTTP 2xx': colors.apmGreen, 'HTTP 3xx': colors.apmYellow, 'HTTP 4xx': colors.apmOrange, @@ -141,7 +172,7 @@ function getColorByKey(keys) { }; const unknownKeys = difference(keys, Object.keys(assignedColors)); - const unassignedColors = zipObject(unknownKeys, [ + const unassignedColors: StringMap = zipObject(unknownKeys, [ colors.apmBlue, colors.apmPurple, colors.apmPink, @@ -150,10 +181,13 @@ function getColorByKey(keys) { colors.apmBrown ]); - return key => assignedColors[key] || unassignedColors[key]; + return (key: string) => assignedColors[key] || unassignedColors[key]; } -function getChartValues(dates = [], buckets = []) { +function getChartValues( + dates: number[] = [], + buckets: Array = [] +) { return dates.map((x, i) => ({ x, y: buckets[i] @@ -161,27 +195,32 @@ function getChartValues(dates = [], buckets = []) { } export function getAnomalyScoreValues( - dates = [], - buckets = [], - bucketSpanAsMillis + dates: number[] = [], + buckets: AvgAnomalyBuckets[] = [], + bucketSpanAsMillis: number ) { const ANOMALY_THRESHOLD = 75; - const getX = (currentX, i) => currentX + bucketSpanAsMillis * i; + const getX = (currentX: number, i: number) => + currentX + bucketSpanAsMillis * i; return dates - .map((x, i) => { - const { anomalyScore } = buckets[i] || {}; + .map((date, i) => { + const { anomalyScore } = buckets[i]; return { - x, + x: date, anomalyScore }; }) - .filter(p => p.anomalyScore > ANOMALY_THRESHOLD) - .reduce((acc, p, i, points) => { - acc.push({ x: p.x, y: 1 }); - const { x: nextX } = points[i + 1] || {}; + .filter(p => { + const res = + p && p.anomalyScore != null && p.anomalyScore > ANOMALY_THRESHOLD; + return res; + }) + .reduce((acc, p, i, points) => { + const nextPoint = points[i + 1] || {}; const endX = getX(p.x, 1); - if (nextX == null || nextX > endX) { + acc.push({ x: p.x, y: 1 }); + if (nextPoint.x == null || nextPoint.x > endX) { acc.push( { x: endX, @@ -198,19 +237,22 @@ export function getAnomalyScoreValues( } export function getAnomalyBoundaryValues( - dates = [], - buckets = [], - bucketSpanAsMillis + dates: number[] = [], + buckets: AvgAnomalyBuckets[] = [], + bucketSpanAsMillis: number ) { const lastX = last(dates); return dates - .map((x, i) => ({ - x, - y0: get(buckets[i], 'lower'), - y: get(buckets[i], 'upper') - })) - .filter(point => point.y != null) - .reduce((acc, p, i, points) => { + .map((date, i) => { + const bucket = buckets[i]; + return { + x: date, + y0: bucket.lower, + y: bucket.upper + }; + }) + .filter(p => p.y != null) + .reduce((acc, p, i, points) => { const isLast = last(points) === p; acc.push(p); diff --git a/x-pack/plugins/apm/public/store/urlParams.ts b/x-pack/plugins/apm/public/store/urlParams.ts index cedcbfe337fee..b0850aa2cf880 100644 --- a/x-pack/plugins/apm/public/store/urlParams.ts +++ b/x-pack/plugins/apm/public/store/urlParams.ts @@ -157,13 +157,13 @@ export const getUrlParams = createSelector( ); export interface IUrlParams { - end?: string; + end?: number; errorGroupId?: string; flyoutDetailTab?: string; detailTab?: string; kuery?: string; serviceName?: string; - start?: string; + start?: number; traceId?: string; transactionId?: string; transactionName?: string; diff --git a/x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.js b/x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.ts similarity index 58% rename from x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.js rename to x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.ts index a7e4319243bc9..5ec0c2b7b2d96 100644 --- a/x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.js +++ b/x-pack/plugins/apm/server/lib/helpers/get_bucket_size/index.ts @@ -4,24 +4,26 @@ * you may not use this file except in compliance with the Elastic License. */ -import { calculateAuto } from './calculate_auto'; import moment from 'moment'; +// @ts-ignore +import { calculateAuto } from './calculate_auto'; +// @ts-ignore import { unitToSeconds } from './unit_to_seconds'; -export function getBucketSize(start, end, interval) { - const duration = moment.duration(end - start, 'ms'); - let bucketSize = calculateAuto.near(100, duration).asSeconds(); - if (bucketSize < 1) bucketSize = 1; // don't go too small - let intervalString = `${bucketSize}s`; +export function getBucketSize(start: number, end: number, interval: string) { + const duration = moment.duration(end - start, 'ms'); + const bucketSize = Math.max(calculateAuto.near(100, duration).asSeconds(), 1); + const intervalString = `${bucketSize}s`; const matches = interval && interval.match(/^([\d]+)([shmdwMy]|ms)$/); - let minBucketSize = 0; - if (matches) { - minBucketSize = Number(matches[1]) * unitToSeconds(matches[2]); - } + const minBucketSize = matches + ? Number(matches[1]) * unitToSeconds(matches[2]) + : 0; if (bucketSize < minBucketSize) { - bucketSize = minBucketSize; - intervalString = interval; + return { + bucketSize: minBucketSize, + intervalString: interval + }; } return { bucketSize, intervalString }; diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts index 70773755c2c78..aeed8aa513651 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.ts @@ -28,13 +28,16 @@ declare module 'hapi' { } } -type Client = (type: string, params: SearchParams) => SearchResponse; +export type ESClient = ( + type: string, + params: SearchParams +) => SearchResponse; export interface Setup { start: number; end: number; - esFilterQuery: any; - client: Client; + esFilterQuery?: any; + client: ESClient; config: KibanaConfig; } diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/get_timeseries_data.test.js b/x-pack/plugins/apm/server/lib/transactions/charts/__test__/get_timeseries_data.test.js deleted file mode 100644 index 36ac9a0aff72e..0000000000000 --- a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/get_timeseries_data.test.js +++ /dev/null @@ -1,63 +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 _ from 'lodash'; -import { getTimeseriesData } from '../get_timeseries_data'; -import timeseriesResponse from './timeseries_response.json'; -import responseTimeAnomalyResponse from './response_time_anomaly_response.json'; - -describe('get_timeseries_data', () => { - let res; - let clientSpy; - beforeEach(async () => { - clientSpy = jest - .fn() - .mockResolvedValueOnce(timeseriesResponse) - .mockResolvedValueOnce(responseTimeAnomalyResponse); - - res = await getTimeseriesData({ - serviceName: 'myServiceName', - transactionType: 'myTransactionType', - transactionName: null, - setup: { - start: 1528113600000, - end: 1528977600000, - client: clientSpy, - config: { - get: () => 'myIndex' - } - } - }); - }); - - it('should call client with correct query', () => { - expect(clientSpy.mock.calls).toMatchSnapshot(); - }); - - it('should not contain first and last bucket', () => { - const mockDates = timeseriesResponse.aggregations.transaction_results.buckets[0].timeseries.buckets.map( - bucket => bucket.key - ); - - expect(res.dates).not.toContain(_.first(mockDates)); - expect(res.dates).not.toContain(_.last(mockDates)); - expect(res.tpm_buckets[0].values).toHaveLength(res.dates.length); - }); - - it('should have correct order', () => { - expect(res.tpm_buckets.map(bucket => bucket.key)).toEqual([ - 'HTTP 2xx', - 'HTTP 3xx', - 'HTTP 4xx', - 'HTTP 5xx', - 'A Custom Bucket (that should be last)' - ]); - }); - - it('should match snapshot', () => { - expect(res).toMatchSnapshot(); - }); -}); diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/response_time_anomaly_response.json b/x-pack/plugins/apm/server/lib/transactions/charts/__test__/response_time_anomaly_response.json deleted file mode 100644 index 8f022a7778e8d..0000000000000 --- a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/response_time_anomaly_response.json +++ /dev/null @@ -1,1175 +0,0 @@ -{ - "took": 14, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "skipped": 0, - "failed": 0 - }, - "hits": { - "total": 4117, - "max_score": 0, - "hits": [] - }, - "aggregations": { - "ml_avg_response_times": { - "buckets": [ - { - "key_as_string": "2018-06-04T12:00:00.000Z", - "key": 1528113600000, - "doc_count": 60, - "anomaly_score": { - "value": 0.07062823 - }, - "upper": { - "value": 26781.294783193 - }, - "lower": { - "value": 734.6120832292385 - } - }, - { - "key_as_string": "2018-06-04T15:00:00.000Z", - "key": 1528124400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 27505.95012649385 - }, - "lower": { - "value": 737.7398559597923 - } - }, - { - "key_as_string": "2018-06-04T18:00:00.000Z", - "key": 1528135200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 27831.385094457328 - }, - "lower": { - "value": 740.6510789069575 - } - }, - { - "key_as_string": "2018-06-04T21:00:00.000Z", - "key": 1528146000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 28113.842130309873 - }, - "lower": { - "value": 743.0092006506535 - } - }, - { - "key_as_string": "2018-06-05T00:00:00.000Z", - "key": 1528156800000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 28166.937431054437 - }, - "lower": { - "value": 745.266369017907 - } - }, - { - "key_as_string": "2018-06-05T03:00:00.000Z", - "key": 1528167600000, - "doc_count": 50, - "anomaly_score": { - "value": 0.0214167 - }, - "upper": { - "value": 28506.23990430994 - }, - "lower": { - "value": 747.3207728528188 - } - }, - { - "key_as_string": "2018-06-05T06:00:00.000Z", - "key": 1528178400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 29019.425285291298 - }, - "lower": { - "value": 749.6894207909651 - } - }, - { - "key_as_string": "2018-06-05T09:00:00.000Z", - "key": 1528189200000, - "doc_count": 51, - "anomaly_score": { - "value": 0.05939392 - }, - "upper": { - "value": 29293.392326541318 - }, - "lower": { - "value": 752.7726473096143 - } - }, - { - "key_as_string": "2018-06-05T12:00:00.000Z", - "key": 1528200000000, - "doc_count": 50, - "anomaly_score": { - "value": 0.01836784 - }, - "upper": { - "value": 29812.56398272085 - }, - "lower": { - "value": 754.7407389918743 - } - }, - { - "key_as_string": "2018-06-05T15:00:00.000Z", - "key": 1528210800000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 30060.955415439636 - }, - "lower": { - "value": 757.2268079827784 - } - }, - { - "key_as_string": "2018-06-05T18:00:00.000Z", - "key": 1528221600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 30376.319798106222 - }, - "lower": { - "value": 758.3112520555287 - } - }, - { - "key_as_string": "2018-06-05T21:00:00.000Z", - "key": 1528232400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 30627.243996529527 - }, - "lower": { - "value": 761.9827340264112 - } - }, - { - "key_as_string": "2018-06-06T00:00:00.000Z", - "key": 1528243200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 31035.75952712361 - }, - "lower": { - "value": 771.7209606007517 - } - }, - { - "key_as_string": "2018-06-06T03:00:00.000Z", - "key": 1528254000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 31062.244462967443 - }, - "lower": { - "value": 822.9174906119024 - } - }, - { - "key_as_string": "2018-06-06T06:00:00.000Z", - "key": 1528264800000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 31463.705363442183 - }, - "lower": { - "value": 867.1132870297309 - } - }, - { - "key_as_string": "2018-06-06T09:00:00.000Z", - "key": 1528275600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 31743.78493690837 - }, - "lower": { - "value": 871.6217257693573 - } - }, - { - "key_as_string": "2018-06-06T12:00:00.000Z", - "key": 1528286400000, - "doc_count": 86, - "anomaly_score": { - "value": 93.09271062370188 - }, - "upper": { - "value": 42784.833235636936 - }, - "lower": { - "value": 630.1794765317344 - } - }, - { - "key_as_string": "2018-06-06T15:00:00.000Z", - "key": 1528297200000, - "doc_count": 94, - "anomaly_score": { - "value": 94.91969 - }, - "upper": { - "value": 34441.21907642463 - }, - "lower": { - "value": 871.0283056454996 - } - }, - { - "key_as_string": "2018-06-06T18:00:00.000Z", - "key": 1528308000000, - "doc_count": 76, - "anomaly_score": { - "value": 0.737564554333639 - }, - "upper": { - "value": 35467.552283525925 - }, - "lower": { - "value": 872.694053998953 - } - }, - { - "key_as_string": "2018-06-06T21:00:00.000Z", - "key": 1528318800000, - "doc_count": 62, - "anomaly_score": { - "value": 0.2233028643272195 - }, - "upper": { - "value": 36793.04873774251 - }, - "lower": { - "value": 872.8967719351887 - } - }, - { - "key_as_string": "2018-06-07T00:00:00.000Z", - "key": 1528329600000, - "doc_count": 56, - "anomaly_score": { - "value": 4.367981 - }, - "upper": { - "value": 37663.180967734144 - }, - "lower": { - "value": 873.2094351335686 - } - }, - { - "key_as_string": "2018-06-07T03:00:00.000Z", - "key": 1528340400000, - "doc_count": 74, - "anomaly_score": { - "value": 10.94823 - }, - "upper": { - "value": 38704.9736025016 - }, - "lower": { - "value": 872.096335158222 - } - }, - { - "key_as_string": "2018-06-07T06:00:00.000Z", - "key": 1528351200000, - "doc_count": 50, - "anomaly_score": { - "value": 0.025502508470513552 - }, - "upper": { - "value": 39411.4696425657 - }, - "lower": { - "value": 870.7141079237686 - } - }, - { - "key_as_string": "2018-06-07T09:00:00.000Z", - "key": 1528362000000, - "doc_count": 52, - "anomaly_score": { - "value": 0.04643894365231562 - }, - "upper": { - "value": 40436.89001900413 - }, - "lower": { - "value": 865.6904233415615 - } - }, - { - "key_as_string": "2018-06-07T12:00:00.000Z", - "key": 1528372800000, - "doc_count": 52, - "anomaly_score": { - "value": 0.08232853094836577 - }, - "upper": { - "value": 41583.671803791396 - }, - "lower": { - "value": 864.5587212551438 - } - }, - { - "key_as_string": "2018-06-07T15:00:00.000Z", - "key": 1528383600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 41918.88300390927 - }, - "lower": { - "value": 862.0456649399898 - } - }, - { - "key_as_string": "2018-06-07T18:00:00.000Z", - "key": 1528394400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 42346.34733913561 - }, - "lower": { - "value": 862.6952960489333 - } - }, - { - "key_as_string": "2018-06-07T21:00:00.000Z", - "key": 1528405200000, - "doc_count": 50, - "anomaly_score": { - "value": 0.09328928850624264 - }, - "upper": { - "value": 43503.30873034762 - }, - "lower": { - "value": 859.02865711764 - } - }, - { - "key_as_string": "2018-06-08T00:00:00.000Z", - "key": 1528416000000, - "doc_count": 50, - "anomaly_score": { - "value": 0.01490678070537287 - }, - "upper": { - "value": 43582.32622523151 - }, - "lower": { - "value": 853.1249075544679 - } - }, - { - "key_as_string": "2018-06-08T03:00:00.000Z", - "key": 1528426800000, - "doc_count": 50, - "anomaly_score": { - "value": 0.025631694904640304 - }, - "upper": { - "value": 44583.7194942183 - }, - "lower": { - "value": 850.0412997919607 - } - }, - { - "key_as_string": "2018-06-08T06:00:00.000Z", - "key": 1528437600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 45027.0923125673 - }, - "lower": { - "value": 846.9251200783423 - } - }, - { - "key_as_string": "2018-06-08T09:00:00.000Z", - "key": 1528448400000, - "doc_count": 52, - "anomaly_score": { - "value": 0.1775235302080928 - }, - "upper": { - "value": 46355.1414826366 - }, - "lower": { - "value": 839.9462033017412 - } - }, - { - "key_as_string": "2018-06-08T12:00:00.000Z", - "key": 1528459200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 46997.18507921725 - }, - "lower": { - "value": 740.8424736560071 - } - }, - { - "key_as_string": "2018-06-08T15:00:00.000Z", - "key": 1528470000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 47730.52441880603 - }, - "lower": { - "value": 675.2681661332581 - } - }, - { - "key_as_string": "2018-06-08T18:00:00.000Z", - "key": 1528480800000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 48709.29810572524 - }, - "lower": { - "value": 672.90202453507 - } - }, - { - "key_as_string": "2018-06-08T21:00:00.000Z", - "key": 1528491600000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49406.64628717409 - }, - "lower": { - "value": 676.0944399455826 - } - }, - { - "key_as_string": "2018-06-09T00:00:00.000Z", - "key": 1528502400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 73477.3874808886 - }, - "lower": { - "value": 682.4396257998045 - } - }, - { - "key_as_string": "2018-06-09T03:00:00.000Z", - "key": 1528513200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 73487.82525090317 - }, - "lower": { - "value": 686.44341250381 - } - }, - { - "key_as_string": "2018-06-09T06:00:00.000Z", - "key": 1528524000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 72962.57745081023 - }, - "lower": { - "value": 690.5371630779586 - } - }, - { - "key_as_string": "2018-06-09T09:00:00.000Z", - "key": 1528534800000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 72489.77380542927 - }, - "lower": { - "value": 695.8034104561633 - } - }, - { - "key_as_string": "2018-06-09T12:00:00.000Z", - "key": 1528545600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 72463.76348179985 - }, - "lower": { - "value": 707.6839448592744 - } - }, - { - "key_as_string": "2018-06-09T15:00:00.000Z", - "key": 1528556400000, - "doc_count": 50, - "anomaly_score": { - "value": 0.18086821490763677 - }, - "upper": { - "value": 72996.2561390666 - }, - "lower": { - "value": 781.8674002616508 - } - }, - { - "key_as_string": "2018-06-09T18:00:00.000Z", - "key": 1528567200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 73169.30855560771 - }, - "lower": { - "value": 846.540373740061 - } - }, - { - "key_as_string": "2018-06-09T21:00:00.000Z", - "key": 1528578000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 73491.08437587181 - }, - "lower": { - "value": 860.5368537637945 - } - }, - { - "key_as_string": "2018-06-10T00:00:00.000Z", - "key": 1528588800000, - "doc_count": 49, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 72389.78456634001 - }, - "lower": { - "value": 863.0293573898325 - } - }, - { - "key_as_string": "2018-06-10T03:00:00.000Z", - "key": 1528599600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 72311.41927730369 - }, - "lower": { - "value": 863.4144235290587 - } - }, - { - "key_as_string": "2018-06-10T06:00:00.000Z", - "key": 1528610400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 71383.41956191002 - }, - "lower": { - "value": 863.6781514985616 - } - }, - { - "key_as_string": "2018-06-10T09:00:00.000Z", - "key": 1528621200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 74565.86466696904 - }, - "lower": { - "value": 863.4492510434609 - } - }, - { - "key_as_string": "2018-06-10T12:00:00.000Z", - "key": 1528632000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 71304.14035324028 - }, - "lower": { - "value": 863.1958870174615 - } - }, - { - "key_as_string": "2018-06-10T15:00:00.000Z", - "key": 1528642800000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 72434.51561823535 - }, - "lower": { - "value": 862.6161500045084 - } - }, - { - "key_as_string": "2018-06-10T18:00:00.000Z", - "key": 1528653600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 71664.49530601672 - }, - "lower": { - "value": 861.9526316405551 - } - }, - { - "key_as_string": "2018-06-10T21:00:00.000Z", - "key": 1528664400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 71264.41362778837 - }, - "lower": { - "value": 861.1638627191994 - } - }, - { - "key_as_string": "2018-06-11T00:00:00.000Z", - "key": 1528675200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49087.805718943775 - }, - "lower": { - "value": 860.1741427701811 - } - }, - { - "key_as_string": "2018-06-11T03:00:00.000Z", - "key": 1528686000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49089.84051479006 - }, - "lower": { - "value": 862.4069845546885 - } - }, - { - "key_as_string": "2018-06-11T06:00:00.000Z", - "key": 1528696800000, - "doc_count": 60, - "anomaly_score": { - "value": 2.718289217634223 - }, - "upper": { - "value": 51834.13246654848 - }, - "lower": { - "value": 862.7834836635291 - } - }, - { - "key_as_string": "2018-06-11T09:00:00.000Z", - "key": 1528707600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 51136.66870946708 - }, - "lower": { - "value": 863.5914163409548 - } - }, - { - "key_as_string": "2018-06-11T12:00:00.000Z", - "key": 1528718400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 50968.889501405334 - }, - "lower": { - "value": 865.9550918866486 - } - }, - { - "key_as_string": "2018-06-11T15:00:00.000Z", - "key": 1528729200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 51039.136906324355 - }, - "lower": { - "value": 866.5727896346234 - } - }, - { - "key_as_string": "2018-06-11T18:00:00.000Z", - "key": 1528740000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 50450.44063039239 - }, - "lower": { - "value": 866.4824432593966 - } - }, - { - "key_as_string": "2018-06-11T21:00:00.000Z", - "key": 1528750800000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49883.2079974308 - }, - "lower": { - "value": 869.2106974966512 - } - }, - { - "key_as_string": "2018-06-12T00:00:00.000Z", - "key": 1528761600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 50019.796552072105 - }, - "lower": { - "value": 869.7908032042425 - } - }, - { - "key_as_string": "2018-06-12T03:00:00.000Z", - "key": 1528772400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 50352.19806206938 - }, - "lower": { - "value": 872.0969808877924 - } - }, - { - "key_as_string": "2018-06-12T06:00:00.000Z", - "key": 1528783200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49893.959882267525 - }, - "lower": { - "value": 873.8327021716271 - } - }, - { - "key_as_string": "2018-06-12T09:00:00.000Z", - "key": 1528794000000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49882.868445094966 - }, - "lower": { - "value": 875.6449156690691 - } - }, - { - "key_as_string": "2018-06-12T12:00:00.000Z", - "key": 1528804800000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49766.53895122279 - }, - "lower": { - "value": 874.6294655070553 - } - }, - { - "key_as_string": "2018-06-12T15:00:00.000Z", - "key": 1528815600000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49424.25380462067 - }, - "lower": { - "value": 878.2077083935897 - } - }, - { - "key_as_string": "2018-06-12T18:00:00.000Z", - "key": 1528826400000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 50079.967231416216 - }, - "lower": { - "value": 879.6702185935983 - } - }, - { - "key_as_string": "2018-06-12T21:00:00.000Z", - "key": 1528837200000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49447.853072406695 - }, - "lower": { - "value": 880.9475908626134 - } - }, - { - "key_as_string": "2018-06-13T00:00:00.000Z", - "key": 1528848000000, - "doc_count": 51, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49628.237099331986 - }, - "lower": { - "value": 883.2355577302953 - } - }, - { - "key_as_string": "2018-06-13T03:00:00.000Z", - "key": 1528858800000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49121.655177004985 - }, - "lower": { - "value": 885.0345875232065 - } - }, - { - "key_as_string": "2018-06-13T06:00:00.000Z", - "key": 1528869600000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49439.75445560749 - }, - "lower": { - "value": 886.8375619687324 - } - }, - { - "key_as_string": "2018-06-13T09:00:00.000Z", - "key": 1528880400000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49095.91031920496 - }, - "lower": { - "value": 888.2875318407426 - } - }, - { - "key_as_string": "2018-06-13T12:00:00.000Z", - "key": 1528891200000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 48584.97256737151 - }, - "lower": { - "value": 887.4807424937617 - } - }, - { - "key_as_string": "2018-06-13T15:00:00.000Z", - "key": 1528902000000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 48401.4014885278 - }, - "lower": { - "value": 885.3782512926099 - } - }, - { - "key_as_string": "2018-06-13T18:00:00.000Z", - "key": 1528912800000, - "doc_count": 50, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 48303.662251777845 - }, - "lower": { - "value": 883.9626695681782 - } - }, - { - "key_as_string": "2018-06-13T21:00:00.000Z", - "key": 1528923600000, - "doc_count": 48, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 48079.01124458592 - }, - "lower": { - "value": 881.5723811019918 - } - }, - { - "key_as_string": "2018-06-14T00:00:00.000Z", - "key": 1528934400000, - "doc_count": 60, - "anomaly_score": { - "value": 66.42568 - }, - "upper": { - "value": 58715.507088231585 - }, - "lower": { - "value": 0 - } - }, - { - "key_as_string": "2018-06-14T03:00:00.000Z", - "key": 1528945200000, - "doc_count": 55, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 49868.15796918666 - }, - "lower": { - "value": 0 - } - }, - { - "key_as_string": "2018-06-14T06:00:00.000Z", - "key": 1528956000000, - "doc_count": 53, - "anomaly_score": { - "value": 0.060750193569274885 - }, - "upper": { - "value": 50310.902258087066 - }, - "lower": { - "value": 2003.2599232283408 - } - }, - { - "key_as_string": "2018-06-14T09:00:00.000Z", - "key": 1528966800000, - "doc_count": 62, - "anomaly_score": { - "value": 0.2831448638843196 - }, - "upper": { - "value": 51642.47679276076 - }, - "lower": { - "value": 1346.2241502014724 - } - }, - { - "key_as_string": "2018-06-14T12:00:00.000Z", - "key": 1528977600000, - "doc_count": 4, - "anomaly_score": { - "value": 0 - }, - "upper": { - "value": 50550.64218576831 - }, - "lower": { - "value": 1317.070500756407 - } - } - ] - }, - "top_hits": { - "hits": { - "total": 4117, - "max_score": null, - "hits": [ - { - "_index": ".ml-anomalies-shared", - "_type": "doc", - "_id": "opbeans-node-request-high_mean_response_time_model_plot_1528170300000_900_0_29791_0", - "_score": null, - "_source": { - "bucket_span": 900 - }, - "sort": [ - 900 - ] - } - ] - } - } - } -} diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/timeseries_response.json b/x-pack/plugins/apm/server/lib/transactions/charts/__test__/timeseries_response.json deleted file mode 100644 index 38aa0237aebd6..0000000000000 --- a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/timeseries_response.json +++ /dev/null @@ -1,2821 +0,0 @@ -{ - "took": 368, - "timed_out": false, - "_shards": { - "total": 90, - "successful": 90, - "skipped": 0, - "failed": 0 - }, - "hits": { - "total": 1297673, - "max_score": 0, - "hits": [] - }, - "aggregations": { - "transaction_results": { - "doc_count_error_upper_bound": 0, - "sum_other_doc_count": 0, - "buckets": [ - { - "key": "A Custom Bucket (that should be last)", - "doc_count": 0, - "timeseries": { "buckets": [] } - }, - { - "key": "HTTP 2xx", - "doc_count": 1127080, - "timeseries": { - "buckets": [ - { - "key_as_string": "2018-06-04T12:00:00.000Z", - "key": 1528113600000, - "doc_count": 16446 - }, - { - "key_as_string": "2018-06-04T15:00:00.000Z", - "key": 1528124400000, - "doc_count": 16292 - }, - { - "key_as_string": "2018-06-04T18:00:00.000Z", - "key": 1528135200000, - "doc_count": 16464 - }, - { - "key_as_string": "2018-06-04T21:00:00.000Z", - "key": 1528146000000, - "doc_count": 16497 - }, - { - "key_as_string": "2018-06-05T00:00:00.000Z", - "key": 1528156800000, - "doc_count": 16799 - }, - { - "key_as_string": "2018-06-05T03:00:00.000Z", - "key": 1528167600000, - "doc_count": 16561 - }, - { - "key_as_string": "2018-06-05T06:00:00.000Z", - "key": 1528178400000, - "doc_count": 16431 - }, - { - "key_as_string": "2018-06-05T09:00:00.000Z", - "key": 1528189200000, - "doc_count": 16383 - }, - { - "key_as_string": "2018-06-05T12:00:00.000Z", - "key": 1528200000000, - "doc_count": 16295 - }, - { - "key_as_string": "2018-06-05T15:00:00.000Z", - "key": 1528210800000, - "doc_count": 16702 - }, - { - "key_as_string": "2018-06-05T18:00:00.000Z", - "key": 1528221600000, - "doc_count": 16469 - }, - { - "key_as_string": "2018-06-05T21:00:00.000Z", - "key": 1528232400000, - "doc_count": 16466 - }, - { - "key_as_string": "2018-06-06T00:00:00.000Z", - "key": 1528243200000, - "doc_count": 16551 - }, - { - "key_as_string": "2018-06-06T03:00:00.000Z", - "key": 1528254000000, - "doc_count": 16675 - }, - { - "key_as_string": "2018-06-06T06:00:00.000Z", - "key": 1528264800000, - "doc_count": 16410 - }, - { - "key_as_string": "2018-06-06T09:00:00.000Z", - "key": 1528275600000, - "doc_count": 16247 - }, - { - "key_as_string": "2018-06-06T12:00:00.000Z", - "key": 1528286400000, - "doc_count": 15145 - }, - { - "key_as_string": "2018-06-06T15:00:00.000Z", - "key": 1528297200000, - "doc_count": 16178 - }, - { - "key_as_string": "2018-06-06T18:00:00.000Z", - "key": 1528308000000, - "doc_count": 16530 - }, - { - "key_as_string": "2018-06-06T21:00:00.000Z", - "key": 1528318800000, - "doc_count": 16211 - }, - { - "key_as_string": "2018-06-07T00:00:00.000Z", - "key": 1528329600000, - "doc_count": 16453 - }, - { - "key_as_string": "2018-06-07T03:00:00.000Z", - "key": 1528340400000, - "doc_count": 16503 - }, - { - "key_as_string": "2018-06-07T06:00:00.000Z", - "key": 1528351200000, - "doc_count": 16604 - }, - { - "key_as_string": "2018-06-07T09:00:00.000Z", - "key": 1528362000000, - "doc_count": 16522 - }, - { - "key_as_string": "2018-06-07T12:00:00.000Z", - "key": 1528372800000, - "doc_count": 16164 - }, - { - "key_as_string": "2018-06-07T15:00:00.000Z", - "key": 1528383600000, - "doc_count": 16520 - }, - { - "key_as_string": "2018-06-07T18:00:00.000Z", - "key": 1528394400000, - "doc_count": 16534 - }, - { - "key_as_string": "2018-06-07T21:00:00.000Z", - "key": 1528405200000, - "doc_count": 16311 - }, - { - "key_as_string": "2018-06-08T00:00:00.000Z", - "key": 1528416000000, - "doc_count": 16670 - }, - { - "key_as_string": "2018-06-08T03:00:00.000Z", - "key": 1528426800000, - "doc_count": 16192 - }, - { - "key_as_string": "2018-06-08T06:00:00.000Z", - "key": 1528437600000, - "doc_count": 16579 - }, - { - "key_as_string": "2018-06-08T09:00:00.000Z", - "key": 1528448400000, - "doc_count": 16330 - }, - { - "key_as_string": "2018-06-08T12:00:00.000Z", - "key": 1528459200000, - "doc_count": 16565 - }, - { - "key_as_string": "2018-06-08T15:00:00.000Z", - "key": 1528470000000, - "doc_count": 16543 - }, - { - "key_as_string": "2018-06-08T18:00:00.000Z", - "key": 1528480800000, - "doc_count": 16492 - }, - { - "key_as_string": "2018-06-08T21:00:00.000Z", - "key": 1528491600000, - "doc_count": 16404 - }, - { - "key_as_string": "2018-06-09T00:00:00.000Z", - "key": 1528502400000, - "doc_count": 4528 - }, - { - "key_as_string": "2018-06-09T03:00:00.000Z", - "key": 1528513200000, - "doc_count": 4557 - }, - { - "key_as_string": "2018-06-09T06:00:00.000Z", - "key": 1528524000000, - "doc_count": 4566 - }, - { - "key_as_string": "2018-06-09T09:00:00.000Z", - "key": 1528534800000, - "doc_count": 4586 - }, - { - "key_as_string": "2018-06-09T12:00:00.000Z", - "key": 1528545600000, - "doc_count": 4672 - }, - { - "key_as_string": "2018-06-09T15:00:00.000Z", - "key": 1528556400000, - "doc_count": 4685 - }, - { - "key_as_string": "2018-06-09T18:00:00.000Z", - "key": 1528567200000, - "doc_count": 4521 - }, - { - "key_as_string": "2018-06-09T21:00:00.000Z", - "key": 1528578000000, - "doc_count": 4612 - }, - { - "key_as_string": "2018-06-10T00:00:00.000Z", - "key": 1528588800000, - "doc_count": 4535 - }, - { - "key_as_string": "2018-06-10T03:00:00.000Z", - "key": 1528599600000, - "doc_count": 4606 - }, - { - "key_as_string": "2018-06-10T06:00:00.000Z", - "key": 1528610400000, - "doc_count": 4614 - }, - { - "key_as_string": "2018-06-10T09:00:00.000Z", - "key": 1528621200000, - "doc_count": 4507 - }, - { - "key_as_string": "2018-06-10T12:00:00.000Z", - "key": 1528632000000, - "doc_count": 4611 - }, - { - "key_as_string": "2018-06-10T15:00:00.000Z", - "key": 1528642800000, - "doc_count": 4587 - }, - { - "key_as_string": "2018-06-10T18:00:00.000Z", - "key": 1528653600000, - "doc_count": 4582 - }, - { - "key_as_string": "2018-06-10T21:00:00.000Z", - "key": 1528664400000, - "doc_count": 4615 - }, - { - "key_as_string": "2018-06-11T00:00:00.000Z", - "key": 1528675200000, - "doc_count": 16251 - }, - { - "key_as_string": "2018-06-11T03:00:00.000Z", - "key": 1528686000000, - "doc_count": 16825 - }, - { - "key_as_string": "2018-06-11T06:00:00.000Z", - "key": 1528696800000, - "doc_count": 16288 - }, - { - "key_as_string": "2018-06-11T09:00:00.000Z", - "key": 1528707600000, - "doc_count": 16492 - }, - { - "key_as_string": "2018-06-11T12:00:00.000Z", - "key": 1528718400000, - "doc_count": 16434 - }, - { - "key_as_string": "2018-06-11T15:00:00.000Z", - "key": 1528729200000, - "doc_count": 17003 - }, - { - "key_as_string": "2018-06-11T18:00:00.000Z", - "key": 1528740000000, - "doc_count": 16364 - }, - { - "key_as_string": "2018-06-11T21:00:00.000Z", - "key": 1528750800000, - "doc_count": 16645 - }, - { - "key_as_string": "2018-06-12T00:00:00.000Z", - "key": 1528761600000, - "doc_count": 16695 - }, - { - "key_as_string": "2018-06-12T03:00:00.000Z", - "key": 1528772400000, - "doc_count": 16498 - }, - { - "key_as_string": "2018-06-12T06:00:00.000Z", - "key": 1528783200000, - "doc_count": 16588 - }, - { - "key_as_string": "2018-06-12T09:00:00.000Z", - "key": 1528794000000, - "doc_count": 16685 - }, - { - "key_as_string": "2018-06-12T12:00:00.000Z", - "key": 1528804800000, - "doc_count": 16361 - }, - { - "key_as_string": "2018-06-12T15:00:00.000Z", - "key": 1528815600000, - "doc_count": 16658 - }, - { - "key_as_string": "2018-06-12T18:00:00.000Z", - "key": 1528826400000, - "doc_count": 16507 - }, - { - "key_as_string": "2018-06-12T21:00:00.000Z", - "key": 1528837200000, - "doc_count": 16418 - }, - { - "key_as_string": "2018-06-13T00:00:00.000Z", - "key": 1528848000000, - "doc_count": 16477 - }, - { - "key_as_string": "2018-06-13T03:00:00.000Z", - "key": 1528858800000, - "doc_count": 16755 - }, - { - "key_as_string": "2018-06-13T06:00:00.000Z", - "key": 1528869600000, - "doc_count": 16594 - }, - { - "key_as_string": "2018-06-13T09:00:00.000Z", - "key": 1528880400000, - "doc_count": 16812 - }, - { - "key_as_string": "2018-06-13T12:00:00.000Z", - "key": 1528891200000, - "doc_count": 16863 - }, - { - "key_as_string": "2018-06-13T15:00:00.000Z", - "key": 1528902000000, - "doc_count": 16655 - }, - { - "key_as_string": "2018-06-13T18:00:00.000Z", - "key": 1528912800000, - "doc_count": 16723 - }, - { - "key_as_string": "2018-06-13T21:00:00.000Z", - "key": 1528923600000, - "doc_count": 16577 - }, - { - "key_as_string": "2018-06-14T00:00:00.000Z", - "key": 1528934400000, - "doc_count": 15125 - }, - { - "key_as_string": "2018-06-14T03:00:00.000Z", - "key": 1528945200000, - "doc_count": 16432 - }, - { - "key_as_string": "2018-06-14T06:00:00.000Z", - "key": 1528956000000, - "doc_count": 16464 - }, - { - "key_as_string": "2018-06-14T09:00:00.000Z", - "key": 1528966800000, - "doc_count": 16369 - }, - { - "key_as_string": "2018-06-14T12:00:00.000Z", - "key": 1528977600000, - "doc_count": 0 - } - ] - } - }, - { - "key": "HTTP 5xx", - "doc_count": 82036, - "timeseries": { - "buckets": [ - { - "key_as_string": "2018-06-04T12:00:00.000Z", - "key": 1528113600000, - "doc_count": 1209 - }, - { - "key_as_string": "2018-06-04T15:00:00.000Z", - "key": 1528124400000, - "doc_count": 1203 - }, - { - "key_as_string": "2018-06-04T18:00:00.000Z", - "key": 1528135200000, - "doc_count": 1196 - }, - { - "key_as_string": "2018-06-04T21:00:00.000Z", - "key": 1528146000000, - "doc_count": 1230 - }, - { - "key_as_string": "2018-06-05T00:00:00.000Z", - "key": 1528156800000, - "doc_count": 1233 - }, - { - "key_as_string": "2018-06-05T03:00:00.000Z", - "key": 1528167600000, - "doc_count": 1272 - }, - { - "key_as_string": "2018-06-05T06:00:00.000Z", - "key": 1528178400000, - "doc_count": 1218 - }, - { - "key_as_string": "2018-06-05T09:00:00.000Z", - "key": 1528189200000, - "doc_count": 1217 - }, - { - "key_as_string": "2018-06-05T12:00:00.000Z", - "key": 1528200000000, - "doc_count": 1235 - }, - { - "key_as_string": "2018-06-05T15:00:00.000Z", - "key": 1528210800000, - "doc_count": 1249 - }, - { - "key_as_string": "2018-06-05T18:00:00.000Z", - "key": 1528221600000, - "doc_count": 1158 - }, - { - "key_as_string": "2018-06-05T21:00:00.000Z", - "key": 1528232400000, - "doc_count": 1215 - }, - { - "key_as_string": "2018-06-06T00:00:00.000Z", - "key": 1528243200000, - "doc_count": 1191 - }, - { - "key_as_string": "2018-06-06T03:00:00.000Z", - "key": 1528254000000, - "doc_count": 1235 - }, - { - "key_as_string": "2018-06-06T06:00:00.000Z", - "key": 1528264800000, - "doc_count": 1212 - }, - { - "key_as_string": "2018-06-06T09:00:00.000Z", - "key": 1528275600000, - "doc_count": 1180 - }, - { - "key_as_string": "2018-06-06T12:00:00.000Z", - "key": 1528286400000, - "doc_count": 1091 - }, - { - "key_as_string": "2018-06-06T15:00:00.000Z", - "key": 1528297200000, - "doc_count": 1176 - }, - { - "key_as_string": "2018-06-06T18:00:00.000Z", - "key": 1528308000000, - "doc_count": 1243 - }, - { - "key_as_string": "2018-06-06T21:00:00.000Z", - "key": 1528318800000, - "doc_count": 1208 - }, - { - "key_as_string": "2018-06-07T00:00:00.000Z", - "key": 1528329600000, - "doc_count": 1202 - }, - { - "key_as_string": "2018-06-07T03:00:00.000Z", - "key": 1528340400000, - "doc_count": 1288 - }, - { - "key_as_string": "2018-06-07T06:00:00.000Z", - "key": 1528351200000, - "doc_count": 1241 - }, - { - "key_as_string": "2018-06-07T09:00:00.000Z", - "key": 1528362000000, - "doc_count": 1215 - }, - { - "key_as_string": "2018-06-07T12:00:00.000Z", - "key": 1528372800000, - "doc_count": 1152 - }, - { - "key_as_string": "2018-06-07T15:00:00.000Z", - "key": 1528383600000, - "doc_count": 1241 - }, - { - "key_as_string": "2018-06-07T18:00:00.000Z", - "key": 1528394400000, - "doc_count": 1177 - }, - { - "key_as_string": "2018-06-07T21:00:00.000Z", - "key": 1528405200000, - "doc_count": 1243 - }, - { - "key_as_string": "2018-06-08T00:00:00.000Z", - "key": 1528416000000, - "doc_count": 1255 - }, - { - "key_as_string": "2018-06-08T03:00:00.000Z", - "key": 1528426800000, - "doc_count": 1189 - }, - { - "key_as_string": "2018-06-08T06:00:00.000Z", - "key": 1528437600000, - "doc_count": 1183 - }, - { - "key_as_string": "2018-06-08T09:00:00.000Z", - "key": 1528448400000, - "doc_count": 1215 - }, - { - "key_as_string": "2018-06-08T12:00:00.000Z", - "key": 1528459200000, - "doc_count": 1282 - }, - { - "key_as_string": "2018-06-08T15:00:00.000Z", - "key": 1528470000000, - "doc_count": 1177 - }, - { - "key_as_string": "2018-06-08T18:00:00.000Z", - "key": 1528480800000, - "doc_count": 1199 - }, - { - "key_as_string": "2018-06-08T21:00:00.000Z", - "key": 1528491600000, - "doc_count": 1234 - }, - { - "key_as_string": "2018-06-09T00:00:00.000Z", - "key": 1528502400000, - "doc_count": 284 - }, - { - "key_as_string": "2018-06-09T03:00:00.000Z", - "key": 1528513200000, - "doc_count": 307 - }, - { - "key_as_string": "2018-06-09T06:00:00.000Z", - "key": 1528524000000, - "doc_count": 283 - }, - { - "key_as_string": "2018-06-09T09:00:00.000Z", - "key": 1528534800000, - "doc_count": 303 - }, - { - "key_as_string": "2018-06-09T12:00:00.000Z", - "key": 1528545600000, - "doc_count": 326 - }, - { - "key_as_string": "2018-06-09T15:00:00.000Z", - "key": 1528556400000, - "doc_count": 269 - }, - { - "key_as_string": "2018-06-09T18:00:00.000Z", - "key": 1528567200000, - "doc_count": 297 - }, - { - "key_as_string": "2018-06-09T21:00:00.000Z", - "key": 1528578000000, - "doc_count": 278 - }, - { - "key_as_string": "2018-06-10T00:00:00.000Z", - "key": 1528588800000, - "doc_count": 289 - }, - { - "key_as_string": "2018-06-10T03:00:00.000Z", - "key": 1528599600000, - "doc_count": 272 - }, - { - "key_as_string": "2018-06-10T06:00:00.000Z", - "key": 1528610400000, - "doc_count": 279 - }, - { - "key_as_string": "2018-06-10T09:00:00.000Z", - "key": 1528621200000, - "doc_count": 238 - }, - { - "key_as_string": "2018-06-10T12:00:00.000Z", - "key": 1528632000000, - "doc_count": 288 - }, - { - "key_as_string": "2018-06-10T15:00:00.000Z", - "key": 1528642800000, - "doc_count": 258 - }, - { - "key_as_string": "2018-06-10T18:00:00.000Z", - "key": 1528653600000, - "doc_count": 264 - }, - { - "key_as_string": "2018-06-10T21:00:00.000Z", - "key": 1528664400000, - "doc_count": 296 - }, - { - "key_as_string": "2018-06-11T00:00:00.000Z", - "key": 1528675200000, - "doc_count": 1213 - }, - { - "key_as_string": "2018-06-11T03:00:00.000Z", - "key": 1528686000000, - "doc_count": 1254 - }, - { - "key_as_string": "2018-06-11T06:00:00.000Z", - "key": 1528696800000, - "doc_count": 1135 - }, - { - "key_as_string": "2018-06-11T09:00:00.000Z", - "key": 1528707600000, - "doc_count": 1240 - }, - { - "key_as_string": "2018-06-11T12:00:00.000Z", - "key": 1528718400000, - "doc_count": 1215 - }, - { - "key_as_string": "2018-06-11T15:00:00.000Z", - "key": 1528729200000, - "doc_count": 1239 - }, - { - "key_as_string": "2018-06-11T18:00:00.000Z", - "key": 1528740000000, - "doc_count": 1209 - }, - { - "key_as_string": "2018-06-11T21:00:00.000Z", - "key": 1528750800000, - "doc_count": 1208 - }, - { - "key_as_string": "2018-06-12T00:00:00.000Z", - "key": 1528761600000, - "doc_count": 1176 - }, - { - "key_as_string": "2018-06-12T03:00:00.000Z", - "key": 1528772400000, - "doc_count": 1207 - }, - { - "key_as_string": "2018-06-12T06:00:00.000Z", - "key": 1528783200000, - "doc_count": 1198 - }, - { - "key_as_string": "2018-06-12T09:00:00.000Z", - "key": 1528794000000, - "doc_count": 1165 - }, - { - "key_as_string": "2018-06-12T12:00:00.000Z", - "key": 1528804800000, - "doc_count": 1188 - }, - { - "key_as_string": "2018-06-12T15:00:00.000Z", - "key": 1528815600000, - "doc_count": 1245 - }, - { - "key_as_string": "2018-06-12T18:00:00.000Z", - "key": 1528826400000, - "doc_count": 1238 - }, - { - "key_as_string": "2018-06-12T21:00:00.000Z", - "key": 1528837200000, - "doc_count": 1283 - }, - { - "key_as_string": "2018-06-13T00:00:00.000Z", - "key": 1528848000000, - "doc_count": 1198 - }, - { - "key_as_string": "2018-06-13T03:00:00.000Z", - "key": 1528858800000, - "doc_count": 1172 - }, - { - "key_as_string": "2018-06-13T06:00:00.000Z", - "key": 1528869600000, - "doc_count": 1229 - }, - { - "key_as_string": "2018-06-13T09:00:00.000Z", - "key": 1528880400000, - "doc_count": 1239 - }, - { - "key_as_string": "2018-06-13T12:00:00.000Z", - "key": 1528891200000, - "doc_count": 1231 - }, - { - "key_as_string": "2018-06-13T15:00:00.000Z", - "key": 1528902000000, - "doc_count": 1248 - }, - { - "key_as_string": "2018-06-13T18:00:00.000Z", - "key": 1528912800000, - "doc_count": 1220 - }, - { - "key_as_string": "2018-06-13T21:00:00.000Z", - "key": 1528923600000, - "doc_count": 1224 - }, - { - "key_as_string": "2018-06-14T00:00:00.000Z", - "key": 1528934400000, - "doc_count": 1088 - }, - { - "key_as_string": "2018-06-14T03:00:00.000Z", - "key": 1528945200000, - "doc_count": 1235 - }, - { - "key_as_string": "2018-06-14T06:00:00.000Z", - "key": 1528956000000, - "doc_count": 1161 - }, - { - "key_as_string": "2018-06-14T09:00:00.000Z", - "key": 1528966800000, - "doc_count": 1183 - }, - { - "key_as_string": "2018-06-14T12:00:00.000Z", - "key": 1528977600000, - "doc_count": 0 - } - ] - } - }, - { - "key": "HTTP 4xx", - "doc_count": 81907, - "timeseries": { - "buckets": [ - { - "key_as_string": "2018-06-04T12:00:00.000Z", - "key": 1528113600000, - "doc_count": 1186 - }, - { - "key_as_string": "2018-06-04T15:00:00.000Z", - "key": 1528124400000, - "doc_count": 1213 - }, - { - "key_as_string": "2018-06-04T18:00:00.000Z", - "key": 1528135200000, - "doc_count": 1205 - }, - { - "key_as_string": "2018-06-04T21:00:00.000Z", - "key": 1528146000000, - "doc_count": 1162 - }, - { - "key_as_string": "2018-06-05T00:00:00.000Z", - "key": 1528156800000, - "doc_count": 1238 - }, - { - "key_as_string": "2018-06-05T03:00:00.000Z", - "key": 1528167600000, - "doc_count": 1191 - }, - { - "key_as_string": "2018-06-05T06:00:00.000Z", - "key": 1528178400000, - "doc_count": 1274 - }, - { - "key_as_string": "2018-06-05T09:00:00.000Z", - "key": 1528189200000, - "doc_count": 1234 - }, - { - "key_as_string": "2018-06-05T12:00:00.000Z", - "key": 1528200000000, - "doc_count": 1164 - }, - { - "key_as_string": "2018-06-05T15:00:00.000Z", - "key": 1528210800000, - "doc_count": 1233 - }, - { - "key_as_string": "2018-06-05T18:00:00.000Z", - "key": 1528221600000, - "doc_count": 1223 - }, - { - "key_as_string": "2018-06-05T21:00:00.000Z", - "key": 1528232400000, - "doc_count": 1216 - }, - { - "key_as_string": "2018-06-06T00:00:00.000Z", - "key": 1528243200000, - "doc_count": 1200 - }, - { - "key_as_string": "2018-06-06T03:00:00.000Z", - "key": 1528254000000, - "doc_count": 1237 - }, - { - "key_as_string": "2018-06-06T06:00:00.000Z", - "key": 1528264800000, - "doc_count": 1231 - }, - { - "key_as_string": "2018-06-06T09:00:00.000Z", - "key": 1528275600000, - "doc_count": 1182 - }, - { - "key_as_string": "2018-06-06T12:00:00.000Z", - "key": 1528286400000, - "doc_count": 1125 - }, - { - "key_as_string": "2018-06-06T15:00:00.000Z", - "key": 1528297200000, - "doc_count": 1243 - }, - { - "key_as_string": "2018-06-06T18:00:00.000Z", - "key": 1528308000000, - "doc_count": 1247 - }, - { - "key_as_string": "2018-06-06T21:00:00.000Z", - "key": 1528318800000, - "doc_count": 1163 - }, - { - "key_as_string": "2018-06-07T00:00:00.000Z", - "key": 1528329600000, - "doc_count": 1220 - }, - { - "key_as_string": "2018-06-07T03:00:00.000Z", - "key": 1528340400000, - "doc_count": 1202 - }, - { - "key_as_string": "2018-06-07T06:00:00.000Z", - "key": 1528351200000, - "doc_count": 1192 - }, - { - "key_as_string": "2018-06-07T09:00:00.000Z", - "key": 1528362000000, - "doc_count": 1248 - }, - { - "key_as_string": "2018-06-07T12:00:00.000Z", - "key": 1528372800000, - "doc_count": 1189 - }, - { - "key_as_string": "2018-06-07T15:00:00.000Z", - "key": 1528383600000, - "doc_count": 1230 - }, - { - "key_as_string": "2018-06-07T18:00:00.000Z", - "key": 1528394400000, - "doc_count": 1206 - }, - { - "key_as_string": "2018-06-07T21:00:00.000Z", - "key": 1528405200000, - "doc_count": 1190 - }, - { - "key_as_string": "2018-06-08T00:00:00.000Z", - "key": 1528416000000, - "doc_count": 1232 - }, - { - "key_as_string": "2018-06-08T03:00:00.000Z", - "key": 1528426800000, - "doc_count": 1171 - }, - { - "key_as_string": "2018-06-08T06:00:00.000Z", - "key": 1528437600000, - "doc_count": 1232 - }, - { - "key_as_string": "2018-06-08T09:00:00.000Z", - "key": 1528448400000, - "doc_count": 1253 - }, - { - "key_as_string": "2018-06-08T12:00:00.000Z", - "key": 1528459200000, - "doc_count": 1250 - }, - { - "key_as_string": "2018-06-08T15:00:00.000Z", - "key": 1528470000000, - "doc_count": 1167 - }, - { - "key_as_string": "2018-06-08T18:00:00.000Z", - "key": 1528480800000, - "doc_count": 1258 - }, - { - "key_as_string": "2018-06-08T21:00:00.000Z", - "key": 1528491600000, - "doc_count": 1148 - }, - { - "key_as_string": "2018-06-09T00:00:00.000Z", - "key": 1528502400000, - "doc_count": 284 - }, - { - "key_as_string": "2018-06-09T03:00:00.000Z", - "key": 1528513200000, - "doc_count": 240 - }, - { - "key_as_string": "2018-06-09T06:00:00.000Z", - "key": 1528524000000, - "doc_count": 273 - }, - { - "key_as_string": "2018-06-09T09:00:00.000Z", - "key": 1528534800000, - "doc_count": 295 - }, - { - "key_as_string": "2018-06-09T12:00:00.000Z", - "key": 1528545600000, - "doc_count": 281 - }, - { - "key_as_string": "2018-06-09T15:00:00.000Z", - "key": 1528556400000, - "doc_count": 300 - }, - { - "key_as_string": "2018-06-09T18:00:00.000Z", - "key": 1528567200000, - "doc_count": 264 - }, - { - "key_as_string": "2018-06-09T21:00:00.000Z", - "key": 1528578000000, - "doc_count": 260 - }, - { - "key_as_string": "2018-06-10T00:00:00.000Z", - "key": 1528588800000, - "doc_count": 279 - }, - { - "key_as_string": "2018-06-10T03:00:00.000Z", - "key": 1528599600000, - "doc_count": 259 - }, - { - "key_as_string": "2018-06-10T06:00:00.000Z", - "key": 1528610400000, - "doc_count": 291 - }, - { - "key_as_string": "2018-06-10T09:00:00.000Z", - "key": 1528621200000, - "doc_count": 248 - }, - { - "key_as_string": "2018-06-10T12:00:00.000Z", - "key": 1528632000000, - "doc_count": 311 - }, - { - "key_as_string": "2018-06-10T15:00:00.000Z", - "key": 1528642800000, - "doc_count": 277 - }, - { - "key_as_string": "2018-06-10T18:00:00.000Z", - "key": 1528653600000, - "doc_count": 279 - }, - { - "key_as_string": "2018-06-10T21:00:00.000Z", - "key": 1528664400000, - "doc_count": 275 - }, - { - "key_as_string": "2018-06-11T00:00:00.000Z", - "key": 1528675200000, - "doc_count": 1167 - }, - { - "key_as_string": "2018-06-11T03:00:00.000Z", - "key": 1528686000000, - "doc_count": 1270 - }, - { - "key_as_string": "2018-06-11T06:00:00.000Z", - "key": 1528696800000, - "doc_count": 1163 - }, - { - "key_as_string": "2018-06-11T09:00:00.000Z", - "key": 1528707600000, - "doc_count": 1155 - }, - { - "key_as_string": "2018-06-11T12:00:00.000Z", - "key": 1528718400000, - "doc_count": 1217 - }, - { - "key_as_string": "2018-06-11T15:00:00.000Z", - "key": 1528729200000, - "doc_count": 1227 - }, - { - "key_as_string": "2018-06-11T18:00:00.000Z", - "key": 1528740000000, - "doc_count": 1194 - }, - { - "key_as_string": "2018-06-11T21:00:00.000Z", - "key": 1528750800000, - "doc_count": 1153 - }, - { - "key_as_string": "2018-06-12T00:00:00.000Z", - "key": 1528761600000, - "doc_count": 1211 - }, - { - "key_as_string": "2018-06-12T03:00:00.000Z", - "key": 1528772400000, - "doc_count": 1203 - }, - { - "key_as_string": "2018-06-12T06:00:00.000Z", - "key": 1528783200000, - "doc_count": 1269 - }, - { - "key_as_string": "2018-06-12T09:00:00.000Z", - "key": 1528794000000, - "doc_count": 1197 - }, - { - "key_as_string": "2018-06-12T12:00:00.000Z", - "key": 1528804800000, - "doc_count": 1184 - }, - { - "key_as_string": "2018-06-12T15:00:00.000Z", - "key": 1528815600000, - "doc_count": 1176 - }, - { - "key_as_string": "2018-06-12T18:00:00.000Z", - "key": 1528826400000, - "doc_count": 1162 - }, - { - "key_as_string": "2018-06-12T21:00:00.000Z", - "key": 1528837200000, - "doc_count": 1270 - }, - { - "key_as_string": "2018-06-13T00:00:00.000Z", - "key": 1528848000000, - "doc_count": 1224 - }, - { - "key_as_string": "2018-06-13T03:00:00.000Z", - "key": 1528858800000, - "doc_count": 1255 - }, - { - "key_as_string": "2018-06-13T06:00:00.000Z", - "key": 1528869600000, - "doc_count": 1207 - }, - { - "key_as_string": "2018-06-13T09:00:00.000Z", - "key": 1528880400000, - "doc_count": 1206 - }, - { - "key_as_string": "2018-06-13T12:00:00.000Z", - "key": 1528891200000, - "doc_count": 1254 - }, - { - "key_as_string": "2018-06-13T15:00:00.000Z", - "key": 1528902000000, - "doc_count": 1216 - }, - { - "key_as_string": "2018-06-13T18:00:00.000Z", - "key": 1528912800000, - "doc_count": 1263 - }, - { - "key_as_string": "2018-06-13T21:00:00.000Z", - "key": 1528923600000, - "doc_count": 1277 - }, - { - "key_as_string": "2018-06-14T00:00:00.000Z", - "key": 1528934400000, - "doc_count": 1183 - }, - { - "key_as_string": "2018-06-14T03:00:00.000Z", - "key": 1528945200000, - "doc_count": 1221 - }, - { - "key_as_string": "2018-06-14T06:00:00.000Z", - "key": 1528956000000, - "doc_count": 1198 - }, - { - "key_as_string": "2018-06-14T09:00:00.000Z", - "key": 1528966800000, - "doc_count": 1214 - }, - { - "key_as_string": "2018-06-14T12:00:00.000Z", - "key": 1528977600000, - "doc_count": 0 - } - ] - } - }, - { - "key": "HTTP 3xx", - "doc_count": 6650, - "timeseries": { - "buckets": [ - { - "key_as_string": "2018-06-04T12:00:00.000Z", - "key": 1528113600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-04T15:00:00.000Z", - "key": 1528124400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-04T18:00:00.000Z", - "key": 1528135200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-04T21:00:00.000Z", - "key": 1528146000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T00:00:00.000Z", - "key": 1528156800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T03:00:00.000Z", - "key": 1528167600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T06:00:00.000Z", - "key": 1528178400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T09:00:00.000Z", - "key": 1528189200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T12:00:00.000Z", - "key": 1528200000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T15:00:00.000Z", - "key": 1528210800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T18:00:00.000Z", - "key": 1528221600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-05T21:00:00.000Z", - "key": 1528232400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-06T00:00:00.000Z", - "key": 1528243200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-06T03:00:00.000Z", - "key": 1528254000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-06T06:00:00.000Z", - "key": 1528264800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-06T09:00:00.000Z", - "key": 1528275600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-06T12:00:00.000Z", - "key": 1528286400000, - "doc_count": 4041 - }, - { - "key_as_string": "2018-06-06T15:00:00.000Z", - "key": 1528297200000, - "doc_count": 454 - }, - { - "key_as_string": "2018-06-06T18:00:00.000Z", - "key": 1528308000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-06T21:00:00.000Z", - "key": 1528318800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T00:00:00.000Z", - "key": 1528329600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T03:00:00.000Z", - "key": 1528340400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T06:00:00.000Z", - "key": 1528351200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T09:00:00.000Z", - "key": 1528362000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T12:00:00.000Z", - "key": 1528372800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T15:00:00.000Z", - "key": 1528383600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T18:00:00.000Z", - "key": 1528394400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-07T21:00:00.000Z", - "key": 1528405200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T00:00:00.000Z", - "key": 1528416000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T03:00:00.000Z", - "key": 1528426800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T06:00:00.000Z", - "key": 1528437600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T09:00:00.000Z", - "key": 1528448400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T12:00:00.000Z", - "key": 1528459200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T15:00:00.000Z", - "key": 1528470000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T18:00:00.000Z", - "key": 1528480800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-08T21:00:00.000Z", - "key": 1528491600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T00:00:00.000Z", - "key": 1528502400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T03:00:00.000Z", - "key": 1528513200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T06:00:00.000Z", - "key": 1528524000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T09:00:00.000Z", - "key": 1528534800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T12:00:00.000Z", - "key": 1528545600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T15:00:00.000Z", - "key": 1528556400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T18:00:00.000Z", - "key": 1528567200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-09T21:00:00.000Z", - "key": 1528578000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T00:00:00.000Z", - "key": 1528588800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T03:00:00.000Z", - "key": 1528599600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T06:00:00.000Z", - "key": 1528610400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T09:00:00.000Z", - "key": 1528621200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T12:00:00.000Z", - "key": 1528632000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T15:00:00.000Z", - "key": 1528642800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T18:00:00.000Z", - "key": 1528653600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-10T21:00:00.000Z", - "key": 1528664400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T00:00:00.000Z", - "key": 1528675200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T03:00:00.000Z", - "key": 1528686000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T06:00:00.000Z", - "key": 1528696800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T09:00:00.000Z", - "key": 1528707600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T12:00:00.000Z", - "key": 1528718400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T15:00:00.000Z", - "key": 1528729200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T18:00:00.000Z", - "key": 1528740000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-11T21:00:00.000Z", - "key": 1528750800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T00:00:00.000Z", - "key": 1528761600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T03:00:00.000Z", - "key": 1528772400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T06:00:00.000Z", - "key": 1528783200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T09:00:00.000Z", - "key": 1528794000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T12:00:00.000Z", - "key": 1528804800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T15:00:00.000Z", - "key": 1528815600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T18:00:00.000Z", - "key": 1528826400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-12T21:00:00.000Z", - "key": 1528837200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T00:00:00.000Z", - "key": 1528848000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T03:00:00.000Z", - "key": 1528858800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T06:00:00.000Z", - "key": 1528869600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T09:00:00.000Z", - "key": 1528880400000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T12:00:00.000Z", - "key": 1528891200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T15:00:00.000Z", - "key": 1528902000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T18:00:00.000Z", - "key": 1528912800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-13T21:00:00.000Z", - "key": 1528923600000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-14T00:00:00.000Z", - "key": 1528934400000, - "doc_count": 2155 - }, - { - "key_as_string": "2018-06-14T03:00:00.000Z", - "key": 1528945200000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-14T06:00:00.000Z", - "key": 1528956000000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-14T09:00:00.000Z", - "key": 1528966800000, - "doc_count": 0 - }, - { - "key_as_string": "2018-06-14T12:00:00.000Z", - "key": 1528977600000, - "doc_count": 0 - } - ] - } - } - ] - }, - "response_times": { - "buckets": [ - { - "key_as_string": "2018-06-04T12:00:00.000Z", - "key": 1528113600000, - "doc_count": 18841, - "pct": { - "values": { - "95.0": 82172.85648714812, - "99.0": 293866.3866666665 - } - }, - "avg": { - "value": 26310.63483891513 - } - }, - { - "key_as_string": "2018-06-04T15:00:00.000Z", - "key": 1528124400000, - "doc_count": 18708, - "pct": { - "values": { - "95.0": 80738.78571428556, - "99.0": 293257.27333333343 - } - }, - "avg": { - "value": 26193.277795595466 - } - }, - { - "key_as_string": "2018-06-04T18:00:00.000Z", - "key": 1528135200000, - "doc_count": 18865, - "pct": { - "values": { - "95.0": 77058.03529411761, - "99.0": 290195.8800000004 - } - }, - "avg": { - "value": 25291.787065995228 - } - }, - { - "key_as_string": "2018-06-04T21:00:00.000Z", - "key": 1528146000000, - "doc_count": 18889, - "pct": { - "values": { - "95.0": 77892.20721980717, - "99.0": 278548.1649999994 - } - }, - "avg": { - "value": 24690.306474667796 - } - }, - { - "key_as_string": "2018-06-05T00:00:00.000Z", - "key": 1528156800000, - "doc_count": 19270, - "pct": { - "values": { - "95.0": 77085.86687499998, - "99.0": 290701.8973333341 - } - }, - "avg": { - "value": 24809.8953814219 - } - }, - { - "key_as_string": "2018-06-05T03:00:00.000Z", - "key": 1528167600000, - "doc_count": 19024, - "pct": { - "values": { - "95.0": 80048.3462981744, - "99.0": 286839.5897777779 - } - }, - "avg": { - "value": 25460.0394764508 - } - }, - { - "key_as_string": "2018-06-05T06:00:00.000Z", - "key": 1528178400000, - "doc_count": 18923, - "pct": { - "values": { - "95.0": 84089.21370223971, - "99.0": 287979.5149999999 - } - }, - "avg": { - "value": 26360.440733498916 - } - }, - { - "key_as_string": "2018-06-05T09:00:00.000Z", - "key": 1528189200000, - "doc_count": 18834, - "pct": { - "values": { - "95.0": 84880.90143416924, - "99.0": 300107.5009999992 - } - }, - "avg": { - "value": 27050.95205479452 - } - }, - { - "key_as_string": "2018-06-05T12:00:00.000Z", - "key": 1528200000000, - "doc_count": 18694, - "pct": { - "values": { - "95.0": 84554.8884781166, - "99.0": 294402.2179999999 - } - }, - "avg": { - "value": 26555.857333903925 - } - }, - { - "key_as_string": "2018-06-05T15:00:00.000Z", - "key": 1528210800000, - "doc_count": 19184, - "pct": { - "values": { - "95.0": 81839.39583333326, - "99.0": 289849.459333332 - } - }, - "avg": { - "value": 26164.343359049206 - } - }, - { - "key_as_string": "2018-06-05T18:00:00.000Z", - "key": 1528221600000, - "doc_count": 18850, - "pct": { - "values": { - "95.0": 85993.55410163336, - "99.0": 296942.86299999955 - } - }, - "avg": { - "value": 26989.84546419098 - } - }, - { - "key_as_string": "2018-06-05T21:00:00.000Z", - "key": 1528232400000, - "doc_count": 18897, - "pct": { - "values": { - "95.0": 85001.44588628765, - "99.0": 292048.20571428596 - } - }, - "avg": { - "value": 26314.409430068266 - } - }, - { - "key_as_string": "2018-06-06T00:00:00.000Z", - "key": 1528243200000, - "doc_count": 18942, - "pct": { - "values": { - "95.0": 86980.16445312503, - "99.0": 299308.7371666667 - } - }, - "avg": { - "value": 27460.774575018477 - } - }, - { - "key_as_string": "2018-06-06T03:00:00.000Z", - "key": 1528254000000, - "doc_count": 19147, - "pct": { - "values": { - "95.0": 84961.8710743802, - "99.0": 292151.2377777781 - } - }, - "avg": { - "value": 26461.469107431974 - } - }, - { - "key_as_string": "2018-06-06T06:00:00.000Z", - "key": 1528264800000, - "doc_count": 18853, - "pct": { - "values": { - "95.0": 88906.54601889332, - "99.0": 302274.4192592592 - } - }, - "avg": { - "value": 27657.584946692834 - } - }, - { - "key_as_string": "2018-06-06T09:00:00.000Z", - "key": 1528275600000, - "doc_count": 18609, - "pct": { - "values": { - "95.0": 90198.34708994703, - "99.0": 299457.1612121209 - } - }, - "avg": { - "value": 27940.445967005213 - } - }, - { - "key_as_string": "2018-06-06T12:00:00.000Z", - "key": 1528286400000, - "doc_count": 21402, - "pct": { - "values": { - "95.0": 135627.71242424246, - "99.0": 350398.59259259375 - } - }, - "avg": { - "value": 34454.377581534434 - } - }, - { - "key_as_string": "2018-06-06T15:00:00.000Z", - "key": 1528297200000, - "doc_count": 19051, - "pct": { - "values": { - "95.0": 167037.1993837535, - "99.0": 421204.23333333334 - } - }, - "avg": { - "value": 44024.31809353839 - } - }, - { - "key_as_string": "2018-06-06T18:00:00.000Z", - "key": 1528308000000, - "doc_count": 19020, - "pct": { - "values": { - "95.0": 128293.12184873945, - "99.0": 368166.68976190523 - } - }, - "avg": { - "value": 36374.53333333333 - } - }, - { - "key_as_string": "2018-06-06T21:00:00.000Z", - "key": 1528318800000, - "doc_count": 18582, - "pct": { - "values": { - "95.0": 130653.54236263742, - "99.0": 367193.6128571426 - } - }, - "avg": { - "value": 36991.29442471209 - } - }, - { - "key_as_string": "2018-06-07T00:00:00.000Z", - "key": 1528329600000, - "doc_count": 18875, - "pct": { - "values": { - "95.0": 131630.8902645502, - "99.0": 375658.10190476174 - } - }, - "avg": { - "value": 37178.002701986756 - } - }, - { - "key_as_string": "2018-06-07T03:00:00.000Z", - "key": 1528340400000, - "doc_count": 18993, - "pct": { - "values": { - "95.0": 133581.33541666638, - "99.0": 368152.03822222137 - } - }, - "avg": { - "value": 37605.57078923814 - } - }, - { - "key_as_string": "2018-06-07T06:00:00.000Z", - "key": 1528351200000, - "doc_count": 19037, - "pct": { - "values": { - "95.0": 132697.92762266204, - "99.0": 365705.8319999995 - } - }, - "avg": { - "value": 37319.89767295267 - } - }, - { - "key_as_string": "2018-06-07T09:00:00.000Z", - "key": 1528362000000, - "doc_count": 18985, - "pct": { - "values": { - "95.0": 140003.6918918918, - "99.0": 380075.48533333326 - } - }, - "avg": { - "value": 38709.5041348433 - } - }, - { - "key_as_string": "2018-06-07T12:00:00.000Z", - "key": 1528372800000, - "doc_count": 18505, - "pct": { - "values": { - "95.0": 138149.5673529411, - "99.0": 375697.1923809518 - } - }, - "avg": { - "value": 38140.131856255066 - } - }, - { - "key_as_string": "2018-06-07T15:00:00.000Z", - "key": 1528383600000, - "doc_count": 18991, - "pct": { - "values": { - "95.0": 121872.37504835591, - "99.0": 351080.94111111073 - } - }, - "avg": { - "value": 34564.81091043125 - } - }, - { - "key_as_string": "2018-06-07T18:00:00.000Z", - "key": 1528394400000, - "doc_count": 18917, - "pct": { - "values": { - "95.0": 116378.03873517792, - "99.0": 339294.12799999997 - } - }, - "avg": { - "value": 33256.37743828302 - } - }, - { - "key_as_string": "2018-06-07T21:00:00.000Z", - "key": 1528405200000, - "doc_count": 18744, - "pct": { - "values": { - "95.0": 131545.40999999995, - "99.0": 378902.90649999987 - } - }, - "avg": { - "value": 37251.5625266752 - } - }, - { - "key_as_string": "2018-06-08T00:00:00.000Z", - "key": 1528416000000, - "doc_count": 19157, - "pct": { - "values": { - "95.0": 133111.25804878055, - "99.0": 384483.3233333327 - } - }, - "avg": { - "value": 38681.89084929791 - } - }, - { - "key_as_string": "2018-06-08T03:00:00.000Z", - "key": 1528426800000, - "doc_count": 18552, - "pct": { - "values": { - "95.0": 144821.9855278593, - "99.0": 394692.25000000105 - } - }, - "avg": { - "value": 40677.801045709355 - } - }, - { - "key_as_string": "2018-06-08T06:00:00.000Z", - "key": 1528437600000, - "doc_count": 18994, - "pct": { - "values": { - "95.0": 134737.3997727272, - "99.0": 403362.50399999996 - } - }, - "avg": { - "value": 39987.86453616932 - } - }, - { - "key_as_string": "2018-06-08T09:00:00.000Z", - "key": 1528448400000, - "doc_count": 18798, - "pct": { - "values": { - "95.0": 141206.57726666646, - "99.0": 396559.0274999993 - } - }, - "avg": { - "value": 41059.392914139804 - } - }, - { - "key_as_string": "2018-06-08T12:00:00.000Z", - "key": 1528459200000, - "doc_count": 19097, - "pct": { - "values": { - "95.0": 137731.8994082841, - "99.0": 371815.8320000008 - } - }, - "avg": { - "value": 39630.710111535845 - } - }, - { - "key_as_string": "2018-06-08T15:00:00.000Z", - "key": 1528470000000, - "doc_count": 18887, - "pct": { - "values": { - "95.0": 141476.23189033198, - "99.0": 405477.6133333326 - } - }, - "avg": { - "value": 41561.81331074284 - } - }, - { - "key_as_string": "2018-06-08T18:00:00.000Z", - "key": 1528480800000, - "doc_count": 18949, - "pct": { - "values": { - "95.0": 149636.31340909077, - "99.0": 413542.18133333366 - } - }, - "avg": { - "value": 43079.490738297536 - } - }, - { - "key_as_string": "2018-06-08T21:00:00.000Z", - "key": 1528491600000, - "doc_count": 18786, - "pct": { - "values": { - "95.0": 151934.55000000002, - "99.0": 424399.340000001 - } - }, - "avg": { - "value": 43925.39609283509 - } - }, - { - "key_as_string": "2018-06-09T00:00:00.000Z", - "key": 1528502400000, - "doc_count": 5096, - "pct": { - "values": { - "95.0": 82198.17857142858, - "99.0": 303815.9000000001 - } - }, - "avg": { - "value": 25821.91424646782 - } - }, - { - "key_as_string": "2018-06-09T03:00:00.000Z", - "key": 1528513200000, - "doc_count": 5104, - "pct": { - "values": { - "95.0": 85946.43199999983, - "99.0": 306305.0800000006 - } - }, - "avg": { - "value": 27343.60011755486 - } - }, - { - "key_as_string": "2018-06-09T06:00:00.000Z", - "key": 1528524000000, - "doc_count": 5122, - "pct": { - "values": { - "95.0": 78617.66249999996, - "99.0": 297521.94999999984 - } - }, - "avg": { - "value": 25249.95060523233 - } - }, - { - "key_as_string": "2018-06-09T09:00:00.000Z", - "key": 1528534800000, - "doc_count": 5184, - "pct": { - "values": { - "95.0": 79606.48333333322, - "99.0": 317938.0900000003 - } - }, - "avg": { - "value": 25492.77199074074 - } - }, - { - "key_as_string": "2018-06-09T12:00:00.000Z", - "key": 1528545600000, - "doc_count": 5279, - "pct": { - "values": { - "95.0": 76297.93999999986, - "99.0": 312262.3000000003 - } - }, - "avg": { - "value": 25991.647281682137 - } - }, - { - "key_as_string": "2018-06-09T15:00:00.000Z", - "key": 1528556400000, - "doc_count": 5254, - "pct": { - "values": { - "95.0": 80742.63333333324, - "99.0": 318428.8700000002 - } - }, - "avg": { - "value": 26273.31290445375 - } - }, - { - "key_as_string": "2018-06-09T18:00:00.000Z", - "key": 1528567200000, - "doc_count": 5082, - "pct": { - "values": { - "95.0": 81291.45969696966, - "99.0": 295421.4099999999 - } - }, - "avg": { - "value": 26234.98976780795 - } - }, - { - "key_as_string": "2018-06-09T21:00:00.000Z", - "key": 1528578000000, - "doc_count": 5150, - "pct": { - "values": { - "95.0": 73467.02500000004, - "99.0": 293067.86000000004 - } - }, - "avg": { - "value": 23494.54873786408 - } - }, - { - "key_as_string": "2018-06-10T00:00:00.000Z", - "key": 1528588800000, - "doc_count": 5103, - "pct": { - "values": { - "95.0": 69177.66999999993, - "99.0": 264935.71999999933 - } - }, - "avg": { - "value": 22008.80482069371 - } - }, - { - "key_as_string": "2018-06-10T03:00:00.000Z", - "key": 1528599600000, - "doc_count": 5137, - "pct": { - "values": { - "95.0": 71956.06111111109, - "99.0": 282795.0400000003 - } - }, - "avg": { - "value": 22828.136655635586 - } - }, - { - "key_as_string": "2018-06-10T06:00:00.000Z", - "key": 1528610400000, - "doc_count": 5184, - "pct": { - "values": { - "95.0": 68480.91142857139, - "99.0": 285390.8400000001 - } - }, - "avg": { - "value": 22138.7081404321 - } - }, - { - "key_as_string": "2018-06-10T09:00:00.000Z", - "key": 1528621200000, - "doc_count": 4993, - "pct": { - "values": { - "95.0": 68957.0999999999, - "99.0": 290402.24 - } - }, - "avg": { - "value": 22634.985579811735 - } - }, - { - "key_as_string": "2018-06-10T12:00:00.000Z", - "key": 1528632000000, - "doc_count": 5210, - "pct": { - "values": { - "95.0": 67489.50416666668, - "99.0": 293655.53 - } - }, - "avg": { - "value": 22202.780998080616 - } - }, - { - "key_as_string": "2018-06-10T15:00:00.000Z", - "key": 1528642800000, - "doc_count": 5122, - "pct": { - "values": { - "95.0": 71556.91249999998, - "99.0": 292723.56999999995 - } - }, - "avg": { - "value": 23084.082780163997 - } - }, - { - "key_as_string": "2018-06-10T18:00:00.000Z", - "key": 1528653600000, - "doc_count": 5125, - "pct": { - "values": { - "95.0": 72157.65128205132, - "99.0": 301051.32000000105 - } - }, - "avg": { - "value": 23109.666146341464 - } - }, - { - "key_as_string": "2018-06-10T21:00:00.000Z", - "key": 1528664400000, - "doc_count": 5186, - "pct": { - "values": { - "95.0": 76124.5625, - "99.0": 291322.0499999998 - } - }, - "avg": { - "value": 23306.89028152719 - } - }, - { - "key_as_string": "2018-06-11T00:00:00.000Z", - "key": 1528675200000, - "doc_count": 18631, - "pct": { - "values": { - "95.0": 141709.34661835746, - "99.0": 379855.2444444447 - } - }, - "avg": { - "value": 39341.022704095325 - } - }, - { - "key_as_string": "2018-06-11T03:00:00.000Z", - "key": 1528686000000, - "doc_count": 19349, - "pct": { - "values": { - "95.0": 132371.48641975303, - "99.0": 371175.2592000001 - } - }, - "avg": { - "value": 37467.17153341258 - } - }, - { - "key_as_string": "2018-06-11T06:00:00.000Z", - "key": 1528696800000, - "doc_count": 18586, - "pct": { - "values": { - "95.0": 186783.51503759398, - "99.0": 498378.4238888898 - } - }, - "avg": { - "value": 52457.50554180566 - } - }, - { - "key_as_string": "2018-06-11T09:00:00.000Z", - "key": 1528707600000, - "doc_count": 18887, - "pct": { - "values": { - "95.0": 99540.17819499348, - "99.0": 331118.6599999997 - } - }, - "avg": { - "value": 31327.95780166252 - } - }, - { - "key_as_string": "2018-06-11T12:00:00.000Z", - "key": 1528718400000, - "doc_count": 18866, - "pct": { - "values": { - "95.0": 95982.62454212455, - "99.0": 328101.3999999988 - } - }, - "avg": { - "value": 30695.334941163997 - } - }, - { - "key_as_string": "2018-06-11T15:00:00.000Z", - "key": 1528729200000, - "doc_count": 19469, - "pct": { - "values": { - "95.0": 89559.3525925925, - "99.0": 313951.54249999986 - } - }, - "avg": { - "value": 28895.042785967435 - } - }, - { - "key_as_string": "2018-06-11T18:00:00.000Z", - "key": 1528740000000, - "doc_count": 18767, - "pct": { - "values": { - "95.0": 95769.83153735634, - "99.0": 323340.5274074075 - } - }, - "avg": { - "value": 30649.363989982416 - } - }, - { - "key_as_string": "2018-06-11T21:00:00.000Z", - "key": 1528750800000, - "doc_count": 19006, - "pct": { - "values": { - "95.0": 94063.90833755062, - "99.0": 315055.5047619052 - } - }, - "avg": { - "value": 29802.63622014101 - } - }, - { - "key_as_string": "2018-06-12T00:00:00.000Z", - "key": 1528761600000, - "doc_count": 19082, - "pct": { - "values": { - "95.0": 96399.67269119772, - "99.0": 330070.03599999985 - } - }, - "avg": { - "value": 30759.03002829892 - } - }, - { - "key_as_string": "2018-06-12T03:00:00.000Z", - "key": 1528772400000, - "doc_count": 18908, - "pct": { - "values": { - "95.0": 96436.42520161276, - "99.0": 320531.54416666675 - } - }, - "avg": { - "value": 30399.76549608631 - } - }, - { - "key_as_string": "2018-06-12T06:00:00.000Z", - "key": 1528783200000, - "doc_count": 19055, - "pct": { - "values": { - "95.0": 91860.16988095238, - "99.0": 315137.16628571344 - } - }, - "avg": { - "value": 29421.610233534506 - } - }, - { - "key_as_string": "2018-06-12T09:00:00.000Z", - "key": 1528794000000, - "doc_count": 19047, - "pct": { - "values": { - "95.0": 105989.8333333334, - "99.0": 337251.4042424246 - } - }, - "avg": { - "value": 32641.679897096656 - } - }, - { - "key_as_string": "2018-06-12T12:00:00.000Z", - "key": 1528804800000, - "doc_count": 18733, - "pct": { - "values": { - "95.0": 97937.60342555979, - "99.0": 327054.9243636365 - } - }, - "avg": { - "value": 30621.65440666204 - } - }, - { - "key_as_string": "2018-06-12T15:00:00.000Z", - "key": 1528815600000, - "doc_count": 19079, - "pct": { - "values": { - "95.0": 98967.2249999999, - "99.0": 327653.0000000006 - } - }, - "avg": { - "value": 31039.60391005818 - } - }, - { - "key_as_string": "2018-06-12T18:00:00.000Z", - "key": 1528826400000, - "doc_count": 18907, - "pct": { - "values": { - "95.0": 97561.02469135808, - "99.0": 324505.1399999999 - } - }, - "avg": { - "value": 30954.760723541545 - } - }, - { - "key_as_string": "2018-06-12T21:00:00.000Z", - "key": 1528837200000, - "doc_count": 18971, - "pct": { - "values": { - "95.0": 102557.78813357186, - "99.0": 338040.3999999998 - } - }, - "avg": { - "value": 31902.050234568553 - } - }, - { - "key_as_string": "2018-06-13T00:00:00.000Z", - "key": 1528848000000, - "doc_count": 18899, - "pct": { - "values": { - "95.0": 100137.87578595306, - "99.0": 328600.5173333335 - } - }, - "avg": { - "value": 31594.350653473728 - } - }, - { - "key_as_string": "2018-06-13T03:00:00.000Z", - "key": 1528858800000, - "doc_count": 19182, - "pct": { - "values": { - "95.0": 98412.97120445351, - "99.0": 334060.93628571345 - } - }, - "avg": { - "value": 31343.87243248879 - } - }, - { - "key_as_string": "2018-06-13T06:00:00.000Z", - "key": 1528869600000, - "doc_count": 19030, - "pct": { - "values": { - "95.0": 101607.8328012912, - "99.0": 328569.4964999998 - } - }, - "avg": { - "value": 31200.14450867052 - } - }, - { - "key_as_string": "2018-06-13T09:00:00.000Z", - "key": 1528880400000, - "doc_count": 19257, - "pct": { - "values": { - "95.0": 92000.51368421057, - "99.0": 320227.32399999973 - } - }, - "avg": { - "value": 28560.946668743833 - } - }, - { - "key_as_string": "2018-06-13T12:00:00.000Z", - "key": 1528891200000, - "doc_count": 19348, - "pct": { - "values": { - "95.0": 78027.29473684198, - "99.0": 292019.2899999998 - } - }, - "avg": { - "value": 24700.216146371717 - } - }, - { - "key_as_string": "2018-06-13T15:00:00.000Z", - "key": 1528902000000, - "doc_count": 19119, - "pct": { - "values": { - "95.0": 80762.078801789, - "99.0": 297757.72666666657 - } - }, - "avg": { - "value": 25261.025210523563 - } - }, - { - "key_as_string": "2018-06-13T18:00:00.000Z", - "key": 1528912800000, - "doc_count": 19206, - "pct": { - "values": { - "95.0": 81160.83425925927, - "99.0": 308034.4466666669 - } - }, - "avg": { - "value": 26041.39789649068 - } - }, - { - "key_as_string": "2018-06-13T21:00:00.000Z", - "key": 1528923600000, - "doc_count": 19078, - "pct": { - "values": { - "95.0": 84215.58945578222, - "99.0": 301128.4895238093 - } - }, - "avg": { - "value": 26123.556295209142 - } - }, - { - "key_as_string": "2018-06-14T00:00:00.000Z", - "key": 1528934400000, - "doc_count": 19551, - "pct": { - "values": { - "95.0": 194188.21428571426, - "99.0": 447266.9 - } - }, - "avg": { - "value": 46231.36177177638 - } - }, - { - "key_as_string": "2018-06-14T03:00:00.000Z", - "key": 1528945200000, - "doc_count": 18888, - "pct": { - "values": { - "95.0": 172616.2293896504, - "99.0": 409147.332500001 - } - }, - "avg": { - "value": 45350.42005506141 - } - }, - { - "key_as_string": "2018-06-14T06:00:00.000Z", - "key": 1528956000000, - "doc_count": 18823, - "pct": { - "values": { - "95.0": 182653.81858220184, - "99.0": 423121.9773333328 - } - }, - "avg": { - "value": 48256.049354513096 - } - }, - { - "key_as_string": "2018-06-14T09:00:00.000Z", - "key": 1528966800000, - "doc_count": 18766, - "pct": { - "values": { - "95.0": 194970.75667682925, - "99.0": 473485.4199999998 - } - }, - "avg": { - "value": 52360.30017052116 - } - }, - { - "key_as_string": "2018-06-14T12:00:00.000Z", - "key": 1528977600000, - "doc_count": 0, - "pct": { - "values": { - "95.0": "NaN", - "99.0": "NaN" - } - }, - "avg": { - "value": null - } - } - ] - }, - "overall_avg_duration": { - "value": 32861.15660262639 - } - } -} diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/__snapshots__/get_buckets_with_initial_anomaly_bounds.test.js.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/__snapshots__/get_buckets_with_initial_anomaly_bounds.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/__snapshots__/get_buckets_with_initial_anomaly_bounds.test.js.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/__snapshots__/get_buckets_with_initial_anomaly_bounds.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_anomaly_aggs.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_anomaly_aggs.test.ts index 7ded075a7ae65..a3986292efe21 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_anomaly_aggs.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_anomaly_aggs.test.ts @@ -12,7 +12,9 @@ test('getAnomalyAggs should swallow HTTP errors', () => { httpError.statusCode = 418; const failClient = jest.fn(() => Promise.reject(httpError)); - return expect(getAnomalyAggs({ client: failClient })).resolves.toEqual(null); + return expect(getAnomalyAggs({ client: failClient } as any)).resolves.toEqual( + null + ); }); test('getAnomalyAggs should throw other errors', () => { @@ -22,6 +24,6 @@ test('getAnomalyAggs should throw other errors', () => { return expect( getAnomalyAggs({ client: failClient - }) + } as any) ).rejects.toThrow(otherError); }); diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_avg_response_time_anomalies.test.js b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_avg_response_time_anomalies.test.ts similarity index 79% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_avg_response_time_anomalies.test.js rename to x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_avg_response_time_anomalies.test.ts index c44c5ffe4fc80..2714d0c433aaf 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_avg_response_time_anomalies.test.js +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_avg_response_time_anomalies.test.ts @@ -5,8 +5,8 @@ */ import { getAvgResponseTimeAnomalies } from '../get_avg_response_time_anomalies'; -import mainBucketsResponse from './mockData/mainBucketsResponse'; -import firstBucketsResponse from './mockData/firstBucketsResponse'; +import firstBucketsResponse from './mockData/firstBucketsResponse.json'; +import mainBucketsResponse from './mockData/mainBucketsResponse.json'; describe('get_avg_response_time_anomalies', () => { it('', async () => { @@ -32,23 +32,23 @@ describe('get_avg_response_time_anomalies', () => { bucketSpanAsMillis: 10800000, buckets: [ { - anomaly_score: null, + anomalyScore: null, lower: 17688.182675688193, upper: 50381.01051622894 }, - { anomaly_score: null, lower: null, upper: null }, + { anomalyScore: null, lower: null, upper: null }, { - anomaly_score: 0, + anomalyScore: 0, lower: 16034.081569306454, upper: 54158.77731018045 }, - { anomaly_score: null, lower: null, upper: null }, + { anomalyScore: null, lower: null, upper: null }, { - anomaly_score: 0, + anomalyScore: 0, lower: 16034.081569306454, upper: 54158.77731018045 }, - { anomaly_score: null, lower: null, upper: null } + { anomalyScore: null, lower: null, upper: null } ] }); }); diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_buckets_with_initial_anomaly_bounds.test.js b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_buckets_with_initial_anomaly_bounds.test.ts similarity index 88% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_buckets_with_initial_anomaly_bounds.test.js rename to x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_buckets_with_initial_anomaly_bounds.test.ts index e8b37ee490642..ce25628daeadd 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_buckets_with_initial_anomaly_bounds.test.js +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/__test__/get_buckets_with_initial_anomaly_bounds.test.ts @@ -4,20 +4,20 @@ * you may not use this file except in compliance with the Elastic License. */ +import { AvgResponseTimeBucket } from '../get_anomaly_aggs'; import { getBucketWithInitialAnomalyBounds } from '../get_buckets_with_initial_anomaly_bounds'; -import mainBucketsResponse from './mockData/mainBucketsResponse'; -import firstBucketsResponse from './mockData/firstBucketsResponse'; +import firstBucketsResponse from './mockData/firstBucketsResponse.json'; +import mainBucketsResponse from './mockData/mainBucketsResponse.json'; describe('get_buckets_with_initial_anomaly_bounds', () => { const mainBuckets = mainBucketsResponse.aggregations.ml_avg_response_times.buckets; - let buckets; + let buckets: AvgResponseTimeBucket[]; beforeEach(async () => { buckets = await getBucketWithInitialAnomalyBounds({ serviceName: 'myServiceName', transactionType: 'myTransactionType', - intervalString: '60s', start: 1530523322742, client: () => firstBucketsResponse, mainBuckets, diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_anomaly_aggs.js b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_anomaly_aggs.ts similarity index 66% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_anomaly_aggs.js rename to x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_anomaly_aggs.ts index cae78df06f725..a200fa2149da9 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_anomaly_aggs.js +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_anomaly_aggs.ts @@ -4,6 +4,40 @@ * you may not use this file except in compliance with the Elastic License. */ +import { SearchResponse } from 'elasticsearch'; +import { oc } from 'ts-optchain'; +import { ESClient } from '../../../helpers/setup_request'; + +interface Props { + serviceName: string; + transactionType: string; + intervalString: string; + client: ESClient; + start: number; + end: number; +} + +export interface AvgResponseTimeBucket { + anomaly_score: { + value: number | null; + }; + lower: { + value: number | null; + }; + upper: { + value: number | null; + }; +} + +interface Aggs { + ml_avg_response_times: { + buckets: AvgResponseTimeBucket[]; + }; + top_hits: SearchResponse<{ + bucket_span: number; + }>; +} + export async function getAnomalyAggs({ serviceName, transactionType, @@ -11,7 +45,7 @@ export async function getAnomalyAggs({ client, start, end -}) { +}: Props) { const params = { index: `.ml-anomalies-${serviceName}-${transactionType}-high_mean_response_time`.toLowerCase(), body: { @@ -61,11 +95,14 @@ export async function getAnomalyAggs({ try { const resp = await client('search', params); - return resp.aggregations; + const aggs: Aggs = resp.aggregations; + + return { + avgResponseTimes: oc(aggs).ml_avg_response_times.buckets([]), + bucketSpan: oc(aggs).top_hits.hits.hits[0]._source.bucket_span(0) + }; } catch (err) { if ('statusCode' in err) { - // swallow HTTP errors because there are lots of reasons - // the ml index lookup may fail, and we're ok with that return null; } diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_avg_response_time_anomalies.js b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_avg_response_time_anomalies.ts similarity index 79% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_avg_response_time_anomalies.js rename to x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_avg_response_time_anomalies.ts index 3e950d919b6cc..d1d3ca21c2b24 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_avg_response_time_anomalies.js +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_avg_response_time_anomalies.ts @@ -4,23 +4,30 @@ * you may not use this file except in compliance with the Elastic License. */ -import { get } from 'lodash'; import { getBucketSize } from '../../../helpers/get_bucket_size'; +import { Setup } from '../../../helpers/setup_request'; import { getAnomalyAggs } from './get_anomaly_aggs'; import { getBucketWithInitialAnomalyBounds } from './get_buckets_with_initial_anomaly_bounds'; +interface Props { + serviceName: string; + transactionType: string; + transactionName?: string; + setup: Setup; +} + export async function getAvgResponseTimeAnomalies({ serviceName, transactionType, transactionName, setup -}) { +}: Props) { const { start, end, client } = setup; const { intervalString, bucketSize } = getBucketSize(start, end, 'auto'); // don't fetch anomalies for transaction details page if (transactionName) { - return []; + return; } const aggs = await getAnomalyAggs({ @@ -33,27 +40,17 @@ export async function getAvgResponseTimeAnomalies({ }); if (!aggs) { - return { - message: 'Error reading machine learning index' - }; + return; } - const anomalyBucketSpan = get( - aggs, - 'top_hits.hits.hits[0]._source.bucket_span' - ); - - const mainBuckets = get(aggs, 'ml_avg_response_times.buckets', []).slice( - 1, - -1 - ); - + const anomalyBucketSpan = aggs.bucketSpan; + const mainBuckets = aggs.avgResponseTimes.slice(1, -1); const bucketsWithInitialAnomalyBounds = await getBucketWithInitialAnomalyBounds( { serviceName, transactionType, - client, start, + client, mainBuckets, anomalyBucketSpan } @@ -61,7 +58,7 @@ export async function getAvgResponseTimeAnomalies({ const buckets = bucketsWithInitialAnomalyBounds.map(bucket => { return { - anomaly_score: bucket.anomaly_score.value, + anomalyScore: bucket.anomaly_score.value, lower: bucket.lower.value, upper: bucket.upper.value }; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_buckets_with_initial_anomaly_bounds.js b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_buckets_with_initial_anomaly_bounds.ts similarity index 67% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_buckets_with_initial_anomaly_bounds.js rename to x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_buckets_with_initial_anomaly_bounds.ts index 5d71559232445..4f92fdc0ebc79 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_buckets_with_initial_anomaly_bounds.js +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_avg_response_time_anomalies/get_buckets_with_initial_anomaly_bounds.ts @@ -4,17 +4,27 @@ * you may not use this file except in compliance with the Elastic License. */ -import { last, get } from 'lodash'; -import { getAnomalyAggs } from './get_anomaly_aggs'; +import { last } from 'lodash'; +import { ESClient } from '../../../helpers/setup_request'; +import { AvgResponseTimeBucket, getAnomalyAggs } from './get_anomaly_aggs'; + +interface Props { + serviceName: string; + transactionType: string; + mainBuckets: AvgResponseTimeBucket[]; + anomalyBucketSpan: number; + start: number; + client: ESClient; +} export async function getBucketWithInitialAnomalyBounds({ serviceName, transactionType, - client, - start, mainBuckets, - anomalyBucketSpan -}) { + anomalyBucketSpan, + start, + client +}: Props) { // abort if first bucket already has values for initial anomaly bounds if (mainBuckets[0].lower.value || !anomalyBucketSpan) { return mainBuckets; @@ -32,10 +42,13 @@ export async function getBucketWithInitialAnomalyBounds({ end: newEnd }); + // TODO: this should be possible and should be handled better + if (!aggs) { + return []; + } + const firstBucketWithBounds = last( - get(aggs, 'ml_avg_response_times.buckets', []).filter( - bucket => bucket.lower.value - ) + aggs.avgResponseTimes.filter(bucket => bucket.lower.value) ); return mainBuckets.map((bucket, i) => { diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/__snapshots__/get_timeseries_data.test.js.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/__snapshots__/get_timeseries_data.test.ts.snap similarity index 89% rename from x-pack/plugins/apm/server/lib/transactions/charts/__test__/__snapshots__/get_timeseries_data.test.js.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/__snapshots__/get_timeseries_data.test.ts.snap index 7cee615bee11e..18be84815ae9a 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/__test__/__snapshots__/get_timeseries_data.test.js.snap +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/__snapshots__/get_timeseries_data.test.ts.snap @@ -242,8 +242,8 @@ Object { 1528956000000, 1528966800000, ], - "overall_avg_duration": 32861.15660262639, - "response_times": Object { + "overallAvgDuration": 32861.15660262639, + "responseTimes": Object { "avg": Array [ 26193.277795595466, 25291.787065995228, @@ -325,401 +325,401 @@ Object { 48256.049354513096, 52360.30017052116, ], - "avg_anomalies": Object { + "avgAnomalies": Object { "bucketSpanAsMillis": 10800000, "buckets": Array [ Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 737.7398559597923, "upper": 27505.95012649385, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 740.6510789069575, "upper": 27831.385094457328, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 743.0092006506535, "upper": 28113.842130309873, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 745.266369017907, "upper": 28166.937431054437, }, Object { - "anomaly_score": 0.0214167, + "anomalyScore": 0.0214167, "lower": 747.3207728528188, "upper": 28506.23990430994, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 749.6894207909651, "upper": 29019.425285291298, }, Object { - "anomaly_score": 0.05939392, + "anomalyScore": 0.05939392, "lower": 752.7726473096143, "upper": 29293.392326541318, }, Object { - "anomaly_score": 0.01836784, + "anomalyScore": 0.01836784, "lower": 754.7407389918743, "upper": 29812.56398272085, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 757.2268079827784, "upper": 30060.955415439636, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 758.3112520555287, "upper": 30376.319798106222, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 761.9827340264112, "upper": 30627.243996529527, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 771.7209606007517, "upper": 31035.75952712361, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 822.9174906119024, "upper": 31062.244462967443, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 867.1132870297309, "upper": 31463.705363442183, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 871.6217257693573, "upper": 31743.78493690837, }, Object { - "anomaly_score": 93.09271062370188, + "anomalyScore": 93.09271062370188, "lower": 630.1794765317344, "upper": 42784.833235636936, }, Object { - "anomaly_score": 94.91969, + "anomalyScore": 94.91969, "lower": 871.0283056454996, "upper": 34441.21907642463, }, Object { - "anomaly_score": 0.737564554333639, + "anomalyScore": 0.737564554333639, "lower": 872.694053998953, "upper": 35467.552283525925, }, Object { - "anomaly_score": 0.2233028643272195, + "anomalyScore": 0.2233028643272195, "lower": 872.8967719351887, "upper": 36793.04873774251, }, Object { - "anomaly_score": 4.367981, + "anomalyScore": 4.367981, "lower": 873.2094351335686, "upper": 37663.180967734144, }, Object { - "anomaly_score": 10.94823, + "anomalyScore": 10.94823, "lower": 872.096335158222, "upper": 38704.9736025016, }, Object { - "anomaly_score": 0.025502508470513552, + "anomalyScore": 0.025502508470513552, "lower": 870.7141079237686, "upper": 39411.4696425657, }, Object { - "anomaly_score": 0.04643894365231562, + "anomalyScore": 0.04643894365231562, "lower": 865.6904233415615, "upper": 40436.89001900413, }, Object { - "anomaly_score": 0.08232853094836577, + "anomalyScore": 0.08232853094836577, "lower": 864.5587212551438, "upper": 41583.671803791396, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 862.0456649399898, "upper": 41918.88300390927, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 862.6952960489333, "upper": 42346.34733913561, }, Object { - "anomaly_score": 0.09328928850624264, + "anomalyScore": 0.09328928850624264, "lower": 859.02865711764, "upper": 43503.30873034762, }, Object { - "anomaly_score": 0.01490678070537287, + "anomalyScore": 0.01490678070537287, "lower": 853.1249075544679, "upper": 43582.32622523151, }, Object { - "anomaly_score": 0.025631694904640304, + "anomalyScore": 0.025631694904640304, "lower": 850.0412997919607, "upper": 44583.7194942183, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 846.9251200783423, "upper": 45027.0923125673, }, Object { - "anomaly_score": 0.1775235302080928, + "anomalyScore": 0.1775235302080928, "lower": 839.9462033017412, "upper": 46355.1414826366, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 740.8424736560071, "upper": 46997.18507921725, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 675.2681661332581, "upper": 47730.52441880603, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 672.90202453507, "upper": 48709.29810572524, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 676.0944399455826, "upper": 49406.64628717409, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 682.4396257998045, "upper": 73477.3874808886, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 686.44341250381, "upper": 73487.82525090317, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 690.5371630779586, "upper": 72962.57745081023, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 695.8034104561633, "upper": 72489.77380542927, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 707.6839448592744, "upper": 72463.76348179985, }, Object { - "anomaly_score": 0.18086821490763677, + "anomalyScore": 0.18086821490763677, "lower": 781.8674002616508, "upper": 72996.2561390666, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 846.540373740061, "upper": 73169.30855560771, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 860.5368537637945, "upper": 73491.08437587181, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 863.0293573898325, "upper": 72389.78456634001, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 863.4144235290587, "upper": 72311.41927730369, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 863.6781514985616, "upper": 71383.41956191002, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 863.4492510434609, "upper": 74565.86466696904, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 863.1958870174615, "upper": 71304.14035324028, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 862.6161500045084, "upper": 72434.51561823535, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 861.9526316405551, "upper": 71664.49530601672, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 861.1638627191994, "upper": 71264.41362778837, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 860.1741427701811, "upper": 49087.805718943775, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 862.4069845546885, "upper": 49089.84051479006, }, Object { - "anomaly_score": 2.718289217634223, + "anomalyScore": 2.718289217634223, "lower": 862.7834836635291, "upper": 51834.13246654848, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 863.5914163409548, "upper": 51136.66870946708, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 865.9550918866486, "upper": 50968.889501405334, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 866.5727896346234, "upper": 51039.136906324355, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 866.4824432593966, "upper": 50450.44063039239, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 869.2106974966512, "upper": 49883.2079974308, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 869.7908032042425, "upper": 50019.796552072105, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 872.0969808877924, "upper": 50352.19806206938, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 873.8327021716271, "upper": 49893.959882267525, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 875.6449156690691, "upper": 49882.868445094966, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 874.6294655070553, "upper": 49766.53895122279, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 878.2077083935897, "upper": 49424.25380462067, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 879.6702185935983, "upper": 50079.967231416216, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 880.9475908626134, "upper": 49447.853072406695, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 883.2355577302953, "upper": 49628.237099331986, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 885.0345875232065, "upper": 49121.655177004985, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 886.8375619687324, "upper": 49439.75445560749, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 888.2875318407426, "upper": 49095.91031920496, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 887.4807424937617, "upper": 48584.97256737151, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 885.3782512926099, "upper": 48401.4014885278, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 883.9626695681782, "upper": 48303.662251777845, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 881.5723811019918, "upper": 48079.01124458592, }, Object { - "anomaly_score": 66.42568, + "anomalyScore": 66.42568, "lower": 0, "upper": 58715.507088231585, }, Object { - "anomaly_score": 0, + "anomalyScore": 0, "lower": 0, "upper": 49868.15796918666, }, Object { - "anomaly_score": 0.060750193569274885, + "anomalyScore": 0.060750193569274885, "lower": 2003.2599232283408, "upper": 50310.902258087066, }, Object { - "anomaly_score": 0.2831448638843196, + "anomalyScore": 0.2831448638843196, "lower": 1346.2241502014724, "upper": 51642.47679276076, }, @@ -888,8 +888,8 @@ Object { 473485.4199999998, ], }, - "total_hits": 1297673, - "tpm_buckets": Array [ + "totalHits": 1297673, + "tpmBuckets": Array [ Object { "avg": 78.106329113924, "key": "HTTP 2xx", diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/get_timeseries_data.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/get_timeseries_data.test.ts new file mode 100644 index 0000000000000..d8ad065012386 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/get_timeseries_data.test.ts @@ -0,0 +1,127 @@ +/* + * 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 _ from 'lodash'; +import { + getTimeseriesData, + getTpmBuckets, + TimeSeriesResponse +} from '../get_timeseries_data'; +import { responseTimeAnomalyResponse } from './response_time_anomaly_response'; +import { timeseriesResponse } from './timeseries_response'; + +describe('get_timeseries_data', () => { + let res: TimeSeriesResponse; + let clientSpy: jest.Mock; + beforeEach(async () => { + clientSpy = jest + .fn() + .mockResolvedValueOnce(timeseriesResponse) + .mockResolvedValueOnce(responseTimeAnomalyResponse); + + res = await getTimeseriesData({ + serviceName: 'myServiceName', + transactionType: 'myTransactionType', + transactionName: undefined, + setup: { + start: 1528113600000, + end: 1528977600000, + client: clientSpy, + config: { + get: () => 'myIndex' + } + } + }); + }); + + it('should call client with correct query', () => { + expect(clientSpy.mock.calls).toMatchSnapshot(); + }); + + it('should not contain first and last bucket', () => { + const mockDates = timeseriesResponse.aggregations.transaction_results.buckets[0].timeseries.buckets.map( + bucket => bucket.key + ); + + expect(res.dates).not.toContain(_.first(mockDates)); + expect(res.dates).not.toContain(_.last(mockDates)); + expect(res.tpmBuckets[0].values).toHaveLength(res.dates.length); + }); + + it('should have correct order', () => { + expect(res.tpmBuckets.map(bucket => bucket.key)).toEqual([ + 'HTTP 2xx', + 'HTTP 3xx', + 'HTTP 4xx', + 'HTTP 5xx', + 'A Custom Bucket (that should be last)' + ]); + }); + + it('should match snapshot', () => { + expect(res).toMatchSnapshot(); + }); +}); + +describe('getTpmBuckets', () => { + it('should return response', () => { + const buckets = [ + { + key: 'HTTP 4xx', + doc_count: 300, + timeseries: { + buckets: [ + { + key: 0, + doc_count: 0 + }, + { + key: 1, + doc_count: 200 + }, + { + key: 2, + doc_count: 300 + }, + { + key: 3, + doc_count: 1337 + } + ] + } + }, + { + key: 'HTTP 5xx', + doc_count: 400, + timeseries: { + buckets: [ + { + key: 0, + doc_count: 0 + }, + { + key: 1, + doc_count: 500 + }, + { + key: 2, + doc_count: 100 + }, + { + key: 3, + doc_count: 1337 + } + ] + } + } + ]; + const bucketSize = 10; + expect(getTpmBuckets(buckets, bucketSize)).toEqual([ + { avg: 1500, key: 'HTTP 4xx', values: [1200, 1800] }, + { avg: 1800, key: 'HTTP 5xx', values: [3000, 600] } + ]); + }); +}); diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/response_time_anomaly_response.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/response_time_anomaly_response.ts new file mode 100644 index 0000000000000..46ad05cbdbaa3 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/response_time_anomaly_response.ts @@ -0,0 +1,1180 @@ +/* + * 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 const responseTimeAnomalyResponse = { + took: 14, + timed_out: false, + _shards: { + total: 5, + successful: 5, + skipped: 0, + failed: 0 + }, + hits: { + total: 4117, + max_score: 0, + hits: [] + }, + aggregations: { + ml_avg_response_times: { + buckets: [ + { + key_as_string: '2018-06-04T12:00:00.000Z', + key: 1528113600000, + doc_count: 60, + anomaly_score: { + value: 0.07062823 + }, + upper: { + value: 26781.294783193 + }, + lower: { + value: 734.6120832292385 + } + }, + { + key_as_string: '2018-06-04T15:00:00.000Z', + key: 1528124400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 27505.95012649385 + }, + lower: { + value: 737.7398559597923 + } + }, + { + key_as_string: '2018-06-04T18:00:00.000Z', + key: 1528135200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 27831.385094457328 + }, + lower: { + value: 740.6510789069575 + } + }, + { + key_as_string: '2018-06-04T21:00:00.000Z', + key: 1528146000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 28113.842130309873 + }, + lower: { + value: 743.0092006506535 + } + }, + { + key_as_string: '2018-06-05T00:00:00.000Z', + key: 1528156800000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 28166.937431054437 + }, + lower: { + value: 745.266369017907 + } + }, + { + key_as_string: '2018-06-05T03:00:00.000Z', + key: 1528167600000, + doc_count: 50, + anomaly_score: { + value: 0.0214167 + }, + upper: { + value: 28506.23990430994 + }, + lower: { + value: 747.3207728528188 + } + }, + { + key_as_string: '2018-06-05T06:00:00.000Z', + key: 1528178400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 29019.425285291298 + }, + lower: { + value: 749.6894207909651 + } + }, + { + key_as_string: '2018-06-05T09:00:00.000Z', + key: 1528189200000, + doc_count: 51, + anomaly_score: { + value: 0.05939392 + }, + upper: { + value: 29293.392326541318 + }, + lower: { + value: 752.7726473096143 + } + }, + { + key_as_string: '2018-06-05T12:00:00.000Z', + key: 1528200000000, + doc_count: 50, + anomaly_score: { + value: 0.01836784 + }, + upper: { + value: 29812.56398272085 + }, + lower: { + value: 754.7407389918743 + } + }, + { + key_as_string: '2018-06-05T15:00:00.000Z', + key: 1528210800000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 30060.955415439636 + }, + lower: { + value: 757.2268079827784 + } + }, + { + key_as_string: '2018-06-05T18:00:00.000Z', + key: 1528221600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 30376.319798106222 + }, + lower: { + value: 758.3112520555287 + } + }, + { + key_as_string: '2018-06-05T21:00:00.000Z', + key: 1528232400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 30627.243996529527 + }, + lower: { + value: 761.9827340264112 + } + }, + { + key_as_string: '2018-06-06T00:00:00.000Z', + key: 1528243200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 31035.75952712361 + }, + lower: { + value: 771.7209606007517 + } + }, + { + key_as_string: '2018-06-06T03:00:00.000Z', + key: 1528254000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 31062.244462967443 + }, + lower: { + value: 822.9174906119024 + } + }, + { + key_as_string: '2018-06-06T06:00:00.000Z', + key: 1528264800000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 31463.705363442183 + }, + lower: { + value: 867.1132870297309 + } + }, + { + key_as_string: '2018-06-06T09:00:00.000Z', + key: 1528275600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 31743.78493690837 + }, + lower: { + value: 871.6217257693573 + } + }, + { + key_as_string: '2018-06-06T12:00:00.000Z', + key: 1528286400000, + doc_count: 86, + anomaly_score: { + value: 93.09271062370188 + }, + upper: { + value: 42784.833235636936 + }, + lower: { + value: 630.1794765317344 + } + }, + { + key_as_string: '2018-06-06T15:00:00.000Z', + key: 1528297200000, + doc_count: 94, + anomaly_score: { + value: 94.91969 + }, + upper: { + value: 34441.21907642463 + }, + lower: { + value: 871.0283056454996 + } + }, + { + key_as_string: '2018-06-06T18:00:00.000Z', + key: 1528308000000, + doc_count: 76, + anomaly_score: { + value: 0.737564554333639 + }, + upper: { + value: 35467.552283525925 + }, + lower: { + value: 872.694053998953 + } + }, + { + key_as_string: '2018-06-06T21:00:00.000Z', + key: 1528318800000, + doc_count: 62, + anomaly_score: { + value: 0.2233028643272195 + }, + upper: { + value: 36793.04873774251 + }, + lower: { + value: 872.8967719351887 + } + }, + { + key_as_string: '2018-06-07T00:00:00.000Z', + key: 1528329600000, + doc_count: 56, + anomaly_score: { + value: 4.367981 + }, + upper: { + value: 37663.180967734144 + }, + lower: { + value: 873.2094351335686 + } + }, + { + key_as_string: '2018-06-07T03:00:00.000Z', + key: 1528340400000, + doc_count: 74, + anomaly_score: { + value: 10.94823 + }, + upper: { + value: 38704.9736025016 + }, + lower: { + value: 872.096335158222 + } + }, + { + key_as_string: '2018-06-07T06:00:00.000Z', + key: 1528351200000, + doc_count: 50, + anomaly_score: { + value: 0.025502508470513552 + }, + upper: { + value: 39411.4696425657 + }, + lower: { + value: 870.7141079237686 + } + }, + { + key_as_string: '2018-06-07T09:00:00.000Z', + key: 1528362000000, + doc_count: 52, + anomaly_score: { + value: 0.04643894365231562 + }, + upper: { + value: 40436.89001900413 + }, + lower: { + value: 865.6904233415615 + } + }, + { + key_as_string: '2018-06-07T12:00:00.000Z', + key: 1528372800000, + doc_count: 52, + anomaly_score: { + value: 0.08232853094836577 + }, + upper: { + value: 41583.671803791396 + }, + lower: { + value: 864.5587212551438 + } + }, + { + key_as_string: '2018-06-07T15:00:00.000Z', + key: 1528383600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 41918.88300390927 + }, + lower: { + value: 862.0456649399898 + } + }, + { + key_as_string: '2018-06-07T18:00:00.000Z', + key: 1528394400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 42346.34733913561 + }, + lower: { + value: 862.6952960489333 + } + }, + { + key_as_string: '2018-06-07T21:00:00.000Z', + key: 1528405200000, + doc_count: 50, + anomaly_score: { + value: 0.09328928850624264 + }, + upper: { + value: 43503.30873034762 + }, + lower: { + value: 859.02865711764 + } + }, + { + key_as_string: '2018-06-08T00:00:00.000Z', + key: 1528416000000, + doc_count: 50, + anomaly_score: { + value: 0.01490678070537287 + }, + upper: { + value: 43582.32622523151 + }, + lower: { + value: 853.1249075544679 + } + }, + { + key_as_string: '2018-06-08T03:00:00.000Z', + key: 1528426800000, + doc_count: 50, + anomaly_score: { + value: 0.025631694904640304 + }, + upper: { + value: 44583.7194942183 + }, + lower: { + value: 850.0412997919607 + } + }, + { + key_as_string: '2018-06-08T06:00:00.000Z', + key: 1528437600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 45027.0923125673 + }, + lower: { + value: 846.9251200783423 + } + }, + { + key_as_string: '2018-06-08T09:00:00.000Z', + key: 1528448400000, + doc_count: 52, + anomaly_score: { + value: 0.1775235302080928 + }, + upper: { + value: 46355.1414826366 + }, + lower: { + value: 839.9462033017412 + } + }, + { + key_as_string: '2018-06-08T12:00:00.000Z', + key: 1528459200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 46997.18507921725 + }, + lower: { + value: 740.8424736560071 + } + }, + { + key_as_string: '2018-06-08T15:00:00.000Z', + key: 1528470000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 47730.52441880603 + }, + lower: { + value: 675.2681661332581 + } + }, + { + key_as_string: '2018-06-08T18:00:00.000Z', + key: 1528480800000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 48709.29810572524 + }, + lower: { + value: 672.90202453507 + } + }, + { + key_as_string: '2018-06-08T21:00:00.000Z', + key: 1528491600000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 49406.64628717409 + }, + lower: { + value: 676.0944399455826 + } + }, + { + key_as_string: '2018-06-09T00:00:00.000Z', + key: 1528502400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 73477.3874808886 + }, + lower: { + value: 682.4396257998045 + } + }, + { + key_as_string: '2018-06-09T03:00:00.000Z', + key: 1528513200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 73487.82525090317 + }, + lower: { + value: 686.44341250381 + } + }, + { + key_as_string: '2018-06-09T06:00:00.000Z', + key: 1528524000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 72962.57745081023 + }, + lower: { + value: 690.5371630779586 + } + }, + { + key_as_string: '2018-06-09T09:00:00.000Z', + key: 1528534800000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 72489.77380542927 + }, + lower: { + value: 695.8034104561633 + } + }, + { + key_as_string: '2018-06-09T12:00:00.000Z', + key: 1528545600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 72463.76348179985 + }, + lower: { + value: 707.6839448592744 + } + }, + { + key_as_string: '2018-06-09T15:00:00.000Z', + key: 1528556400000, + doc_count: 50, + anomaly_score: { + value: 0.18086821490763677 + }, + upper: { + value: 72996.2561390666 + }, + lower: { + value: 781.8674002616508 + } + }, + { + key_as_string: '2018-06-09T18:00:00.000Z', + key: 1528567200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 73169.30855560771 + }, + lower: { + value: 846.540373740061 + } + }, + { + key_as_string: '2018-06-09T21:00:00.000Z', + key: 1528578000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 73491.08437587181 + }, + lower: { + value: 860.5368537637945 + } + }, + { + key_as_string: '2018-06-10T00:00:00.000Z', + key: 1528588800000, + doc_count: 49, + anomaly_score: { + value: 0 + }, + upper: { + value: 72389.78456634001 + }, + lower: { + value: 863.0293573898325 + } + }, + { + key_as_string: '2018-06-10T03:00:00.000Z', + key: 1528599600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 72311.41927730369 + }, + lower: { + value: 863.4144235290587 + } + }, + { + key_as_string: '2018-06-10T06:00:00.000Z', + key: 1528610400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 71383.41956191002 + }, + lower: { + value: 863.6781514985616 + } + }, + { + key_as_string: '2018-06-10T09:00:00.000Z', + key: 1528621200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 74565.86466696904 + }, + lower: { + value: 863.4492510434609 + } + }, + { + key_as_string: '2018-06-10T12:00:00.000Z', + key: 1528632000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 71304.14035324028 + }, + lower: { + value: 863.1958870174615 + } + }, + { + key_as_string: '2018-06-10T15:00:00.000Z', + key: 1528642800000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 72434.51561823535 + }, + lower: { + value: 862.6161500045084 + } + }, + { + key_as_string: '2018-06-10T18:00:00.000Z', + key: 1528653600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 71664.49530601672 + }, + lower: { + value: 861.9526316405551 + } + }, + { + key_as_string: '2018-06-10T21:00:00.000Z', + key: 1528664400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 71264.41362778837 + }, + lower: { + value: 861.1638627191994 + } + }, + { + key_as_string: '2018-06-11T00:00:00.000Z', + key: 1528675200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49087.805718943775 + }, + lower: { + value: 860.1741427701811 + } + }, + { + key_as_string: '2018-06-11T03:00:00.000Z', + key: 1528686000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49089.84051479006 + }, + lower: { + value: 862.4069845546885 + } + }, + { + key_as_string: '2018-06-11T06:00:00.000Z', + key: 1528696800000, + doc_count: 60, + anomaly_score: { + value: 2.718289217634223 + }, + upper: { + value: 51834.13246654848 + }, + lower: { + value: 862.7834836635291 + } + }, + { + key_as_string: '2018-06-11T09:00:00.000Z', + key: 1528707600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 51136.66870946708 + }, + lower: { + value: 863.5914163409548 + } + }, + { + key_as_string: '2018-06-11T12:00:00.000Z', + key: 1528718400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 50968.889501405334 + }, + lower: { + value: 865.9550918866486 + } + }, + { + key_as_string: '2018-06-11T15:00:00.000Z', + key: 1528729200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 51039.136906324355 + }, + lower: { + value: 866.5727896346234 + } + }, + { + key_as_string: '2018-06-11T18:00:00.000Z', + key: 1528740000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 50450.44063039239 + }, + lower: { + value: 866.4824432593966 + } + }, + { + key_as_string: '2018-06-11T21:00:00.000Z', + key: 1528750800000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49883.2079974308 + }, + lower: { + value: 869.2106974966512 + } + }, + { + key_as_string: '2018-06-12T00:00:00.000Z', + key: 1528761600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 50019.796552072105 + }, + lower: { + value: 869.7908032042425 + } + }, + { + key_as_string: '2018-06-12T03:00:00.000Z', + key: 1528772400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 50352.19806206938 + }, + lower: { + value: 872.0969808877924 + } + }, + { + key_as_string: '2018-06-12T06:00:00.000Z', + key: 1528783200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49893.959882267525 + }, + lower: { + value: 873.8327021716271 + } + }, + { + key_as_string: '2018-06-12T09:00:00.000Z', + key: 1528794000000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49882.868445094966 + }, + lower: { + value: 875.6449156690691 + } + }, + { + key_as_string: '2018-06-12T12:00:00.000Z', + key: 1528804800000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49766.53895122279 + }, + lower: { + value: 874.6294655070553 + } + }, + { + key_as_string: '2018-06-12T15:00:00.000Z', + key: 1528815600000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 49424.25380462067 + }, + lower: { + value: 878.2077083935897 + } + }, + { + key_as_string: '2018-06-12T18:00:00.000Z', + key: 1528826400000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 50079.967231416216 + }, + lower: { + value: 879.6702185935983 + } + }, + { + key_as_string: '2018-06-12T21:00:00.000Z', + key: 1528837200000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49447.853072406695 + }, + lower: { + value: 880.9475908626134 + } + }, + { + key_as_string: '2018-06-13T00:00:00.000Z', + key: 1528848000000, + doc_count: 51, + anomaly_score: { + value: 0 + }, + upper: { + value: 49628.237099331986 + }, + lower: { + value: 883.2355577302953 + } + }, + { + key_as_string: '2018-06-13T03:00:00.000Z', + key: 1528858800000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 49121.655177004985 + }, + lower: { + value: 885.0345875232065 + } + }, + { + key_as_string: '2018-06-13T06:00:00.000Z', + key: 1528869600000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 49439.75445560749 + }, + lower: { + value: 886.8375619687324 + } + }, + { + key_as_string: '2018-06-13T09:00:00.000Z', + key: 1528880400000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 49095.91031920496 + }, + lower: { + value: 888.2875318407426 + } + }, + { + key_as_string: '2018-06-13T12:00:00.000Z', + key: 1528891200000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 48584.97256737151 + }, + lower: { + value: 887.4807424937617 + } + }, + { + key_as_string: '2018-06-13T15:00:00.000Z', + key: 1528902000000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 48401.4014885278 + }, + lower: { + value: 885.3782512926099 + } + }, + { + key_as_string: '2018-06-13T18:00:00.000Z', + key: 1528912800000, + doc_count: 50, + anomaly_score: { + value: 0 + }, + upper: { + value: 48303.662251777845 + }, + lower: { + value: 883.9626695681782 + } + }, + { + key_as_string: '2018-06-13T21:00:00.000Z', + key: 1528923600000, + doc_count: 48, + anomaly_score: { + value: 0 + }, + upper: { + value: 48079.01124458592 + }, + lower: { + value: 881.5723811019918 + } + }, + { + key_as_string: '2018-06-14T00:00:00.000Z', + key: 1528934400000, + doc_count: 60, + anomaly_score: { + value: 66.42568 + }, + upper: { + value: 58715.507088231585 + }, + lower: { + value: 0 + } + }, + { + key_as_string: '2018-06-14T03:00:00.000Z', + key: 1528945200000, + doc_count: 55, + anomaly_score: { + value: 0 + }, + upper: { + value: 49868.15796918666 + }, + lower: { + value: 0 + } + }, + { + key_as_string: '2018-06-14T06:00:00.000Z', + key: 1528956000000, + doc_count: 53, + anomaly_score: { + value: 0.060750193569274885 + }, + upper: { + value: 50310.902258087066 + }, + lower: { + value: 2003.2599232283408 + } + }, + { + key_as_string: '2018-06-14T09:00:00.000Z', + key: 1528966800000, + doc_count: 62, + anomaly_score: { + value: 0.2831448638843196 + }, + upper: { + value: 51642.47679276076 + }, + lower: { + value: 1346.2241502014724 + } + }, + { + key_as_string: '2018-06-14T12:00:00.000Z', + key: 1528977600000, + doc_count: 4, + anomaly_score: { + value: 0 + }, + upper: { + value: 50550.64218576831 + }, + lower: { + value: 1317.070500756407 + } + } + ] + }, + top_hits: { + hits: { + total: 4117, + max_score: null, + hits: [ + { + _index: '.ml-anomalies-shared', + _type: 'doc', + _id: + 'opbeans-node-request-high_mean_response_time_model_plot_1528170300000_900_0_29791_0', + _score: null, + _source: { + bucket_span: 900 + }, + sort: [900] + } + ] + } + } + } +}; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/timeseries_response.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/timeseries_response.ts new file mode 100644 index 0000000000000..7718658f01dbb --- /dev/null +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__test__/timeseries_response.ts @@ -0,0 +1,2827 @@ +/* + * 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 const timeseriesResponse = { + took: 368, + timed_out: false, + _shards: { + total: 90, + successful: 90, + skipped: 0, + failed: 0 + }, + hits: { + total: 1297673, + max_score: 0, + hits: [] + }, + aggregations: { + transaction_results: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { + key: 'A Custom Bucket (that should be last)', + doc_count: 0, + timeseries: { buckets: [] } + }, + { + key: 'HTTP 2xx', + doc_count: 1127080, + timeseries: { + buckets: [ + { + key_as_string: '2018-06-04T12:00:00.000Z', + key: 1528113600000, + doc_count: 16446 + }, + { + key_as_string: '2018-06-04T15:00:00.000Z', + key: 1528124400000, + doc_count: 16292 + }, + { + key_as_string: '2018-06-04T18:00:00.000Z', + key: 1528135200000, + doc_count: 16464 + }, + { + key_as_string: '2018-06-04T21:00:00.000Z', + key: 1528146000000, + doc_count: 16497 + }, + { + key_as_string: '2018-06-05T00:00:00.000Z', + key: 1528156800000, + doc_count: 16799 + }, + { + key_as_string: '2018-06-05T03:00:00.000Z', + key: 1528167600000, + doc_count: 16561 + }, + { + key_as_string: '2018-06-05T06:00:00.000Z', + key: 1528178400000, + doc_count: 16431 + }, + { + key_as_string: '2018-06-05T09:00:00.000Z', + key: 1528189200000, + doc_count: 16383 + }, + { + key_as_string: '2018-06-05T12:00:00.000Z', + key: 1528200000000, + doc_count: 16295 + }, + { + key_as_string: '2018-06-05T15:00:00.000Z', + key: 1528210800000, + doc_count: 16702 + }, + { + key_as_string: '2018-06-05T18:00:00.000Z', + key: 1528221600000, + doc_count: 16469 + }, + { + key_as_string: '2018-06-05T21:00:00.000Z', + key: 1528232400000, + doc_count: 16466 + }, + { + key_as_string: '2018-06-06T00:00:00.000Z', + key: 1528243200000, + doc_count: 16551 + }, + { + key_as_string: '2018-06-06T03:00:00.000Z', + key: 1528254000000, + doc_count: 16675 + }, + { + key_as_string: '2018-06-06T06:00:00.000Z', + key: 1528264800000, + doc_count: 16410 + }, + { + key_as_string: '2018-06-06T09:00:00.000Z', + key: 1528275600000, + doc_count: 16247 + }, + { + key_as_string: '2018-06-06T12:00:00.000Z', + key: 1528286400000, + doc_count: 15145 + }, + { + key_as_string: '2018-06-06T15:00:00.000Z', + key: 1528297200000, + doc_count: 16178 + }, + { + key_as_string: '2018-06-06T18:00:00.000Z', + key: 1528308000000, + doc_count: 16530 + }, + { + key_as_string: '2018-06-06T21:00:00.000Z', + key: 1528318800000, + doc_count: 16211 + }, + { + key_as_string: '2018-06-07T00:00:00.000Z', + key: 1528329600000, + doc_count: 16453 + }, + { + key_as_string: '2018-06-07T03:00:00.000Z', + key: 1528340400000, + doc_count: 16503 + }, + { + key_as_string: '2018-06-07T06:00:00.000Z', + key: 1528351200000, + doc_count: 16604 + }, + { + key_as_string: '2018-06-07T09:00:00.000Z', + key: 1528362000000, + doc_count: 16522 + }, + { + key_as_string: '2018-06-07T12:00:00.000Z', + key: 1528372800000, + doc_count: 16164 + }, + { + key_as_string: '2018-06-07T15:00:00.000Z', + key: 1528383600000, + doc_count: 16520 + }, + { + key_as_string: '2018-06-07T18:00:00.000Z', + key: 1528394400000, + doc_count: 16534 + }, + { + key_as_string: '2018-06-07T21:00:00.000Z', + key: 1528405200000, + doc_count: 16311 + }, + { + key_as_string: '2018-06-08T00:00:00.000Z', + key: 1528416000000, + doc_count: 16670 + }, + { + key_as_string: '2018-06-08T03:00:00.000Z', + key: 1528426800000, + doc_count: 16192 + }, + { + key_as_string: '2018-06-08T06:00:00.000Z', + key: 1528437600000, + doc_count: 16579 + }, + { + key_as_string: '2018-06-08T09:00:00.000Z', + key: 1528448400000, + doc_count: 16330 + }, + { + key_as_string: '2018-06-08T12:00:00.000Z', + key: 1528459200000, + doc_count: 16565 + }, + { + key_as_string: '2018-06-08T15:00:00.000Z', + key: 1528470000000, + doc_count: 16543 + }, + { + key_as_string: '2018-06-08T18:00:00.000Z', + key: 1528480800000, + doc_count: 16492 + }, + { + key_as_string: '2018-06-08T21:00:00.000Z', + key: 1528491600000, + doc_count: 16404 + }, + { + key_as_string: '2018-06-09T00:00:00.000Z', + key: 1528502400000, + doc_count: 4528 + }, + { + key_as_string: '2018-06-09T03:00:00.000Z', + key: 1528513200000, + doc_count: 4557 + }, + { + key_as_string: '2018-06-09T06:00:00.000Z', + key: 1528524000000, + doc_count: 4566 + }, + { + key_as_string: '2018-06-09T09:00:00.000Z', + key: 1528534800000, + doc_count: 4586 + }, + { + key_as_string: '2018-06-09T12:00:00.000Z', + key: 1528545600000, + doc_count: 4672 + }, + { + key_as_string: '2018-06-09T15:00:00.000Z', + key: 1528556400000, + doc_count: 4685 + }, + { + key_as_string: '2018-06-09T18:00:00.000Z', + key: 1528567200000, + doc_count: 4521 + }, + { + key_as_string: '2018-06-09T21:00:00.000Z', + key: 1528578000000, + doc_count: 4612 + }, + { + key_as_string: '2018-06-10T00:00:00.000Z', + key: 1528588800000, + doc_count: 4535 + }, + { + key_as_string: '2018-06-10T03:00:00.000Z', + key: 1528599600000, + doc_count: 4606 + }, + { + key_as_string: '2018-06-10T06:00:00.000Z', + key: 1528610400000, + doc_count: 4614 + }, + { + key_as_string: '2018-06-10T09:00:00.000Z', + key: 1528621200000, + doc_count: 4507 + }, + { + key_as_string: '2018-06-10T12:00:00.000Z', + key: 1528632000000, + doc_count: 4611 + }, + { + key_as_string: '2018-06-10T15:00:00.000Z', + key: 1528642800000, + doc_count: 4587 + }, + { + key_as_string: '2018-06-10T18:00:00.000Z', + key: 1528653600000, + doc_count: 4582 + }, + { + key_as_string: '2018-06-10T21:00:00.000Z', + key: 1528664400000, + doc_count: 4615 + }, + { + key_as_string: '2018-06-11T00:00:00.000Z', + key: 1528675200000, + doc_count: 16251 + }, + { + key_as_string: '2018-06-11T03:00:00.000Z', + key: 1528686000000, + doc_count: 16825 + }, + { + key_as_string: '2018-06-11T06:00:00.000Z', + key: 1528696800000, + doc_count: 16288 + }, + { + key_as_string: '2018-06-11T09:00:00.000Z', + key: 1528707600000, + doc_count: 16492 + }, + { + key_as_string: '2018-06-11T12:00:00.000Z', + key: 1528718400000, + doc_count: 16434 + }, + { + key_as_string: '2018-06-11T15:00:00.000Z', + key: 1528729200000, + doc_count: 17003 + }, + { + key_as_string: '2018-06-11T18:00:00.000Z', + key: 1528740000000, + doc_count: 16364 + }, + { + key_as_string: '2018-06-11T21:00:00.000Z', + key: 1528750800000, + doc_count: 16645 + }, + { + key_as_string: '2018-06-12T00:00:00.000Z', + key: 1528761600000, + doc_count: 16695 + }, + { + key_as_string: '2018-06-12T03:00:00.000Z', + key: 1528772400000, + doc_count: 16498 + }, + { + key_as_string: '2018-06-12T06:00:00.000Z', + key: 1528783200000, + doc_count: 16588 + }, + { + key_as_string: '2018-06-12T09:00:00.000Z', + key: 1528794000000, + doc_count: 16685 + }, + { + key_as_string: '2018-06-12T12:00:00.000Z', + key: 1528804800000, + doc_count: 16361 + }, + { + key_as_string: '2018-06-12T15:00:00.000Z', + key: 1528815600000, + doc_count: 16658 + }, + { + key_as_string: '2018-06-12T18:00:00.000Z', + key: 1528826400000, + doc_count: 16507 + }, + { + key_as_string: '2018-06-12T21:00:00.000Z', + key: 1528837200000, + doc_count: 16418 + }, + { + key_as_string: '2018-06-13T00:00:00.000Z', + key: 1528848000000, + doc_count: 16477 + }, + { + key_as_string: '2018-06-13T03:00:00.000Z', + key: 1528858800000, + doc_count: 16755 + }, + { + key_as_string: '2018-06-13T06:00:00.000Z', + key: 1528869600000, + doc_count: 16594 + }, + { + key_as_string: '2018-06-13T09:00:00.000Z', + key: 1528880400000, + doc_count: 16812 + }, + { + key_as_string: '2018-06-13T12:00:00.000Z', + key: 1528891200000, + doc_count: 16863 + }, + { + key_as_string: '2018-06-13T15:00:00.000Z', + key: 1528902000000, + doc_count: 16655 + }, + { + key_as_string: '2018-06-13T18:00:00.000Z', + key: 1528912800000, + doc_count: 16723 + }, + { + key_as_string: '2018-06-13T21:00:00.000Z', + key: 1528923600000, + doc_count: 16577 + }, + { + key_as_string: '2018-06-14T00:00:00.000Z', + key: 1528934400000, + doc_count: 15125 + }, + { + key_as_string: '2018-06-14T03:00:00.000Z', + key: 1528945200000, + doc_count: 16432 + }, + { + key_as_string: '2018-06-14T06:00:00.000Z', + key: 1528956000000, + doc_count: 16464 + }, + { + key_as_string: '2018-06-14T09:00:00.000Z', + key: 1528966800000, + doc_count: 16369 + }, + { + key_as_string: '2018-06-14T12:00:00.000Z', + key: 1528977600000, + doc_count: 0 + } + ] + } + }, + { + key: 'HTTP 5xx', + doc_count: 82036, + timeseries: { + buckets: [ + { + key_as_string: '2018-06-04T12:00:00.000Z', + key: 1528113600000, + doc_count: 1209 + }, + { + key_as_string: '2018-06-04T15:00:00.000Z', + key: 1528124400000, + doc_count: 1203 + }, + { + key_as_string: '2018-06-04T18:00:00.000Z', + key: 1528135200000, + doc_count: 1196 + }, + { + key_as_string: '2018-06-04T21:00:00.000Z', + key: 1528146000000, + doc_count: 1230 + }, + { + key_as_string: '2018-06-05T00:00:00.000Z', + key: 1528156800000, + doc_count: 1233 + }, + { + key_as_string: '2018-06-05T03:00:00.000Z', + key: 1528167600000, + doc_count: 1272 + }, + { + key_as_string: '2018-06-05T06:00:00.000Z', + key: 1528178400000, + doc_count: 1218 + }, + { + key_as_string: '2018-06-05T09:00:00.000Z', + key: 1528189200000, + doc_count: 1217 + }, + { + key_as_string: '2018-06-05T12:00:00.000Z', + key: 1528200000000, + doc_count: 1235 + }, + { + key_as_string: '2018-06-05T15:00:00.000Z', + key: 1528210800000, + doc_count: 1249 + }, + { + key_as_string: '2018-06-05T18:00:00.000Z', + key: 1528221600000, + doc_count: 1158 + }, + { + key_as_string: '2018-06-05T21:00:00.000Z', + key: 1528232400000, + doc_count: 1215 + }, + { + key_as_string: '2018-06-06T00:00:00.000Z', + key: 1528243200000, + doc_count: 1191 + }, + { + key_as_string: '2018-06-06T03:00:00.000Z', + key: 1528254000000, + doc_count: 1235 + }, + { + key_as_string: '2018-06-06T06:00:00.000Z', + key: 1528264800000, + doc_count: 1212 + }, + { + key_as_string: '2018-06-06T09:00:00.000Z', + key: 1528275600000, + doc_count: 1180 + }, + { + key_as_string: '2018-06-06T12:00:00.000Z', + key: 1528286400000, + doc_count: 1091 + }, + { + key_as_string: '2018-06-06T15:00:00.000Z', + key: 1528297200000, + doc_count: 1176 + }, + { + key_as_string: '2018-06-06T18:00:00.000Z', + key: 1528308000000, + doc_count: 1243 + }, + { + key_as_string: '2018-06-06T21:00:00.000Z', + key: 1528318800000, + doc_count: 1208 + }, + { + key_as_string: '2018-06-07T00:00:00.000Z', + key: 1528329600000, + doc_count: 1202 + }, + { + key_as_string: '2018-06-07T03:00:00.000Z', + key: 1528340400000, + doc_count: 1288 + }, + { + key_as_string: '2018-06-07T06:00:00.000Z', + key: 1528351200000, + doc_count: 1241 + }, + { + key_as_string: '2018-06-07T09:00:00.000Z', + key: 1528362000000, + doc_count: 1215 + }, + { + key_as_string: '2018-06-07T12:00:00.000Z', + key: 1528372800000, + doc_count: 1152 + }, + { + key_as_string: '2018-06-07T15:00:00.000Z', + key: 1528383600000, + doc_count: 1241 + }, + { + key_as_string: '2018-06-07T18:00:00.000Z', + key: 1528394400000, + doc_count: 1177 + }, + { + key_as_string: '2018-06-07T21:00:00.000Z', + key: 1528405200000, + doc_count: 1243 + }, + { + key_as_string: '2018-06-08T00:00:00.000Z', + key: 1528416000000, + doc_count: 1255 + }, + { + key_as_string: '2018-06-08T03:00:00.000Z', + key: 1528426800000, + doc_count: 1189 + }, + { + key_as_string: '2018-06-08T06:00:00.000Z', + key: 1528437600000, + doc_count: 1183 + }, + { + key_as_string: '2018-06-08T09:00:00.000Z', + key: 1528448400000, + doc_count: 1215 + }, + { + key_as_string: '2018-06-08T12:00:00.000Z', + key: 1528459200000, + doc_count: 1282 + }, + { + key_as_string: '2018-06-08T15:00:00.000Z', + key: 1528470000000, + doc_count: 1177 + }, + { + key_as_string: '2018-06-08T18:00:00.000Z', + key: 1528480800000, + doc_count: 1199 + }, + { + key_as_string: '2018-06-08T21:00:00.000Z', + key: 1528491600000, + doc_count: 1234 + }, + { + key_as_string: '2018-06-09T00:00:00.000Z', + key: 1528502400000, + doc_count: 284 + }, + { + key_as_string: '2018-06-09T03:00:00.000Z', + key: 1528513200000, + doc_count: 307 + }, + { + key_as_string: '2018-06-09T06:00:00.000Z', + key: 1528524000000, + doc_count: 283 + }, + { + key_as_string: '2018-06-09T09:00:00.000Z', + key: 1528534800000, + doc_count: 303 + }, + { + key_as_string: '2018-06-09T12:00:00.000Z', + key: 1528545600000, + doc_count: 326 + }, + { + key_as_string: '2018-06-09T15:00:00.000Z', + key: 1528556400000, + doc_count: 269 + }, + { + key_as_string: '2018-06-09T18:00:00.000Z', + key: 1528567200000, + doc_count: 297 + }, + { + key_as_string: '2018-06-09T21:00:00.000Z', + key: 1528578000000, + doc_count: 278 + }, + { + key_as_string: '2018-06-10T00:00:00.000Z', + key: 1528588800000, + doc_count: 289 + }, + { + key_as_string: '2018-06-10T03:00:00.000Z', + key: 1528599600000, + doc_count: 272 + }, + { + key_as_string: '2018-06-10T06:00:00.000Z', + key: 1528610400000, + doc_count: 279 + }, + { + key_as_string: '2018-06-10T09:00:00.000Z', + key: 1528621200000, + doc_count: 238 + }, + { + key_as_string: '2018-06-10T12:00:00.000Z', + key: 1528632000000, + doc_count: 288 + }, + { + key_as_string: '2018-06-10T15:00:00.000Z', + key: 1528642800000, + doc_count: 258 + }, + { + key_as_string: '2018-06-10T18:00:00.000Z', + key: 1528653600000, + doc_count: 264 + }, + { + key_as_string: '2018-06-10T21:00:00.000Z', + key: 1528664400000, + doc_count: 296 + }, + { + key_as_string: '2018-06-11T00:00:00.000Z', + key: 1528675200000, + doc_count: 1213 + }, + { + key_as_string: '2018-06-11T03:00:00.000Z', + key: 1528686000000, + doc_count: 1254 + }, + { + key_as_string: '2018-06-11T06:00:00.000Z', + key: 1528696800000, + doc_count: 1135 + }, + { + key_as_string: '2018-06-11T09:00:00.000Z', + key: 1528707600000, + doc_count: 1240 + }, + { + key_as_string: '2018-06-11T12:00:00.000Z', + key: 1528718400000, + doc_count: 1215 + }, + { + key_as_string: '2018-06-11T15:00:00.000Z', + key: 1528729200000, + doc_count: 1239 + }, + { + key_as_string: '2018-06-11T18:00:00.000Z', + key: 1528740000000, + doc_count: 1209 + }, + { + key_as_string: '2018-06-11T21:00:00.000Z', + key: 1528750800000, + doc_count: 1208 + }, + { + key_as_string: '2018-06-12T00:00:00.000Z', + key: 1528761600000, + doc_count: 1176 + }, + { + key_as_string: '2018-06-12T03:00:00.000Z', + key: 1528772400000, + doc_count: 1207 + }, + { + key_as_string: '2018-06-12T06:00:00.000Z', + key: 1528783200000, + doc_count: 1198 + }, + { + key_as_string: '2018-06-12T09:00:00.000Z', + key: 1528794000000, + doc_count: 1165 + }, + { + key_as_string: '2018-06-12T12:00:00.000Z', + key: 1528804800000, + doc_count: 1188 + }, + { + key_as_string: '2018-06-12T15:00:00.000Z', + key: 1528815600000, + doc_count: 1245 + }, + { + key_as_string: '2018-06-12T18:00:00.000Z', + key: 1528826400000, + doc_count: 1238 + }, + { + key_as_string: '2018-06-12T21:00:00.000Z', + key: 1528837200000, + doc_count: 1283 + }, + { + key_as_string: '2018-06-13T00:00:00.000Z', + key: 1528848000000, + doc_count: 1198 + }, + { + key_as_string: '2018-06-13T03:00:00.000Z', + key: 1528858800000, + doc_count: 1172 + }, + { + key_as_string: '2018-06-13T06:00:00.000Z', + key: 1528869600000, + doc_count: 1229 + }, + { + key_as_string: '2018-06-13T09:00:00.000Z', + key: 1528880400000, + doc_count: 1239 + }, + { + key_as_string: '2018-06-13T12:00:00.000Z', + key: 1528891200000, + doc_count: 1231 + }, + { + key_as_string: '2018-06-13T15:00:00.000Z', + key: 1528902000000, + doc_count: 1248 + }, + { + key_as_string: '2018-06-13T18:00:00.000Z', + key: 1528912800000, + doc_count: 1220 + }, + { + key_as_string: '2018-06-13T21:00:00.000Z', + key: 1528923600000, + doc_count: 1224 + }, + { + key_as_string: '2018-06-14T00:00:00.000Z', + key: 1528934400000, + doc_count: 1088 + }, + { + key_as_string: '2018-06-14T03:00:00.000Z', + key: 1528945200000, + doc_count: 1235 + }, + { + key_as_string: '2018-06-14T06:00:00.000Z', + key: 1528956000000, + doc_count: 1161 + }, + { + key_as_string: '2018-06-14T09:00:00.000Z', + key: 1528966800000, + doc_count: 1183 + }, + { + key_as_string: '2018-06-14T12:00:00.000Z', + key: 1528977600000, + doc_count: 0 + } + ] + } + }, + { + key: 'HTTP 4xx', + doc_count: 81907, + timeseries: { + buckets: [ + { + key_as_string: '2018-06-04T12:00:00.000Z', + key: 1528113600000, + doc_count: 1186 + }, + { + key_as_string: '2018-06-04T15:00:00.000Z', + key: 1528124400000, + doc_count: 1213 + }, + { + key_as_string: '2018-06-04T18:00:00.000Z', + key: 1528135200000, + doc_count: 1205 + }, + { + key_as_string: '2018-06-04T21:00:00.000Z', + key: 1528146000000, + doc_count: 1162 + }, + { + key_as_string: '2018-06-05T00:00:00.000Z', + key: 1528156800000, + doc_count: 1238 + }, + { + key_as_string: '2018-06-05T03:00:00.000Z', + key: 1528167600000, + doc_count: 1191 + }, + { + key_as_string: '2018-06-05T06:00:00.000Z', + key: 1528178400000, + doc_count: 1274 + }, + { + key_as_string: '2018-06-05T09:00:00.000Z', + key: 1528189200000, + doc_count: 1234 + }, + { + key_as_string: '2018-06-05T12:00:00.000Z', + key: 1528200000000, + doc_count: 1164 + }, + { + key_as_string: '2018-06-05T15:00:00.000Z', + key: 1528210800000, + doc_count: 1233 + }, + { + key_as_string: '2018-06-05T18:00:00.000Z', + key: 1528221600000, + doc_count: 1223 + }, + { + key_as_string: '2018-06-05T21:00:00.000Z', + key: 1528232400000, + doc_count: 1216 + }, + { + key_as_string: '2018-06-06T00:00:00.000Z', + key: 1528243200000, + doc_count: 1200 + }, + { + key_as_string: '2018-06-06T03:00:00.000Z', + key: 1528254000000, + doc_count: 1237 + }, + { + key_as_string: '2018-06-06T06:00:00.000Z', + key: 1528264800000, + doc_count: 1231 + }, + { + key_as_string: '2018-06-06T09:00:00.000Z', + key: 1528275600000, + doc_count: 1182 + }, + { + key_as_string: '2018-06-06T12:00:00.000Z', + key: 1528286400000, + doc_count: 1125 + }, + { + key_as_string: '2018-06-06T15:00:00.000Z', + key: 1528297200000, + doc_count: 1243 + }, + { + key_as_string: '2018-06-06T18:00:00.000Z', + key: 1528308000000, + doc_count: 1247 + }, + { + key_as_string: '2018-06-06T21:00:00.000Z', + key: 1528318800000, + doc_count: 1163 + }, + { + key_as_string: '2018-06-07T00:00:00.000Z', + key: 1528329600000, + doc_count: 1220 + }, + { + key_as_string: '2018-06-07T03:00:00.000Z', + key: 1528340400000, + doc_count: 1202 + }, + { + key_as_string: '2018-06-07T06:00:00.000Z', + key: 1528351200000, + doc_count: 1192 + }, + { + key_as_string: '2018-06-07T09:00:00.000Z', + key: 1528362000000, + doc_count: 1248 + }, + { + key_as_string: '2018-06-07T12:00:00.000Z', + key: 1528372800000, + doc_count: 1189 + }, + { + key_as_string: '2018-06-07T15:00:00.000Z', + key: 1528383600000, + doc_count: 1230 + }, + { + key_as_string: '2018-06-07T18:00:00.000Z', + key: 1528394400000, + doc_count: 1206 + }, + { + key_as_string: '2018-06-07T21:00:00.000Z', + key: 1528405200000, + doc_count: 1190 + }, + { + key_as_string: '2018-06-08T00:00:00.000Z', + key: 1528416000000, + doc_count: 1232 + }, + { + key_as_string: '2018-06-08T03:00:00.000Z', + key: 1528426800000, + doc_count: 1171 + }, + { + key_as_string: '2018-06-08T06:00:00.000Z', + key: 1528437600000, + doc_count: 1232 + }, + { + key_as_string: '2018-06-08T09:00:00.000Z', + key: 1528448400000, + doc_count: 1253 + }, + { + key_as_string: '2018-06-08T12:00:00.000Z', + key: 1528459200000, + doc_count: 1250 + }, + { + key_as_string: '2018-06-08T15:00:00.000Z', + key: 1528470000000, + doc_count: 1167 + }, + { + key_as_string: '2018-06-08T18:00:00.000Z', + key: 1528480800000, + doc_count: 1258 + }, + { + key_as_string: '2018-06-08T21:00:00.000Z', + key: 1528491600000, + doc_count: 1148 + }, + { + key_as_string: '2018-06-09T00:00:00.000Z', + key: 1528502400000, + doc_count: 284 + }, + { + key_as_string: '2018-06-09T03:00:00.000Z', + key: 1528513200000, + doc_count: 240 + }, + { + key_as_string: '2018-06-09T06:00:00.000Z', + key: 1528524000000, + doc_count: 273 + }, + { + key_as_string: '2018-06-09T09:00:00.000Z', + key: 1528534800000, + doc_count: 295 + }, + { + key_as_string: '2018-06-09T12:00:00.000Z', + key: 1528545600000, + doc_count: 281 + }, + { + key_as_string: '2018-06-09T15:00:00.000Z', + key: 1528556400000, + doc_count: 300 + }, + { + key_as_string: '2018-06-09T18:00:00.000Z', + key: 1528567200000, + doc_count: 264 + }, + { + key_as_string: '2018-06-09T21:00:00.000Z', + key: 1528578000000, + doc_count: 260 + }, + { + key_as_string: '2018-06-10T00:00:00.000Z', + key: 1528588800000, + doc_count: 279 + }, + { + key_as_string: '2018-06-10T03:00:00.000Z', + key: 1528599600000, + doc_count: 259 + }, + { + key_as_string: '2018-06-10T06:00:00.000Z', + key: 1528610400000, + doc_count: 291 + }, + { + key_as_string: '2018-06-10T09:00:00.000Z', + key: 1528621200000, + doc_count: 248 + }, + { + key_as_string: '2018-06-10T12:00:00.000Z', + key: 1528632000000, + doc_count: 311 + }, + { + key_as_string: '2018-06-10T15:00:00.000Z', + key: 1528642800000, + doc_count: 277 + }, + { + key_as_string: '2018-06-10T18:00:00.000Z', + key: 1528653600000, + doc_count: 279 + }, + { + key_as_string: '2018-06-10T21:00:00.000Z', + key: 1528664400000, + doc_count: 275 + }, + { + key_as_string: '2018-06-11T00:00:00.000Z', + key: 1528675200000, + doc_count: 1167 + }, + { + key_as_string: '2018-06-11T03:00:00.000Z', + key: 1528686000000, + doc_count: 1270 + }, + { + key_as_string: '2018-06-11T06:00:00.000Z', + key: 1528696800000, + doc_count: 1163 + }, + { + key_as_string: '2018-06-11T09:00:00.000Z', + key: 1528707600000, + doc_count: 1155 + }, + { + key_as_string: '2018-06-11T12:00:00.000Z', + key: 1528718400000, + doc_count: 1217 + }, + { + key_as_string: '2018-06-11T15:00:00.000Z', + key: 1528729200000, + doc_count: 1227 + }, + { + key_as_string: '2018-06-11T18:00:00.000Z', + key: 1528740000000, + doc_count: 1194 + }, + { + key_as_string: '2018-06-11T21:00:00.000Z', + key: 1528750800000, + doc_count: 1153 + }, + { + key_as_string: '2018-06-12T00:00:00.000Z', + key: 1528761600000, + doc_count: 1211 + }, + { + key_as_string: '2018-06-12T03:00:00.000Z', + key: 1528772400000, + doc_count: 1203 + }, + { + key_as_string: '2018-06-12T06:00:00.000Z', + key: 1528783200000, + doc_count: 1269 + }, + { + key_as_string: '2018-06-12T09:00:00.000Z', + key: 1528794000000, + doc_count: 1197 + }, + { + key_as_string: '2018-06-12T12:00:00.000Z', + key: 1528804800000, + doc_count: 1184 + }, + { + key_as_string: '2018-06-12T15:00:00.000Z', + key: 1528815600000, + doc_count: 1176 + }, + { + key_as_string: '2018-06-12T18:00:00.000Z', + key: 1528826400000, + doc_count: 1162 + }, + { + key_as_string: '2018-06-12T21:00:00.000Z', + key: 1528837200000, + doc_count: 1270 + }, + { + key_as_string: '2018-06-13T00:00:00.000Z', + key: 1528848000000, + doc_count: 1224 + }, + { + key_as_string: '2018-06-13T03:00:00.000Z', + key: 1528858800000, + doc_count: 1255 + }, + { + key_as_string: '2018-06-13T06:00:00.000Z', + key: 1528869600000, + doc_count: 1207 + }, + { + key_as_string: '2018-06-13T09:00:00.000Z', + key: 1528880400000, + doc_count: 1206 + }, + { + key_as_string: '2018-06-13T12:00:00.000Z', + key: 1528891200000, + doc_count: 1254 + }, + { + key_as_string: '2018-06-13T15:00:00.000Z', + key: 1528902000000, + doc_count: 1216 + }, + { + key_as_string: '2018-06-13T18:00:00.000Z', + key: 1528912800000, + doc_count: 1263 + }, + { + key_as_string: '2018-06-13T21:00:00.000Z', + key: 1528923600000, + doc_count: 1277 + }, + { + key_as_string: '2018-06-14T00:00:00.000Z', + key: 1528934400000, + doc_count: 1183 + }, + { + key_as_string: '2018-06-14T03:00:00.000Z', + key: 1528945200000, + doc_count: 1221 + }, + { + key_as_string: '2018-06-14T06:00:00.000Z', + key: 1528956000000, + doc_count: 1198 + }, + { + key_as_string: '2018-06-14T09:00:00.000Z', + key: 1528966800000, + doc_count: 1214 + }, + { + key_as_string: '2018-06-14T12:00:00.000Z', + key: 1528977600000, + doc_count: 0 + } + ] + } + }, + { + key: 'HTTP 3xx', + doc_count: 6650, + timeseries: { + buckets: [ + { + key_as_string: '2018-06-04T12:00:00.000Z', + key: 1528113600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-04T15:00:00.000Z', + key: 1528124400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-04T18:00:00.000Z', + key: 1528135200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-04T21:00:00.000Z', + key: 1528146000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T00:00:00.000Z', + key: 1528156800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T03:00:00.000Z', + key: 1528167600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T06:00:00.000Z', + key: 1528178400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T09:00:00.000Z', + key: 1528189200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T12:00:00.000Z', + key: 1528200000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T15:00:00.000Z', + key: 1528210800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T18:00:00.000Z', + key: 1528221600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-05T21:00:00.000Z', + key: 1528232400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-06T00:00:00.000Z', + key: 1528243200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-06T03:00:00.000Z', + key: 1528254000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-06T06:00:00.000Z', + key: 1528264800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-06T09:00:00.000Z', + key: 1528275600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-06T12:00:00.000Z', + key: 1528286400000, + doc_count: 4041 + }, + { + key_as_string: '2018-06-06T15:00:00.000Z', + key: 1528297200000, + doc_count: 454 + }, + { + key_as_string: '2018-06-06T18:00:00.000Z', + key: 1528308000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-06T21:00:00.000Z', + key: 1528318800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T00:00:00.000Z', + key: 1528329600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T03:00:00.000Z', + key: 1528340400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T06:00:00.000Z', + key: 1528351200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T09:00:00.000Z', + key: 1528362000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T12:00:00.000Z', + key: 1528372800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T15:00:00.000Z', + key: 1528383600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T18:00:00.000Z', + key: 1528394400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-07T21:00:00.000Z', + key: 1528405200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T00:00:00.000Z', + key: 1528416000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T03:00:00.000Z', + key: 1528426800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T06:00:00.000Z', + key: 1528437600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T09:00:00.000Z', + key: 1528448400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T12:00:00.000Z', + key: 1528459200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T15:00:00.000Z', + key: 1528470000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T18:00:00.000Z', + key: 1528480800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-08T21:00:00.000Z', + key: 1528491600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T00:00:00.000Z', + key: 1528502400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T03:00:00.000Z', + key: 1528513200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T06:00:00.000Z', + key: 1528524000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T09:00:00.000Z', + key: 1528534800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T12:00:00.000Z', + key: 1528545600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T15:00:00.000Z', + key: 1528556400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T18:00:00.000Z', + key: 1528567200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-09T21:00:00.000Z', + key: 1528578000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T00:00:00.000Z', + key: 1528588800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T03:00:00.000Z', + key: 1528599600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T06:00:00.000Z', + key: 1528610400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T09:00:00.000Z', + key: 1528621200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T12:00:00.000Z', + key: 1528632000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T15:00:00.000Z', + key: 1528642800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T18:00:00.000Z', + key: 1528653600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-10T21:00:00.000Z', + key: 1528664400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T00:00:00.000Z', + key: 1528675200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T03:00:00.000Z', + key: 1528686000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T06:00:00.000Z', + key: 1528696800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T09:00:00.000Z', + key: 1528707600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T12:00:00.000Z', + key: 1528718400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T15:00:00.000Z', + key: 1528729200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T18:00:00.000Z', + key: 1528740000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-11T21:00:00.000Z', + key: 1528750800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T00:00:00.000Z', + key: 1528761600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T03:00:00.000Z', + key: 1528772400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T06:00:00.000Z', + key: 1528783200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T09:00:00.000Z', + key: 1528794000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T12:00:00.000Z', + key: 1528804800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T15:00:00.000Z', + key: 1528815600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T18:00:00.000Z', + key: 1528826400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-12T21:00:00.000Z', + key: 1528837200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T00:00:00.000Z', + key: 1528848000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T03:00:00.000Z', + key: 1528858800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T06:00:00.000Z', + key: 1528869600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T09:00:00.000Z', + key: 1528880400000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T12:00:00.000Z', + key: 1528891200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T15:00:00.000Z', + key: 1528902000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T18:00:00.000Z', + key: 1528912800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-13T21:00:00.000Z', + key: 1528923600000, + doc_count: 0 + }, + { + key_as_string: '2018-06-14T00:00:00.000Z', + key: 1528934400000, + doc_count: 2155 + }, + { + key_as_string: '2018-06-14T03:00:00.000Z', + key: 1528945200000, + doc_count: 0 + }, + { + key_as_string: '2018-06-14T06:00:00.000Z', + key: 1528956000000, + doc_count: 0 + }, + { + key_as_string: '2018-06-14T09:00:00.000Z', + key: 1528966800000, + doc_count: 0 + }, + { + key_as_string: '2018-06-14T12:00:00.000Z', + key: 1528977600000, + doc_count: 0 + } + ] + } + } + ] + }, + response_times: { + buckets: [ + { + key_as_string: '2018-06-04T12:00:00.000Z', + key: 1528113600000, + doc_count: 18841, + pct: { + values: { + '95.0': 82172.85648714812, + '99.0': 293866.3866666665 + } + }, + avg: { + value: 26310.63483891513 + } + }, + { + key_as_string: '2018-06-04T15:00:00.000Z', + key: 1528124400000, + doc_count: 18708, + pct: { + values: { + '95.0': 80738.78571428556, + '99.0': 293257.27333333343 + } + }, + avg: { + value: 26193.277795595466 + } + }, + { + key_as_string: '2018-06-04T18:00:00.000Z', + key: 1528135200000, + doc_count: 18865, + pct: { + values: { + '95.0': 77058.03529411761, + '99.0': 290195.8800000004 + } + }, + avg: { + value: 25291.787065995228 + } + }, + { + key_as_string: '2018-06-04T21:00:00.000Z', + key: 1528146000000, + doc_count: 18889, + pct: { + values: { + '95.0': 77892.20721980717, + '99.0': 278548.1649999994 + } + }, + avg: { + value: 24690.306474667796 + } + }, + { + key_as_string: '2018-06-05T00:00:00.000Z', + key: 1528156800000, + doc_count: 19270, + pct: { + values: { + '95.0': 77085.86687499998, + '99.0': 290701.8973333341 + } + }, + avg: { + value: 24809.8953814219 + } + }, + { + key_as_string: '2018-06-05T03:00:00.000Z', + key: 1528167600000, + doc_count: 19024, + pct: { + values: { + '95.0': 80048.3462981744, + '99.0': 286839.5897777779 + } + }, + avg: { + value: 25460.0394764508 + } + }, + { + key_as_string: '2018-06-05T06:00:00.000Z', + key: 1528178400000, + doc_count: 18923, + pct: { + values: { + '95.0': 84089.21370223971, + '99.0': 287979.5149999999 + } + }, + avg: { + value: 26360.440733498916 + } + }, + { + key_as_string: '2018-06-05T09:00:00.000Z', + key: 1528189200000, + doc_count: 18834, + pct: { + values: { + '95.0': 84880.90143416924, + '99.0': 300107.5009999992 + } + }, + avg: { + value: 27050.95205479452 + } + }, + { + key_as_string: '2018-06-05T12:00:00.000Z', + key: 1528200000000, + doc_count: 18694, + pct: { + values: { + '95.0': 84554.8884781166, + '99.0': 294402.2179999999 + } + }, + avg: { + value: 26555.857333903925 + } + }, + { + key_as_string: '2018-06-05T15:00:00.000Z', + key: 1528210800000, + doc_count: 19184, + pct: { + values: { + '95.0': 81839.39583333326, + '99.0': 289849.459333332 + } + }, + avg: { + value: 26164.343359049206 + } + }, + { + key_as_string: '2018-06-05T18:00:00.000Z', + key: 1528221600000, + doc_count: 18850, + pct: { + values: { + '95.0': 85993.55410163336, + '99.0': 296942.86299999955 + } + }, + avg: { + value: 26989.84546419098 + } + }, + { + key_as_string: '2018-06-05T21:00:00.000Z', + key: 1528232400000, + doc_count: 18897, + pct: { + values: { + '95.0': 85001.44588628765, + '99.0': 292048.20571428596 + } + }, + avg: { + value: 26314.409430068266 + } + }, + { + key_as_string: '2018-06-06T00:00:00.000Z', + key: 1528243200000, + doc_count: 18942, + pct: { + values: { + '95.0': 86980.16445312503, + '99.0': 299308.7371666667 + } + }, + avg: { + value: 27460.774575018477 + } + }, + { + key_as_string: '2018-06-06T03:00:00.000Z', + key: 1528254000000, + doc_count: 19147, + pct: { + values: { + '95.0': 84961.8710743802, + '99.0': 292151.2377777781 + } + }, + avg: { + value: 26461.469107431974 + } + }, + { + key_as_string: '2018-06-06T06:00:00.000Z', + key: 1528264800000, + doc_count: 18853, + pct: { + values: { + '95.0': 88906.54601889332, + '99.0': 302274.4192592592 + } + }, + avg: { + value: 27657.584946692834 + } + }, + { + key_as_string: '2018-06-06T09:00:00.000Z', + key: 1528275600000, + doc_count: 18609, + pct: { + values: { + '95.0': 90198.34708994703, + '99.0': 299457.1612121209 + } + }, + avg: { + value: 27940.445967005213 + } + }, + { + key_as_string: '2018-06-06T12:00:00.000Z', + key: 1528286400000, + doc_count: 21402, + pct: { + values: { + '95.0': 135627.71242424246, + '99.0': 350398.59259259375 + } + }, + avg: { + value: 34454.377581534434 + } + }, + { + key_as_string: '2018-06-06T15:00:00.000Z', + key: 1528297200000, + doc_count: 19051, + pct: { + values: { + '95.0': 167037.1993837535, + '99.0': 421204.23333333334 + } + }, + avg: { + value: 44024.31809353839 + } + }, + { + key_as_string: '2018-06-06T18:00:00.000Z', + key: 1528308000000, + doc_count: 19020, + pct: { + values: { + '95.0': 128293.12184873945, + '99.0': 368166.68976190523 + } + }, + avg: { + value: 36374.53333333333 + } + }, + { + key_as_string: '2018-06-06T21:00:00.000Z', + key: 1528318800000, + doc_count: 18582, + pct: { + values: { + '95.0': 130653.54236263742, + '99.0': 367193.6128571426 + } + }, + avg: { + value: 36991.29442471209 + } + }, + { + key_as_string: '2018-06-07T00:00:00.000Z', + key: 1528329600000, + doc_count: 18875, + pct: { + values: { + '95.0': 131630.8902645502, + '99.0': 375658.10190476174 + } + }, + avg: { + value: 37178.002701986756 + } + }, + { + key_as_string: '2018-06-07T03:00:00.000Z', + key: 1528340400000, + doc_count: 18993, + pct: { + values: { + '95.0': 133581.33541666638, + '99.0': 368152.03822222137 + } + }, + avg: { + value: 37605.57078923814 + } + }, + { + key_as_string: '2018-06-07T06:00:00.000Z', + key: 1528351200000, + doc_count: 19037, + pct: { + values: { + '95.0': 132697.92762266204, + '99.0': 365705.8319999995 + } + }, + avg: { + value: 37319.89767295267 + } + }, + { + key_as_string: '2018-06-07T09:00:00.000Z', + key: 1528362000000, + doc_count: 18985, + pct: { + values: { + '95.0': 140003.6918918918, + '99.0': 380075.48533333326 + } + }, + avg: { + value: 38709.5041348433 + } + }, + { + key_as_string: '2018-06-07T12:00:00.000Z', + key: 1528372800000, + doc_count: 18505, + pct: { + values: { + '95.0': 138149.5673529411, + '99.0': 375697.1923809518 + } + }, + avg: { + value: 38140.131856255066 + } + }, + { + key_as_string: '2018-06-07T15:00:00.000Z', + key: 1528383600000, + doc_count: 18991, + pct: { + values: { + '95.0': 121872.37504835591, + '99.0': 351080.94111111073 + } + }, + avg: { + value: 34564.81091043125 + } + }, + { + key_as_string: '2018-06-07T18:00:00.000Z', + key: 1528394400000, + doc_count: 18917, + pct: { + values: { + '95.0': 116378.03873517792, + '99.0': 339294.12799999997 + } + }, + avg: { + value: 33256.37743828302 + } + }, + { + key_as_string: '2018-06-07T21:00:00.000Z', + key: 1528405200000, + doc_count: 18744, + pct: { + values: { + '95.0': 131545.40999999995, + '99.0': 378902.90649999987 + } + }, + avg: { + value: 37251.5625266752 + } + }, + { + key_as_string: '2018-06-08T00:00:00.000Z', + key: 1528416000000, + doc_count: 19157, + pct: { + values: { + '95.0': 133111.25804878055, + '99.0': 384483.3233333327 + } + }, + avg: { + value: 38681.89084929791 + } + }, + { + key_as_string: '2018-06-08T03:00:00.000Z', + key: 1528426800000, + doc_count: 18552, + pct: { + values: { + '95.0': 144821.9855278593, + '99.0': 394692.25000000105 + } + }, + avg: { + value: 40677.801045709355 + } + }, + { + key_as_string: '2018-06-08T06:00:00.000Z', + key: 1528437600000, + doc_count: 18994, + pct: { + values: { + '95.0': 134737.3997727272, + '99.0': 403362.50399999996 + } + }, + avg: { + value: 39987.86453616932 + } + }, + { + key_as_string: '2018-06-08T09:00:00.000Z', + key: 1528448400000, + doc_count: 18798, + pct: { + values: { + '95.0': 141206.57726666646, + '99.0': 396559.0274999993 + } + }, + avg: { + value: 41059.392914139804 + } + }, + { + key_as_string: '2018-06-08T12:00:00.000Z', + key: 1528459200000, + doc_count: 19097, + pct: { + values: { + '95.0': 137731.8994082841, + '99.0': 371815.8320000008 + } + }, + avg: { + value: 39630.710111535845 + } + }, + { + key_as_string: '2018-06-08T15:00:00.000Z', + key: 1528470000000, + doc_count: 18887, + pct: { + values: { + '95.0': 141476.23189033198, + '99.0': 405477.6133333326 + } + }, + avg: { + value: 41561.81331074284 + } + }, + { + key_as_string: '2018-06-08T18:00:00.000Z', + key: 1528480800000, + doc_count: 18949, + pct: { + values: { + '95.0': 149636.31340909077, + '99.0': 413542.18133333366 + } + }, + avg: { + value: 43079.490738297536 + } + }, + { + key_as_string: '2018-06-08T21:00:00.000Z', + key: 1528491600000, + doc_count: 18786, + pct: { + values: { + '95.0': 151934.55000000002, + '99.0': 424399.340000001 + } + }, + avg: { + value: 43925.39609283509 + } + }, + { + key_as_string: '2018-06-09T00:00:00.000Z', + key: 1528502400000, + doc_count: 5096, + pct: { + values: { + '95.0': 82198.17857142858, + '99.0': 303815.9000000001 + } + }, + avg: { + value: 25821.91424646782 + } + }, + { + key_as_string: '2018-06-09T03:00:00.000Z', + key: 1528513200000, + doc_count: 5104, + pct: { + values: { + '95.0': 85946.43199999983, + '99.0': 306305.0800000006 + } + }, + avg: { + value: 27343.60011755486 + } + }, + { + key_as_string: '2018-06-09T06:00:00.000Z', + key: 1528524000000, + doc_count: 5122, + pct: { + values: { + '95.0': 78617.66249999996, + '99.0': 297521.94999999984 + } + }, + avg: { + value: 25249.95060523233 + } + }, + { + key_as_string: '2018-06-09T09:00:00.000Z', + key: 1528534800000, + doc_count: 5184, + pct: { + values: { + '95.0': 79606.48333333322, + '99.0': 317938.0900000003 + } + }, + avg: { + value: 25492.77199074074 + } + }, + { + key_as_string: '2018-06-09T12:00:00.000Z', + key: 1528545600000, + doc_count: 5279, + pct: { + values: { + '95.0': 76297.93999999986, + '99.0': 312262.3000000003 + } + }, + avg: { + value: 25991.647281682137 + } + }, + { + key_as_string: '2018-06-09T15:00:00.000Z', + key: 1528556400000, + doc_count: 5254, + pct: { + values: { + '95.0': 80742.63333333324, + '99.0': 318428.8700000002 + } + }, + avg: { + value: 26273.31290445375 + } + }, + { + key_as_string: '2018-06-09T18:00:00.000Z', + key: 1528567200000, + doc_count: 5082, + pct: { + values: { + '95.0': 81291.45969696966, + '99.0': 295421.4099999999 + } + }, + avg: { + value: 26234.98976780795 + } + }, + { + key_as_string: '2018-06-09T21:00:00.000Z', + key: 1528578000000, + doc_count: 5150, + pct: { + values: { + '95.0': 73467.02500000004, + '99.0': 293067.86000000004 + } + }, + avg: { + value: 23494.54873786408 + } + }, + { + key_as_string: '2018-06-10T00:00:00.000Z', + key: 1528588800000, + doc_count: 5103, + pct: { + values: { + '95.0': 69177.66999999993, + '99.0': 264935.71999999933 + } + }, + avg: { + value: 22008.80482069371 + } + }, + { + key_as_string: '2018-06-10T03:00:00.000Z', + key: 1528599600000, + doc_count: 5137, + pct: { + values: { + '95.0': 71956.06111111109, + '99.0': 282795.0400000003 + } + }, + avg: { + value: 22828.136655635586 + } + }, + { + key_as_string: '2018-06-10T06:00:00.000Z', + key: 1528610400000, + doc_count: 5184, + pct: { + values: { + '95.0': 68480.91142857139, + '99.0': 285390.8400000001 + } + }, + avg: { + value: 22138.7081404321 + } + }, + { + key_as_string: '2018-06-10T09:00:00.000Z', + key: 1528621200000, + doc_count: 4993, + pct: { + values: { + '95.0': 68957.0999999999, + '99.0': 290402.24 + } + }, + avg: { + value: 22634.985579811735 + } + }, + { + key_as_string: '2018-06-10T12:00:00.000Z', + key: 1528632000000, + doc_count: 5210, + pct: { + values: { + '95.0': 67489.50416666668, + '99.0': 293655.53 + } + }, + avg: { + value: 22202.780998080616 + } + }, + { + key_as_string: '2018-06-10T15:00:00.000Z', + key: 1528642800000, + doc_count: 5122, + pct: { + values: { + '95.0': 71556.91249999998, + '99.0': 292723.56999999995 + } + }, + avg: { + value: 23084.082780163997 + } + }, + { + key_as_string: '2018-06-10T18:00:00.000Z', + key: 1528653600000, + doc_count: 5125, + pct: { + values: { + '95.0': 72157.65128205132, + '99.0': 301051.32000000105 + } + }, + avg: { + value: 23109.666146341464 + } + }, + { + key_as_string: '2018-06-10T21:00:00.000Z', + key: 1528664400000, + doc_count: 5186, + pct: { + values: { + '95.0': 76124.5625, + '99.0': 291322.0499999998 + } + }, + avg: { + value: 23306.89028152719 + } + }, + { + key_as_string: '2018-06-11T00:00:00.000Z', + key: 1528675200000, + doc_count: 18631, + pct: { + values: { + '95.0': 141709.34661835746, + '99.0': 379855.2444444447 + } + }, + avg: { + value: 39341.022704095325 + } + }, + { + key_as_string: '2018-06-11T03:00:00.000Z', + key: 1528686000000, + doc_count: 19349, + pct: { + values: { + '95.0': 132371.48641975303, + '99.0': 371175.2592000001 + } + }, + avg: { + value: 37467.17153341258 + } + }, + { + key_as_string: '2018-06-11T06:00:00.000Z', + key: 1528696800000, + doc_count: 18586, + pct: { + values: { + '95.0': 186783.51503759398, + '99.0': 498378.4238888898 + } + }, + avg: { + value: 52457.50554180566 + } + }, + { + key_as_string: '2018-06-11T09:00:00.000Z', + key: 1528707600000, + doc_count: 18887, + pct: { + values: { + '95.0': 99540.17819499348, + '99.0': 331118.6599999997 + } + }, + avg: { + value: 31327.95780166252 + } + }, + { + key_as_string: '2018-06-11T12:00:00.000Z', + key: 1528718400000, + doc_count: 18866, + pct: { + values: { + '95.0': 95982.62454212455, + '99.0': 328101.3999999988 + } + }, + avg: { + value: 30695.334941163997 + } + }, + { + key_as_string: '2018-06-11T15:00:00.000Z', + key: 1528729200000, + doc_count: 19469, + pct: { + values: { + '95.0': 89559.3525925925, + '99.0': 313951.54249999986 + } + }, + avg: { + value: 28895.042785967435 + } + }, + { + key_as_string: '2018-06-11T18:00:00.000Z', + key: 1528740000000, + doc_count: 18767, + pct: { + values: { + '95.0': 95769.83153735634, + '99.0': 323340.5274074075 + } + }, + avg: { + value: 30649.363989982416 + } + }, + { + key_as_string: '2018-06-11T21:00:00.000Z', + key: 1528750800000, + doc_count: 19006, + pct: { + values: { + '95.0': 94063.90833755062, + '99.0': 315055.5047619052 + } + }, + avg: { + value: 29802.63622014101 + } + }, + { + key_as_string: '2018-06-12T00:00:00.000Z', + key: 1528761600000, + doc_count: 19082, + pct: { + values: { + '95.0': 96399.67269119772, + '99.0': 330070.03599999985 + } + }, + avg: { + value: 30759.03002829892 + } + }, + { + key_as_string: '2018-06-12T03:00:00.000Z', + key: 1528772400000, + doc_count: 18908, + pct: { + values: { + '95.0': 96436.42520161276, + '99.0': 320531.54416666675 + } + }, + avg: { + value: 30399.76549608631 + } + }, + { + key_as_string: '2018-06-12T06:00:00.000Z', + key: 1528783200000, + doc_count: 19055, + pct: { + values: { + '95.0': 91860.16988095238, + '99.0': 315137.16628571344 + } + }, + avg: { + value: 29421.610233534506 + } + }, + { + key_as_string: '2018-06-12T09:00:00.000Z', + key: 1528794000000, + doc_count: 19047, + pct: { + values: { + '95.0': 105989.8333333334, + '99.0': 337251.4042424246 + } + }, + avg: { + value: 32641.679897096656 + } + }, + { + key_as_string: '2018-06-12T12:00:00.000Z', + key: 1528804800000, + doc_count: 18733, + pct: { + values: { + '95.0': 97937.60342555979, + '99.0': 327054.9243636365 + } + }, + avg: { + value: 30621.65440666204 + } + }, + { + key_as_string: '2018-06-12T15:00:00.000Z', + key: 1528815600000, + doc_count: 19079, + pct: { + values: { + '95.0': 98967.2249999999, + '99.0': 327653.0000000006 + } + }, + avg: { + value: 31039.60391005818 + } + }, + { + key_as_string: '2018-06-12T18:00:00.000Z', + key: 1528826400000, + doc_count: 18907, + pct: { + values: { + '95.0': 97561.02469135808, + '99.0': 324505.1399999999 + } + }, + avg: { + value: 30954.760723541545 + } + }, + { + key_as_string: '2018-06-12T21:00:00.000Z', + key: 1528837200000, + doc_count: 18971, + pct: { + values: { + '95.0': 102557.78813357186, + '99.0': 338040.3999999998 + } + }, + avg: { + value: 31902.050234568553 + } + }, + { + key_as_string: '2018-06-13T00:00:00.000Z', + key: 1528848000000, + doc_count: 18899, + pct: { + values: { + '95.0': 100137.87578595306, + '99.0': 328600.5173333335 + } + }, + avg: { + value: 31594.350653473728 + } + }, + { + key_as_string: '2018-06-13T03:00:00.000Z', + key: 1528858800000, + doc_count: 19182, + pct: { + values: { + '95.0': 98412.97120445351, + '99.0': 334060.93628571345 + } + }, + avg: { + value: 31343.87243248879 + } + }, + { + key_as_string: '2018-06-13T06:00:00.000Z', + key: 1528869600000, + doc_count: 19030, + pct: { + values: { + '95.0': 101607.8328012912, + '99.0': 328569.4964999998 + } + }, + avg: { + value: 31200.14450867052 + } + }, + { + key_as_string: '2018-06-13T09:00:00.000Z', + key: 1528880400000, + doc_count: 19257, + pct: { + values: { + '95.0': 92000.51368421057, + '99.0': 320227.32399999973 + } + }, + avg: { + value: 28560.946668743833 + } + }, + { + key_as_string: '2018-06-13T12:00:00.000Z', + key: 1528891200000, + doc_count: 19348, + pct: { + values: { + '95.0': 78027.29473684198, + '99.0': 292019.2899999998 + } + }, + avg: { + value: 24700.216146371717 + } + }, + { + key_as_string: '2018-06-13T15:00:00.000Z', + key: 1528902000000, + doc_count: 19119, + pct: { + values: { + '95.0': 80762.078801789, + '99.0': 297757.72666666657 + } + }, + avg: { + value: 25261.025210523563 + } + }, + { + key_as_string: '2018-06-13T18:00:00.000Z', + key: 1528912800000, + doc_count: 19206, + pct: { + values: { + '95.0': 81160.83425925927, + '99.0': 308034.4466666669 + } + }, + avg: { + value: 26041.39789649068 + } + }, + { + key_as_string: '2018-06-13T21:00:00.000Z', + key: 1528923600000, + doc_count: 19078, + pct: { + values: { + '95.0': 84215.58945578222, + '99.0': 301128.4895238093 + } + }, + avg: { + value: 26123.556295209142 + } + }, + { + key_as_string: '2018-06-14T00:00:00.000Z', + key: 1528934400000, + doc_count: 19551, + pct: { + values: { + '95.0': 194188.21428571426, + '99.0': 447266.9 + } + }, + avg: { + value: 46231.36177177638 + } + }, + { + key_as_string: '2018-06-14T03:00:00.000Z', + key: 1528945200000, + doc_count: 18888, + pct: { + values: { + '95.0': 172616.2293896504, + '99.0': 409147.332500001 + } + }, + avg: { + value: 45350.42005506141 + } + }, + { + key_as_string: '2018-06-14T06:00:00.000Z', + key: 1528956000000, + doc_count: 18823, + pct: { + values: { + '95.0': 182653.81858220184, + '99.0': 423121.9773333328 + } + }, + avg: { + value: 48256.049354513096 + } + }, + { + key_as_string: '2018-06-14T09:00:00.000Z', + key: 1528966800000, + doc_count: 18766, + pct: { + values: { + '95.0': 194970.75667682925, + '99.0': 473485.4199999998 + } + }, + avg: { + value: 52360.30017052116 + } + }, + { + key_as_string: '2018-06-14T12:00:00.000Z', + key: 1528977600000, + doc_count: 0, + pct: { + values: { + '95.0': 'NaN', + '99.0': 'NaN' + } + }, + avg: { + value: null + } + } + ] + }, + overall_avg_duration: { + value: 32861.15660262639 + } + } +}; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data.js b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/get_timeseries_data.ts similarity index 50% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data.js rename to x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/get_timeseries_data.ts index 8a9c68c013336..05ee30c688c1e 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data.js +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/get_timeseries_data.ts @@ -4,28 +4,102 @@ * you may not use this file except in compliance with the Elastic License. */ +import { round, sortBy } from 'lodash'; +import mean from 'lodash.mean'; +import { oc } from 'ts-optchain'; import { + SERVICE_NAME, TRANSACTION_DURATION, + TRANSACTION_NAME, TRANSACTION_RESULT, - SERVICE_NAME, - TRANSACTION_TYPE, - TRANSACTION_NAME -} from '../../../../common/constants'; -import { get, sortBy, round } from 'lodash'; -import mean from 'lodash.mean'; -import { getBucketSize } from '../../helpers/get_bucket_size'; -import { getAvgResponseTimeAnomalies } from './get_avg_response_time_anomalies/get_avg_response_time_anomalies'; + TRANSACTION_TYPE +} from '../../../../../common/constants'; +import { getBucketSize } from '../../../helpers/get_bucket_size'; +import { Setup } from '../../../helpers/setup_request'; +import { getAvgResponseTimeAnomalies } from '../get_avg_response_time_anomalies/get_avg_response_time_anomalies'; + +interface ResponseTimeBucket { + key: number; + doc_count: number; + avg: { + value: number; + }; + pct: { + values: { + '95.0': number; + '99.0': number; + }; + }; +} + +interface TransactionResultBucket { + key: string; + doc_count: number; + timeseries: { + buckets: Array<{ + key: number; + doc_count: number; + }>; + }; +} + +interface Aggs { + response_times: { + buckets: ResponseTimeBucket[]; + }; + transaction_results: { + buckets: TransactionResultBucket[]; + }; + overall_avg_duration: { + value: number; + }; +} + +type MaybeNumber = number | null; + +interface Props { + serviceName: string; + transactionType: string; + transactionName?: string; + setup: Setup; +} + +export interface AvgAnomalyBuckets { + anomalyScore: number | null; + lower: number | null; + upper: number | null; +} + +export interface TimeSeriesResponse { + totalHits: number; + dates: number[]; + responseTimes: { + avg: MaybeNumber[]; + p95: MaybeNumber[]; + p99: MaybeNumber[]; + avgAnomalies?: { + bucketSpanAsMillis: number; + buckets: AvgAnomalyBuckets[]; + }; + }; + tpmBuckets: Array<{ + key: string; + avg: number; + values: number[]; + }>; + overallAvgDuration?: number; +} export async function getTimeseriesData({ serviceName, transactionType, transactionName, setup -}) { +}: Props): Promise { const { start, end, esFilterQuery, client, config } = setup; const { intervalString, bucketSize } = getBucketSize(start, end, 'auto'); - const params = { + const params: any = { index: config.get('apm_oss.transactionIndices'), body: { size: 0, @@ -106,52 +180,20 @@ export async function getTimeseriesData({ } const resp = await client('search', params); - const responseTimeBuckets = get( - resp, - 'aggregations.response_times.buckets', - [] - ).slice(1, -1); - - const transactionResultBuckets = get( - resp, - 'aggregations.transaction_results.buckets', - [] - ); + const aggs: Aggs = resp.aggregations; - const overallAvgDuration = get( - resp, - 'aggregations.overall_avg_duration.value' - ); - const dates = responseTimeBuckets.map(bucket => bucket.key); - - const responseTime = responseTimeBuckets.reduce( - (acc, bucket) => { - const { '95.0': p95, '99.0': p99 } = bucket.pct.values; + const overallAvgDuration = oc(aggs).overall_avg_duration.value(); - acc.avg.push(bucket.avg.value); - acc.p95.push(p95 >= 0 ? p95 : null); - acc.p99.push(p99 >= 0 ? p99 : null); - return acc; - }, - { avg: [], p95: [], p99: [] } - ); + const responseTimeBuckets = oc(aggs) + .response_times.buckets([]) + .slice(1, -1); + const dates = responseTimeBuckets.map(bucket => bucket.key); + const { avg, p95, p99 } = getResponseTime(responseTimeBuckets); - const tpmBuckets = sortBy( - transactionResultBuckets.map(({ key, timeseries }) => { - const tpmValues = timeseries.buckets - .slice(1, -1) - .map(bucket => round(bucket.doc_count * (60 / bucketSize), 1)); - - return { - key, - avg: mean(tpmValues), - values: tpmValues - }; - }), - bucket => bucket.key.replace(/^HTTP (\d)xx$/, '00$1') // ensure that HTTP 3xx are sorted at the top - ); + const transactionResultBuckets = oc(aggs).transaction_results.buckets([]); + const tpmBuckets = getTpmBuckets(transactionResultBuckets, bucketSize); - const avgResponseTimesAnomalies = await getAvgResponseTimeAnomalies({ + const avgAnomalies = await getAvgResponseTimeAnomalies({ serviceName, transactionType, transactionName, @@ -159,15 +201,55 @@ export async function getTimeseriesData({ }); return { - total_hits: resp.hits.total, - dates: dates, - response_times: { - avg: responseTime.avg, - p95: responseTime.p95, - p99: responseTime.p99, - avg_anomalies: avgResponseTimesAnomalies + totalHits: resp.hits.total, + dates, + responseTimes: { + avg, + p95, + p99, + avgAnomalies }, - tpm_buckets: tpmBuckets, - overall_avg_duration: overallAvgDuration || 0 + tpmBuckets, + overallAvgDuration }; } + +export function getTpmBuckets( + transactionResultBuckets: TransactionResultBucket[], + bucketSize: number +) { + const buckets = transactionResultBuckets.map(({ key, timeseries }) => { + const tpmValues = timeseries.buckets + .slice(1, -1) + .map(bucket => round(bucket.doc_count * (60 / bucketSize), 1)); + + return { + key, + avg: mean(tpmValues), + values: tpmValues + }; + }); + + return sortBy( + buckets, + bucket => bucket.key.replace(/^HTTP (\d)xx$/, '00$1') // ensure that HTTP 3xx are sorted at the top + ); +} + +function getResponseTime(responseTimeBuckets: ResponseTimeBucket[]) { + return responseTimeBuckets.reduce( + (acc, bucket) => { + const { '95.0': p95, '99.0': p99 } = bucket.pct.values; + + acc.avg.push(bucket.avg.value); + acc.p95.push(p95 >= 0 ? p95 : null); + acc.p99.push(p99 >= 0 ? p99 : null); + return acc; + }, + { + avg: [] as MaybeNumber[], + p95: [] as MaybeNumber[], + p99: [] as MaybeNumber[] + } + ); +} diff --git a/x-pack/plugins/apm/server/routes/transactions.ts b/x-pack/plugins/apm/server/routes/transactions.ts index 01311f896ef8d..933ba4e5eaeef 100644 --- a/x-pack/plugins/apm/server/routes/transactions.ts +++ b/x-pack/plugins/apm/server/routes/transactions.ts @@ -10,7 +10,7 @@ import Joi from 'joi'; import { withDefaultValidators } from '../lib/helpers/input_validation'; import { setupRequest } from '../lib/helpers/setup_request'; // @ts-ignore -import { getTimeseriesData } from '../lib/transactions/charts/get_timeseries_data'; +import { getTimeseriesData } from '../lib/transactions/charts/get_timeseries_data/get_timeseries_data'; import { getDistribution } from '../lib/transactions/distribution/get_distribution'; import { getTopTransactions } from '../lib/transactions/get_top_transactions'; import { getTransaction } from '../lib/transactions/get_transaction'; diff --git a/x-pack/plugins/apm/typings/lodash.mean.d.ts b/x-pack/plugins/apm/typings/lodash.mean.d.ts new file mode 100644 index 0000000000000..c61f9adf9efd4 --- /dev/null +++ b/x-pack/plugins/apm/typings/lodash.mean.d.ts @@ -0,0 +1,10 @@ +/* + * 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. + */ + +declare module 'lodash.mean' { + function mean(numbers: number[]): number; + export = mean; +} diff --git a/yarn.lock b/yarn.lock index 7aa4417df69e4..32a7a1c255e03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1032,143 +1032,16 @@ "@types/cp-file" "*" "@types/glob" "*" -"@types/d3-array@*": - version "1.2.3" - resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-1.2.3.tgz#dd141e3ba311485fffbf0792a1b01a7f2ec12dc1" - integrity sha512-yTO4ws1jnWC7iSKK8j7sUAGKIcJ628ioiGTdyXmPd36cNnuY9fDcjgEW2r19yXWuQFLu61/JhHVZ8RYYTEzFSg== - "@types/d3-array@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-1.2.1.tgz#e489605208d46a1c9d980d2e5772fa9c75d9ec65" integrity sha512-YBaAfimGdWE4nDuoGVKsH89/dkz2hWZ0i8qC+xxqmqi+XJ/aXiRF0jPtzXmN7VdkpVjy1xuDmM5/m1FNuB6VWA== -"@types/d3-axis@*": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@types/d3-axis/-/d3-axis-1.0.11.tgz#efd975f9fec14c2afd03828f3acec0ef97d37c3b" - integrity sha512-cuigApCyCwYJxaQPghj+BqaxzbdRdT/lpZBMtF7EuEIJ61NMQ8yvGnqFvHCIgJEmUu2Wb2wiZqy9kiHi3Ddftg== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-brush@*": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@types/d3-brush/-/d3-brush-1.0.9.tgz#c71070845946eeee4cf330e04123a3997e6476bf" - integrity sha512-mAx8IVc0luUHfk51pl0UN1vzybnAzLMUsvIwLt3fbsqqPkSXr+Pu1AxOPPeyNc27LhHJnfH/LCV7Jlv+Yzqu1A== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-chord@*": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@types/d3-chord/-/d3-chord-1.0.8.tgz#08c0fbb10281be0a5b3fdf48c9c081af02f79fb6" - integrity sha512-F0ftYOo7FenAIxsRjXLt8vbij0NLDuVcL+xaGY7R9jUmF2Mrpj1T5XukBI9Cad+Ei7YSxEWREIO+CYcaKCl2qQ== - -"@types/d3-collection@*": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@types/d3-collection/-/d3-collection-1.0.7.tgz#829e1db477d6bbbcdc038cbc489f22798752d707" - integrity sha512-vR3BT0GwHc5y93Jv6bxn3zoxP/vGu+GdXu/r1ApjbP9dLk9I2g6NiV7iP/QMQSuFZd0It0n/qWrfXHxCWwHIkg== - -"@types/d3-color@*": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-1.2.1.tgz#26141c3c554e320edd40726b793570a3ae57397e" - integrity sha512-xwb1tqvYNWllbHuhMFhiXk63Imf+QNq/dJdmbXmr2wQVnwGenCuj3/0IWJ9hdIFQIqzvhT7T37cvx93jtAsDbQ== - -"@types/d3-contour@*": - version "1.2.2" - resolved "https://registry.yarnpkg.com/@types/d3-contour/-/d3-contour-1.2.2.tgz#b32256b55aed9e2113f88a8ea23846e357fa386c" - integrity sha512-2BIp8c80HWJP/K6t7hov6CX6G/9LWPaf1IkRXmAY3xRDr293u6OxQDSsJNc8IHl3SDWfrUw9mZhBIavS5UOGKg== - dependencies: - "@types/d3-array" "*" - "@types/geojson" "*" - -"@types/d3-dispatch@*": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-dispatch/-/d3-dispatch-1.0.6.tgz#19b173f669cd2ab7dd3d862e8037aae1a98c7508" - integrity sha512-xyWJQMr832vqhu6fD/YqX+MSFBWnkxasNhcStvlhqygXxj0cKqPft0wuGoH5TIq5ADXgP83qeNVa4R7bEYN3uA== - -"@types/d3-drag@*": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@types/d3-drag/-/d3-drag-1.2.1.tgz#6394bcf2f6414140b3b0d521259cadc6fa1da926" - integrity sha512-J9liJ4NNeV0oN40MzPiqwWjqNi3YHCRtHNfNMZ1d3uL9yh1+vDuo346LBEr8yyBm30WHvrHssAkExVZrGCswtA== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-dsv@*": - version "1.0.33" - resolved "https://registry.yarnpkg.com/@types/d3-dsv/-/d3-dsv-1.0.33.tgz#18de1867927f7ec898671aef82f730f16d4c7fcb" - integrity sha512-jx5YvaVC3Wfh6LobaiWTeU1NkvL2wPmmpmajk618bD+xVz98yNWzmZMvmlPHGK0HXbMeHmW/6oVX48V9AH1bRQ== - -"@types/d3-ease@*": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@types/d3-ease/-/d3-ease-1.0.7.tgz#93a301868be9e15061f3d44343b1ab3f8acb6f09" - integrity sha1-k6MBhovp4VBh89RDQ7GrP4rLbwk= - -"@types/d3-fetch@*": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@types/d3-fetch/-/d3-fetch-1.1.2.tgz#a59921477e25850ca6b3353e03d5d29e5a0e8e03" - integrity sha512-w6ANZv/mUh+6IV3drT22zgPWMRobzuGXhzOZC8JPD+ygce0/Vx6vTci3m3dizkocnQQCOwNbrWWWPYqpWiKzRQ== - dependencies: - "@types/d3-dsv" "*" - -"@types/d3-force@*": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-1.1.1.tgz#185c18b77932df63457894bd36d0d6e9692546c0" - integrity sha512-ePkELuaFWY4yOuf+Bvx5Xd+ihFiYG4bdnW0BlvigovIm8Sob2t76e9RGO6lybQbv6AlW9Icn9HuZ9fmdzEoJyg== - -"@types/d3-format@*": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@types/d3-format/-/d3-format-1.3.0.tgz#c5e115fac8e6861ce656fe9861892b22f6b0cfcb" - integrity sha512-ZiY4j3iJvAdOwzwW24WjlZbUNvqOsnPAMfPBmdXqxj3uKJbrzBlRrdGl5uC89pZpFs9Dc92E81KcwG2uEgkIZA== - -"@types/d3-geo@*": - version "1.10.3" - resolved "https://registry.yarnpkg.com/@types/d3-geo/-/d3-geo-1.10.3.tgz#3c01b2baa480e1108301096328dc2837e7ff4d8a" - integrity sha512-hfdaxM2L0wA9mDZrrSf2o+DyhEpnJYCiAN+lHFtpfZOVCQrYBA5g33sGRpUbAvjSMyO5jkHbftMWPEhuCMChSg== - dependencies: - "@types/geojson" "*" - -"@types/d3-hierarchy@*": - version "1.1.4" - resolved "https://registry.yarnpkg.com/@types/d3-hierarchy/-/d3-hierarchy-1.1.4.tgz#b04dfcb1f2074da789ada10fe4942d13f0bce421" - integrity sha512-+d2VLfLPgW66VB7k56T8tC4LobfS6Rrhm+1pmYPMmlCpO5rccJLuwux7YXl/eGVst3Bhb5PJTN5/oaJERpNw8g== - -"@types/d3-interpolate@*": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@types/d3-interpolate/-/d3-interpolate-1.3.0.tgz#65b9627900bfdd82474875d9b23d574a4388af7c" - integrity sha512-Ng4ds7kPSvP/c3W3J5PPUQlgewif1tGBqCeh5lgY+UG82Y7H9zQ8c2gILsEFDLg7wRGOwnuKZ940Q/LSN14w9w== - dependencies: - "@types/d3-color" "*" - "@types/d3-path@*": version "1.0.7" resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-1.0.7.tgz#a0736fceed688a695f48265a82ff7a3369414b81" integrity sha512-U8dFRG+8WhkLJr2sxZ9Cw/5WeRgBnNqMxGdA1+Z0+ZG6tK0s75OQ4OXnxeyfKuh6E4wQPY8OAKr1+iNDx01BEQ== -"@types/d3-polygon@*": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-polygon/-/d3-polygon-1.0.6.tgz#db25c630a2afb9191fe51ba61dd37baee9dd44c7" - integrity sha512-E6Kyodn9JThgLq20nxSbEce9ow5/ePgm9PX2EO6W1INIL4DayM7cFaiG10DStuamjYAd0X4rntW2q+GRjiIktw== - -"@types/d3-quadtree@*": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-quadtree/-/d3-quadtree-1.0.6.tgz#45da9e603688ba90eedd3d40f6e504764e06e493" - integrity sha512-sphVuDdiSIaxLt9kQgebJW98pTktQ/xuN7Ysd8X68Rnjeg/q8+c36/ShlqU52qoKg9nob/JEHH1uQMdxURZidQ== - -"@types/d3-random@*": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/d3-random/-/d3-random-1.1.1.tgz#38647ce2ff4ce7d0d56974334c1c4092513c8b9f" - integrity sha512-jUPeBq1XKK9/5XasTvy5QAUwFeMsjma2yt/nP02yC2Tijovx7i/W5776U/HZugxc5SSmtpx4Z3g9KFVon0QrjQ== - -"@types/d3-scale-chromatic@*": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@types/d3-scale-chromatic/-/d3-scale-chromatic-1.3.0.tgz#b8b58a7a262a583fc1c95ce851d5a75811875034" - integrity sha512-JqQH5uu1kmdQEa6XSu7NYzQM71lL1YreBPS5o8SnmEDcBRKL6ooykXa8iFPPOEUiTah25ydi+cTrbsogBSMNSQ== - -"@types/d3-scale@*": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-2.0.2.tgz#61145948aa1a52ab31384766cd013308699112b3" - integrity sha512-pnmZsEVwTyX+68bjG9r3XXUBASUF6z3Ir2nlrv81mWCH9yqeRscR98myMNP5OwDd9urUnvjNabJul5B9K0+F2w== - dependencies: - "@types/d3-time" "*" - "@types/d3-scale@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-2.0.1.tgz#f94cd991c50422b2e68d8f43be3f9fffdb1ae7be" @@ -1176,18 +1049,6 @@ dependencies: "@types/d3-time" "*" -"@types/d3-selection@*": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@types/d3-selection/-/d3-selection-1.3.2.tgz#dd5661a560ba9ce3aba823c424b8d4a1bc7e833f" - integrity sha512-K23sDOi7yMussv7aiqk097IWWbjFYbJpcDppQAcaf6DfmHxAsjr+6N4HJGokETLDuV7y/qJeeIJINPnkWJM5Hg== - -"@types/d3-shape@*": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-1.2.4.tgz#e65585f2254d83ae42c47af2e730dd9b97952996" - integrity sha512-X4Xq2mpChPIMDMAXwLfxHKLbqv+sowkJ94bENeSMqqhQJ5v4oXuoyLo0vnIkydVbuQ52ZwPplk219K0m2HJODg== - dependencies: - "@types/d3-path" "*" - "@types/d3-shape@^1.2.2": version "1.2.3" resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-1.2.3.tgz#cadc9f93a626db9190f306048a650df4ffa4e500" @@ -1195,7 +1056,7 @@ dependencies: "@types/d3-path" "*" -"@types/d3-time-format@*", "@types/d3-time-format@^2.1.0": +"@types/d3-time-format@^2.1.0": version "2.1.0" resolved "https://registry.yarnpkg.com/@types/d3-time-format/-/d3-time-format-2.1.0.tgz#011e0fb7937be34a9a8f580ae1e2f2f1336a8a22" integrity sha512-/myT3I7EwlukNOX2xVdMzb8FRgNzRMpsZddwst9Ld/VFe6LyJyRp0s32l/V9XoUzk+Gqu56F/oGk6507+8BxrA== @@ -1205,67 +1066,10 @@ resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-1.0.8.tgz#6c083127b330b3c2fc65cd0f3a6e9cbd9607b28c" integrity sha512-/UCphyyw97YAq4zKsuXH33R3UNB4jDSza0fLvMubWr/ONh9IePi1NbgFP222blhiCe724ebJs8U87+aDuAq/jA== -"@types/d3-timer@*": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@types/d3-timer/-/d3-timer-1.0.8.tgz#a3441d9605367059e14ad8c3494132143cbc8d58" - integrity sha512-AKUgQ/nljUFcUO2P3gK24weVI5XwUTdJvjoh8gJ0yxT4aJ+d7t2Or3TB+k9dEYl14BAjoj32D0ky+YzQSVszfg== - -"@types/d3-transition@*": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@types/d3-transition/-/d3-transition-1.1.3.tgz#efcf4941dae22135d595514ba488f4f370d396b0" - integrity sha512-1EukXNuVu/z2G1GZpZagzFJnie9C5zze17ox/vhTgGXNy46rYAm4UkhLLlUeeZ1ndq88k95SOeC8898RpKMLOQ== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-voronoi@*": - version "1.1.8" - resolved "https://registry.yarnpkg.com/@types/d3-voronoi/-/d3-voronoi-1.1.8.tgz#a039cb8368bce4efc1a70aebe744d210851cf1a7" - integrity sha512-zqNhW7QsYQGlfOdrwPNPG3Wk64zUa4epKRurkJ/dVc6oeXrB+iTDt8sRZ0KZKOOXvvfa1dcdB0e45TZeLBiodQ== - -"@types/d3-zoom@*": - version "1.7.2" - resolved "https://registry.yarnpkg.com/@types/d3-zoom/-/d3-zoom-1.7.2.tgz#ee67f063199c179949d83b6b1e6166207de5f06e" - integrity sha512-/ORNUzQ0g7h2f34L/hD1o+IytOjpNLwEf403yKmYAA+z3LC8eCH6xCKaCc0weuCWwiaZ2UqBW41Y6ciqjd+ndQ== - dependencies: - "@types/d3-interpolate" "*" - "@types/d3-selection" "*" - -"@types/d3@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@types/d3/-/d3-5.0.0.tgz#fec49f2aea0f0784f829eff38132926e92676d57" - integrity sha512-BVfPw7ha+UgsG24v6ymerMY4+pJgQ/6p+hJA4loCeaaqV9snGS/G6ReVaQEn8Himn67dWn/Je9WhRbnDO7MzLw== - dependencies: - "@types/d3-array" "*" - "@types/d3-axis" "*" - "@types/d3-brush" "*" - "@types/d3-chord" "*" - "@types/d3-collection" "*" - "@types/d3-color" "*" - "@types/d3-contour" "*" - "@types/d3-dispatch" "*" - "@types/d3-drag" "*" - "@types/d3-dsv" "*" - "@types/d3-ease" "*" - "@types/d3-fetch" "*" - "@types/d3-force" "*" - "@types/d3-format" "*" - "@types/d3-geo" "*" - "@types/d3-hierarchy" "*" - "@types/d3-interpolate" "*" - "@types/d3-path" "*" - "@types/d3-polygon" "*" - "@types/d3-quadtree" "*" - "@types/d3-random" "*" - "@types/d3-scale" "*" - "@types/d3-scale-chromatic" "*" - "@types/d3-selection" "*" - "@types/d3-shape" "*" - "@types/d3-time" "*" - "@types/d3-time-format" "*" - "@types/d3-timer" "*" - "@types/d3-transition" "*" - "@types/d3-voronoi" "*" - "@types/d3-zoom" "*" +"@types/d3@^3.5.41": + version "3.5.41" + resolved "https://registry.yarnpkg.com/@types/d3/-/d3-3.5.41.tgz#57f08fc79b75f0fecb0b3547abc22e46e9d660e4" + integrity sha512-dInnr7nSPsofnLggOf70xvsInUjf3tRrE8XmxsioXALWQHkwEWi7RhTBCa9mYmiUDHMtuanSDN/JOW187ChIhw== "@types/dedent@^0.7.0": version "0.7.0" @@ -1353,11 +1157,6 @@ dependencies: "@types/node" "*" -"@types/geojson@*": - version "7946.0.4" - resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.4.tgz#4e049756383c3f055dd8f3d24e63fb543e98eb07" - integrity sha512-MHmwBtCb7OCv1DSivz2UNJXPGU/1btAWRKlqJ2saEhVJkpkvqHMMaOpKg0v4sAbDWSQekHGvPVMM8nQ+Jen03Q== - "@types/getopts@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@types/getopts/-/getopts-2.0.0.tgz#8a603370cb367d3192bd8012ad39ab2320b5b476" @@ -1435,6 +1234,11 @@ resolved "https://registry.yarnpkg.com/@types/hoek/-/hoek-4.1.3.tgz#d1982d48fb0d2a0e5d7e9d91838264d8e428d337" integrity sha1-0ZgtSPsNKg5dfp2Rg4Jk2OQo0zc= +"@types/humps@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@types/humps/-/humps-1.1.2.tgz#fbcaf596d20ff2ed78f8f511c5d6a943b51101d6" + integrity sha1-+8r1ltIP8u14+PURxdapQ7URAdY= + "@types/indent-string@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/indent-string/-/indent-string-3.0.0.tgz#9ebb391ceda548926f5819ad16405349641b999f"