diff --git a/x-pack/plugins/apm/public/services/rest/apm.ts b/x-pack/plugins/apm/public/services/rest/apm.ts index c85ea7f8c1a5bd7..f893d2d8e426d53 100644 --- a/x-pack/plugins/apm/public/services/rest/apm.ts +++ b/x-pack/plugins/apm/public/services/rest/apm.ts @@ -10,7 +10,7 @@ import { ServiceAPIResponse } from 'x-pack/plugins/apm/server/lib/services/get_s import { ServiceListAPIResponse } from 'x-pack/plugins/apm/server/lib/services/get_services'; import { TraceListAPIResponse } from 'x-pack/plugins/apm/server/lib/traces/get_top_traces'; import { TraceAPIResponse } from 'x-pack/plugins/apm/server/lib/traces/get_trace'; -import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data'; +import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts'; import { ITransactionDistributionAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/distribution'; import { TransactionListAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/get_top_transactions'; import { TransactionAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/get_transaction'; diff --git a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.tsx b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.tsx index 01f3f0bd780ab0e..4b21153dc38d330 100644 --- a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.tsx +++ b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionDetailsCharts.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { Request, RRRRender } from 'react-redux-request'; import { createSelector } from 'reselect'; -import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data'; +import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts'; import { loadCharts } from '../../services/rest/apm'; import { IReduxState } from '../rootReducer'; import { getCharts } from '../selectors/chartSelectors'; diff --git a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.tsx b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.tsx index 9cb5760140e2870..c872625fd163fa7 100644 --- a/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.tsx +++ b/x-pack/plugins/apm/public/store/reactReduxRequest/transactionOverviewCharts.tsx @@ -8,7 +8,7 @@ import { get } from 'lodash'; import React from 'react'; import { Request, RRRRender } from 'react-redux-request'; import { createSelector } from 'reselect'; -import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data'; +import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts'; import { loadCharts } from '../../services/rest/apm'; import { IReduxState } from '../rootReducer'; import { getCharts } from '../selectors/chartSelectors'; diff --git a/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.ts b/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.ts index b660d30a326abb1..8e8fe92639f861f 100644 --- a/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.ts +++ b/x-pack/plugins/apm/public/store/selectors/__tests__/chartSelectors.test.ts @@ -4,56 +4,94 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data'; +import { ApmTimeSeriesResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform'; import { getResponseTimeSeries, getTpmSeries } from '../chartSelectors'; describe('chartSelectors', () => { describe('getResponseTimeSeries', () => { - const chartsData = { - dates: [0, 1000, 2000, 3000, 4000, 5000], + const apmTimeseries = { responseTimes: { - avg: [100, 200, 150, 250, 100, 50], - p95: [200, 300, 250, 350, 200, 150], - p99: [300, 400, 350, 450, 100, 50] + avg: [ + { x: 0, y: 100 }, + { x: 1000, y: 200 }, + { x: 2000, y: 150 }, + { x: 3000, y: 250 }, + { x: 4000, y: 100 }, + { x: 5000, y: 50 } + ], + p95: [ + { x: 0, y: 200 }, + { x: 1000, y: 300 }, + { x: 2000, y: 250 }, + { x: 3000, y: 350 }, + { x: 4000, y: 200 }, + { x: 5000, y: 150 } + ], + p99: [ + { x: 0, y: 300 }, + { x: 1000, y: 400 }, + { x: 2000, y: 350 }, + { x: 3000, y: 450 }, + { x: 4000, y: 100 }, + { x: 5000, y: 50 } + ] }, overallAvgDuration: 200 - } as TimeSeriesAPIResponse; + } as ApmTimeSeriesResponse; it('should match snapshot', () => { - expect(getResponseTimeSeries(chartsData)).toMatchSnapshot(); + expect(getResponseTimeSeries(apmTimeseries)).toMatchSnapshot(); }); it('should return 3 series', () => { - expect(getResponseTimeSeries(chartsData).length).toBe(3); + expect(getResponseTimeSeries(apmTimeseries).length).toBe(3); }); }); describe('getTpmSeries', () => { - const chartsData = { + const apmTimeseries = ({ dates: [0, 1000, 2000, 3000, 4000, 5000], tpmBuckets: [ { key: 'HTTP 2xx', - avg: 10, - values: [5, 10, 3, 8, 4, 9] + dataPoints: [ + { x: 0, y: 5 }, + { x: 1000, y: 10 }, + { x: 2000, y: 3 }, + { x: 3000, y: 8 }, + { x: 4000, y: 4 }, + { x: 5000, y: 9 } + ] }, { key: 'HTTP 4xx', - avg: 2, - values: [1, 2, 3, 2, 3, 1] + dataPoints: [ + { x: 0, y: 1 }, + { x: 1000, y: 2 }, + { x: 2000, y: 3 }, + { x: 3000, y: 2 }, + { x: 4000, y: 3 }, + { x: 5000, y: 1 } + ] }, { key: 'HTTP 5xx', - avg: 1, - values: [0, 1, 2, 1, 0, 2] + dataPoints: [ + { x: 0, y: 0 }, + { x: 1000, y: 1 }, + { x: 2000, y: 2 }, + { x: 3000, y: 1 }, + { x: 4000, y: 0 }, + { x: 5000, y: 2 } + ] } ] - } as TimeSeriesAPIResponse; + } as any) as ApmTimeSeriesResponse; const transactionType = 'MyTransactionType'; it('should match snapshot', () => { - expect(getTpmSeries(chartsData, transactionType)).toMatchSnapshot(); + expect(getTpmSeries(apmTimeseries, transactionType)).toMatchSnapshot(); }); }); }); diff --git a/x-pack/plugins/apm/public/store/selectors/chartSelectors.ts b/x-pack/plugins/apm/public/store/selectors/chartSelectors.ts index a1f24dc01465800..3efe150008bd383 100644 --- a/x-pack/plugins/apm/public/store/selectors/chartSelectors.ts +++ b/x-pack/plugins/apm/public/store/selectors/chartSelectors.ts @@ -6,17 +6,17 @@ import d3 from 'd3'; import { difference, memoize, zipObject } from 'lodash'; -import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data'; +import mean from 'lodash.mean'; +import { rgba } from 'polished'; +import { TimeSeriesAPIResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts'; +import { AnomalyTimeSeriesResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform'; +import { ApmTimeSeriesResponse } from 'x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform'; import { StringMap } from 'x-pack/plugins/apm/typings/common'; +import { Coordinate } from 'x-pack/plugins/apm/typings/timeseries'; import { colors } from '../../style/variables'; import { asDecimal, asMillis, tpmUnit } from '../../utils/formatters'; import { IUrlParams } from '../urlParams'; -interface Coordinate { - x: number; - y?: number | null; -} - export const getEmptySerie = memoize( (start = Date.now() - 3600000, end = Date.now()) => { const dates = d3.time @@ -38,17 +38,18 @@ export const getEmptySerie = memoize( export function getCharts( urlParams: IUrlParams, - charts: TimeSeriesAPIResponse + timeseriesResponse: TimeSeriesAPIResponse ) { const { start, end, transactionType } = urlParams; - const noHits = charts.totalHits === 0; + const { apmTimeseries, anomalyTimeseries } = timeseriesResponse; + const noHits = apmTimeseries.totalHits === 0; const tpmSeries = noHits ? getEmptySerie(start, end) - : getTpmSeries(charts, transactionType); + : getTpmSeries(apmTimeseries, transactionType); const responseTimeSeries = noHits ? getEmptySerie(start, end) - : getResponseTimeSeries(charts); + : getResponseTimeSeries(apmTimeseries, anomalyTimeseries); return { noHits, @@ -69,14 +70,17 @@ interface TimeSerie { areaColor?: string; } -export function getResponseTimeSeries(chartsData: TimeSeriesAPIResponse) { - const { dates, overallAvgDuration, anomalyTimeSeries } = chartsData; - const { avg, p95, p99 } = chartsData.responseTimes; +export function getResponseTimeSeries( + apmTimeseries: ApmTimeSeriesResponse, + anomalyTimeseries?: AnomalyTimeSeriesResponse +) { + const { overallAvgDuration } = apmTimeseries; + const { avg, p95, p99 } = apmTimeseries.responseTimes; const series: TimeSerie[] = [ { title: 'Avg.', - data: getChartValues(dates, avg), + data: avg, legendValue: asMillis(overallAvgDuration), type: 'line', color: colors.apmBlue @@ -84,33 +88,61 @@ export function getResponseTimeSeries(chartsData: TimeSeriesAPIResponse) { { title: '95th percentile', titleShort: '95th', - data: getChartValues(dates, p95), + data: p95, type: 'line', color: colors.apmYellow }, { title: '99th percentile', titleShort: '99th', - data: getChartValues(dates, p99), + data: p99, type: 'line', color: colors.apmOrange } ]; - if (anomalyTimeSeries) { + if (anomalyTimeseries) { // insert after Avg. series - series.splice(1, 0, anomalyTimeSeries.anomalyBoundariesSeries); - series.splice(1, 0, anomalyTimeSeries.anomalyScoreSeries); + series.splice( + 1, + 0, + getAnomalyBoundariesSeries(anomalyTimeseries.anomalyBoundaries), + getAnomalyScoreSeries(anomalyTimeseries.anomalyScore) + ); } return series; } +function getAnomalyScoreSeries(data: Coordinate[]) { + return { + title: 'Anomaly score', + hideLegend: true, + hideTooltipValue: true, + data, + type: 'areaMaxHeight', + color: 'none', + areaColor: rgba(colors.apmRed, 0.1) + }; +} + +function getAnomalyBoundariesSeries(data: Coordinate[]) { + return { + title: 'Anomaly Boundaries', + hideLegend: true, + hideTooltipValue: true, + data, + type: 'area', + color: 'none', + areaColor: rgba(colors.apmBlue, 0.1) + }; +} + export function getTpmSeries( - chartsData: TimeSeriesAPIResponse, + apmTimeseries: ApmTimeSeriesResponse, transactionType?: string ) { - const { dates, tpmBuckets } = chartsData; + const { tpmBuckets } = apmTimeseries; const bucketKeys = tpmBuckets.map(({ key }) => key); const getColor = getColorByKey(bucketKeys); const getTpmLegendTitle = (bucketKey: string) => { @@ -123,10 +155,11 @@ export function getTpmSeries( }; return tpmBuckets.map(bucket => { + const avg = mean(bucket.dataPoints.map(p => p.y)); return { title: getTpmLegendTitle(bucket.key), - data: getChartValues(dates, bucket.values), - legendValue: `${asDecimal(bucket.avg)} ${tpmUnit(transactionType || '')}`, + data: bucket.dataPoints, + legendValue: `${asDecimal(avg)} ${tpmUnit(transactionType || '')}`, type: 'line', color: getColor(bucket.key) }; @@ -153,13 +186,3 @@ function getColorByKey(keys: string[]) { return (key: string) => assignedColors[key] || unassignedColors[key]; } - -function getChartValues( - dates: number[] = [], - buckets: Array = [] -) { - return dates.map((x, i) => ({ - x, - y: buckets[i] - })); -} diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/fetcher.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/fetcher.test.ts.snap similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/fetcher.test.ts.snap rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/fetcher.test.ts.snap diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/index.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/index.test.ts.snap new file mode 100644 index 000000000000000..971fa3b92cc83f0 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/index.test.ts.snap @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`getAnomalySeries should match snapshot 1`] = ` +Object { + "anomalyBoundaries": Array [ + Object { + "x": 5000, + "y": 200, + "y0": 20, + }, + Object { + "x": 15000, + "y": 100, + "y0": 20, + }, + Object { + "x": 25000, + "y": 50, + "y0": 10, + }, + Object { + "x": 30000, + "y": 50, + "y0": 10, + }, + ], + "anomalyScore": Array [ + Object { + "x": 25000, + "x0": 15000, + }, + Object { + "x": 35000, + "x0": 25000, + }, + ], +} +`; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/transform.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/transform.test.ts.snap new file mode 100644 index 000000000000000..408e0906d0c94ab --- /dev/null +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/__snapshots__/transform.test.ts.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`anomalySeriesTransform should match snapshot 1`] = ` +Object { + "anomalyBoundaries": Array [ + Object { + "x": 10000, + "y": 200, + "y0": 20, + }, + Object { + "x": 15000, + "y": 100, + "y0": 20, + }, + Object { + "x": 25000, + "y": 50, + "y0": 10, + }, + ], + "anomalyScore": Array [ + Object { + "x": 25000, + "x0": 15000, + }, + Object { + "x": 35000, + "x0": 25000, + }, + ], +} +`; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/fetcher.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.test.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/fetcher.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.test.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/fetcher.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/fetcher.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/get_ml_bucket_size.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/get_ml_bucket_size.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/get_ml_bucket_size.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/get_ml_bucket_size.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts similarity index 78% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/index.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts index 086e19f06da1536..b652177bb1e5532 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.test.ts @@ -5,7 +5,6 @@ */ import { getAnomalySeries } from '.'; -import { bucketTransformer } from '../../distribution/get_buckets/transform'; import { mlAnomalyResponse } from './mock-responses/mlAnomalyResponse'; import { mlBucketSpanResponse } from './mock-responses/mlBucketSpanResponse'; import { AnomalyTimeSeriesResponse } from './transform'; @@ -33,24 +32,24 @@ describe('getAnomalySeries', () => { })) as AnomalyTimeSeriesResponse; }); - it('should remove buckets lower than threshold and outside date range from anomalyScoreSeries', () => { - expect(avgAnomalies.anomalyScoreSeries.data).toEqual([ + it('should remove buckets lower than threshold and outside date range from anomalyScore', () => { + expect(avgAnomalies.anomalyScore).toEqual([ { x0: 15000, x: 25000 }, { x0: 25000, x: 35000 } ]); }); - it('should remove buckets outside date range from anomalyBoundariesSeries', () => { + it('should remove buckets outside date range from anomalyBoundaries', () => { expect( - avgAnomalies.anomalyBoundariesSeries.data.filter( + avgAnomalies.anomalyBoundaries.filter( bucket => bucket.x < 100 || bucket.x > 100000 ).length ).toBe(0); }); - it('should remove buckets with null from anomalyBoundariesSeries', () => { + it('should remove buckets with null from anomalyBoundaries', () => { expect( - avgAnomalies.anomalyBoundariesSeries.data.filter(p => p.y === null).length + avgAnomalies.anomalyBoundaries.filter(p => p.y === null).length ).toBe(0); }); diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/index.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/index.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/mock-responses/mlAnomalyResponse.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlAnomalyResponse.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/mock-responses/mlAnomalyResponse.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlAnomalyResponse.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/mock-responses/mlBucketSpanResponse.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlBucketSpanResponse.ts similarity index 100% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/mock-responses/mlBucketSpanResponse.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/mock-responses/mlBucketSpanResponse.ts diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/transform.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/transform.test.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts index 5f875b8fb377ef3..985f47dd69aba72 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/transform.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.test.ts @@ -54,7 +54,7 @@ describe('anomalySeriesTransform', () => { timeSeriesDates ); - const buckets = anomalySeries!.anomalyScoreSeries.data; + const buckets = anomalySeries!.anomalyScore; expect(buckets).toEqual([{ x: 20000, x0: 10000 }]); }); }); @@ -94,7 +94,7 @@ describe('anomalySeriesTransform', () => { timeSeriesDates ); - const buckets = anomalySeries!.anomalyBoundariesSeries.data; + const buckets = anomalySeries!.anomalyBoundaries; expect(buckets).toEqual([ { x: 5000, y: 25, y0: 20 }, { x: 10000, y: 35, y0: 30 } @@ -133,7 +133,7 @@ describe('anomalySeriesTransform', () => { timeSeriesDates ); - const buckets = anomalySeries!.anomalyBoundariesSeries.data; + const buckets = anomalySeries!.anomalyBoundaries; expect(buckets).toEqual([ { x: 5000, y: 15, y0: 10 }, { x: 10000, y: 25, y0: 20 } @@ -172,7 +172,7 @@ describe('anomalySeriesTransform', () => { timeSeriesDates ); - const buckets = anomalySeries!.anomalyBoundariesSeries.data; + const buckets = anomalySeries!.anomalyBoundaries; expect(buckets).toEqual([ { x: 5000, y: 15, y0: 10 }, { x: 10000, y: 15, y0: 10 } diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/transform.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts similarity index 72% rename from x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/transform.ts rename to x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts index 241aa111df7b5b2..ef360c5dc9aadc8 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/transform.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts @@ -5,9 +5,8 @@ */ import { first, last } from 'lodash'; -import { rgba } from 'polished'; import { oc } from 'ts-optchain'; -import { colors } from 'x-pack/plugins/apm/common/variables'; +import { Coordinate } from 'x-pack/plugins/apm/typings/timeseries'; import { ESResponse } from './fetcher'; interface IBucket { @@ -17,28 +16,9 @@ interface IBucket { upper: number | null; } -// TODO: remove duplication between this and chartSelector -interface Coordinate { - x: number; - y?: number | null; -} - -// TODO: remove duplication between this and chartSelector -interface TimeSerie { - title: string; - titleShort?: string; - hideLegend?: boolean; - hideTooltipValue?: boolean; - data: Coordinate[]; - legendValue?: string; - type: string; - color: string; - areaColor?: string; -} - export interface AnomalyTimeSeriesResponse { - anomalyScoreSeries: TimeSerie; - anomalyBoundariesSeries: TimeSerie; + anomalyScore: Coordinate[]; + anomalyBoundaries: Coordinate[]; } export function anomalySeriesTransform( @@ -65,30 +45,12 @@ export function anomalySeriesTransform( const bucketSizeInMillis = Math.max(bucketSize, mlBucketSize) * 1000; return { - anomalyScoreSeries: { - title: 'Anomaly score', - hideLegend: true, - hideTooltipValue: true, - data: getAnomalyScoreDataPoints( - buckets, - timeSeriesDates, - bucketSizeInMillis - ), - type: 'areaMaxHeight', - color: 'none', - areaColor: rgba(colors.apmRed, 0.1) - // areaColor: 'rgba(60, 100, 50, 0.5)' - }, - anomalyBoundariesSeries: { - title: 'Anomaly Boundaries', - hideLegend: true, - hideTooltipValue: true, - data: getAnomalyBoundaryDataPoints(buckets, timeSeriesDates), - type: 'area', - color: 'none', - // areaColor: 'rgba(30, 100, 30, 0.5)' - areaColor: rgba(colors.apmBlue, 0.1) - } + anomalyScore: getAnomalyScoreDataPoints( + buckets, + timeSeriesDates, + bucketSizeInMillis + ), + anomalyBoundaries: getAnomalyBoundaryDataPoints(buckets, timeSeriesDates) }; } diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/index.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/index.test.ts.snap deleted file mode 100644 index ada00d62b0ca616..000000000000000 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/index.test.ts.snap +++ /dev/null @@ -1,54 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`getAnomalySeries should match snapshot 1`] = ` -Object { - "anomalyBoundariesSeries": Object { - "areaColor": "rgba(49,133,252,0.1)", - "color": "none", - "data": Array [ - Object { - "x": 5000, - "y": 200, - "y0": 20, - }, - Object { - "x": 15000, - "y": 100, - "y0": 20, - }, - Object { - "x": 25000, - "y": 50, - "y0": 10, - }, - Object { - "x": 30000, - "y": 50, - "y0": 10, - }, - ], - "hideLegend": true, - "hideTooltipValue": true, - "title": "Anomaly Boundaries", - "type": "area", - }, - "anomalyScoreSeries": Object { - "areaColor": "rgba(146,0,0,0.1)", - "color": "none", - "data": Array [ - Object { - "x": 25000, - "x0": 15000, - }, - Object { - "x": 35000, - "x0": 25000, - }, - ], - "hideLegend": true, - "hideTooltipValue": true, - "title": "Anomaly score", - "type": "areaMaxHeight", - }, -} -`; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/transform.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/transform.test.ts.snap deleted file mode 100644 index 31f049d034b43c0..000000000000000 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_series/__snapshots__/transform.test.ts.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`anomalySeriesTransform should match snapshot 1`] = ` -Object { - "anomalyBoundariesSeries": Object { - "areaColor": "rgba(49,133,252,0.1)", - "color": "none", - "data": Array [ - Object { - "x": 10000, - "y": 200, - "y0": 20, - }, - Object { - "x": 15000, - "y": 100, - "y0": 20, - }, - Object { - "x": 25000, - "y": 50, - "y0": 10, - }, - ], - "hideLegend": true, - "hideTooltipValue": true, - "title": "Anomaly Boundaries", - "type": "area", - }, - "anomalyScoreSeries": Object { - "areaColor": "rgba(146,0,0,0.1)", - "color": "none", - "data": Array [ - Object { - "x": 25000, - "x0": 15000, - }, - Object { - "x": 35000, - "x0": 25000, - }, - ], - "hideLegend": true, - "hideTooltipValue": true, - "title": "Anomaly score", - "type": "areaMaxHeight", - }, -} -`; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap index 85299162d1c909f..ba0a07e04ad9d8e 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/__snapshots__/transform.test.ts.snap @@ -2,679 +2,2252 @@ exports[`timeseriesTransformer should match snapshot 1`] = ` Object { - "dates": Array [ - 1528124400000, - 1528135200000, - 1528146000000, - 1528156800000, - 1528167600000, - 1528178400000, - 1528189200000, - 1528200000000, - 1528210800000, - 1528221600000, - 1528232400000, - 1528243200000, - 1528254000000, - 1528264800000, - 1528275600000, - 1528286400000, - 1528297200000, - 1528308000000, - 1528318800000, - 1528329600000, - 1528340400000, - 1528351200000, - 1528362000000, - 1528372800000, - 1528383600000, - 1528394400000, - 1528405200000, - 1528416000000, - 1528426800000, - 1528437600000, - 1528448400000, - 1528459200000, - 1528470000000, - 1528480800000, - 1528491600000, - 1528502400000, - 1528513200000, - 1528524000000, - 1528534800000, - 1528545600000, - 1528556400000, - 1528567200000, - 1528578000000, - 1528588800000, - 1528599600000, - 1528610400000, - 1528621200000, - 1528632000000, - 1528642800000, - 1528653600000, - 1528664400000, - 1528675200000, - 1528686000000, - 1528696800000, - 1528707600000, - 1528718400000, - 1528729200000, - 1528740000000, - 1528750800000, - 1528761600000, - 1528772400000, - 1528783200000, - 1528794000000, - 1528804800000, - 1528815600000, - 1528826400000, - 1528837200000, - 1528848000000, - 1528858800000, - 1528869600000, - 1528880400000, - 1528891200000, - 1528902000000, - 1528912800000, - 1528923600000, - 1528934400000, - 1528945200000, - 1528956000000, - 1528966800000, - ], "overallAvgDuration": 32861.15660262639, "responseTimes": Object { "avg": Array [ - 26193.277795595466, - 25291.787065995228, - 24690.306474667796, - 24809.8953814219, - 25460.0394764508, - 26360.440733498916, - 27050.95205479452, - 26555.857333903925, - 26164.343359049206, - 26989.84546419098, - 26314.409430068266, - 27460.774575018477, - 26461.469107431974, - 27657.584946692834, - 27940.445967005213, - 34454.377581534434, - 44024.31809353839, - 36374.53333333333, - 36991.29442471209, - 37178.002701986756, - 37605.57078923814, - 37319.89767295267, - 38709.5041348433, - 38140.131856255066, - 34564.81091043125, - 33256.37743828302, - 37251.5625266752, - 38681.89084929791, - 40677.801045709355, - 39987.86453616932, - 41059.392914139804, - 39630.710111535845, - 41561.81331074284, - 43079.490738297536, - 43925.39609283509, - 25821.91424646782, - 27343.60011755486, - 25249.95060523233, - 25492.77199074074, - 25991.647281682137, - 26273.31290445375, - 26234.98976780795, - 23494.54873786408, - 22008.80482069371, - 22828.136655635586, - 22138.7081404321, - 22634.985579811735, - 22202.780998080616, - 23084.082780163997, - 23109.666146341464, - 23306.89028152719, - 39341.022704095325, - 37467.17153341258, - 52457.50554180566, - 31327.95780166252, - 30695.334941163997, - 28895.042785967435, - 30649.363989982416, - 29802.63622014101, - 30759.03002829892, - 30399.76549608631, - 29421.610233534506, - 32641.679897096656, - 30621.65440666204, - 31039.60391005818, - 30954.760723541545, - 31902.050234568553, - 31594.350653473728, - 31343.87243248879, - 31200.14450867052, - 28560.946668743833, - 24700.216146371717, - 25261.025210523563, - 26041.39789649068, - 26123.556295209142, - 46231.36177177638, - 45350.42005506141, - 48256.049354513096, - 52360.30017052116, + Object { + "x": 1528124400000, + "y": 26193.277795595466, + }, + Object { + "x": 1528135200000, + "y": 25291.787065995228, + }, + Object { + "x": 1528146000000, + "y": 24690.306474667796, + }, + Object { + "x": 1528156800000, + "y": 24809.8953814219, + }, + Object { + "x": 1528167600000, + "y": 25460.0394764508, + }, + Object { + "x": 1528178400000, + "y": 26360.440733498916, + }, + Object { + "x": 1528189200000, + "y": 27050.95205479452, + }, + Object { + "x": 1528200000000, + "y": 26555.857333903925, + }, + Object { + "x": 1528210800000, + "y": 26164.343359049206, + }, + Object { + "x": 1528221600000, + "y": 26989.84546419098, + }, + Object { + "x": 1528232400000, + "y": 26314.409430068266, + }, + Object { + "x": 1528243200000, + "y": 27460.774575018477, + }, + Object { + "x": 1528254000000, + "y": 26461.469107431974, + }, + Object { + "x": 1528264800000, + "y": 27657.584946692834, + }, + Object { + "x": 1528275600000, + "y": 27940.445967005213, + }, + Object { + "x": 1528286400000, + "y": 34454.377581534434, + }, + Object { + "x": 1528297200000, + "y": 44024.31809353839, + }, + Object { + "x": 1528308000000, + "y": 36374.53333333333, + }, + Object { + "x": 1528318800000, + "y": 36991.29442471209, + }, + Object { + "x": 1528329600000, + "y": 37178.002701986756, + }, + Object { + "x": 1528340400000, + "y": 37605.57078923814, + }, + Object { + "x": 1528351200000, + "y": 37319.89767295267, + }, + Object { + "x": 1528362000000, + "y": 38709.5041348433, + }, + Object { + "x": 1528372800000, + "y": 38140.131856255066, + }, + Object { + "x": 1528383600000, + "y": 34564.81091043125, + }, + Object { + "x": 1528394400000, + "y": 33256.37743828302, + }, + Object { + "x": 1528405200000, + "y": 37251.5625266752, + }, + Object { + "x": 1528416000000, + "y": 38681.89084929791, + }, + Object { + "x": 1528426800000, + "y": 40677.801045709355, + }, + Object { + "x": 1528437600000, + "y": 39987.86453616932, + }, + Object { + "x": 1528448400000, + "y": 41059.392914139804, + }, + Object { + "x": 1528459200000, + "y": 39630.710111535845, + }, + Object { + "x": 1528470000000, + "y": 41561.81331074284, + }, + Object { + "x": 1528480800000, + "y": 43079.490738297536, + }, + Object { + "x": 1528491600000, + "y": 43925.39609283509, + }, + Object { + "x": 1528502400000, + "y": 25821.91424646782, + }, + Object { + "x": 1528513200000, + "y": 27343.60011755486, + }, + Object { + "x": 1528524000000, + "y": 25249.95060523233, + }, + Object { + "x": 1528534800000, + "y": 25492.77199074074, + }, + Object { + "x": 1528545600000, + "y": 25991.647281682137, + }, + Object { + "x": 1528556400000, + "y": 26273.31290445375, + }, + Object { + "x": 1528567200000, + "y": 26234.98976780795, + }, + Object { + "x": 1528578000000, + "y": 23494.54873786408, + }, + Object { + "x": 1528588800000, + "y": 22008.80482069371, + }, + Object { + "x": 1528599600000, + "y": 22828.136655635586, + }, + Object { + "x": 1528610400000, + "y": 22138.7081404321, + }, + Object { + "x": 1528621200000, + "y": 22634.985579811735, + }, + Object { + "x": 1528632000000, + "y": 22202.780998080616, + }, + Object { + "x": 1528642800000, + "y": 23084.082780163997, + }, + Object { + "x": 1528653600000, + "y": 23109.666146341464, + }, + Object { + "x": 1528664400000, + "y": 23306.89028152719, + }, + Object { + "x": 1528675200000, + "y": 39341.022704095325, + }, + Object { + "x": 1528686000000, + "y": 37467.17153341258, + }, + Object { + "x": 1528696800000, + "y": 52457.50554180566, + }, + Object { + "x": 1528707600000, + "y": 31327.95780166252, + }, + Object { + "x": 1528718400000, + "y": 30695.334941163997, + }, + Object { + "x": 1528729200000, + "y": 28895.042785967435, + }, + Object { + "x": 1528740000000, + "y": 30649.363989982416, + }, + Object { + "x": 1528750800000, + "y": 29802.63622014101, + }, + Object { + "x": 1528761600000, + "y": 30759.03002829892, + }, + Object { + "x": 1528772400000, + "y": 30399.76549608631, + }, + Object { + "x": 1528783200000, + "y": 29421.610233534506, + }, + Object { + "x": 1528794000000, + "y": 32641.679897096656, + }, + Object { + "x": 1528804800000, + "y": 30621.65440666204, + }, + Object { + "x": 1528815600000, + "y": 31039.60391005818, + }, + Object { + "x": 1528826400000, + "y": 30954.760723541545, + }, + Object { + "x": 1528837200000, + "y": 31902.050234568553, + }, + Object { + "x": 1528848000000, + "y": 31594.350653473728, + }, + Object { + "x": 1528858800000, + "y": 31343.87243248879, + }, + Object { + "x": 1528869600000, + "y": 31200.14450867052, + }, + Object { + "x": 1528880400000, + "y": 28560.946668743833, + }, + Object { + "x": 1528891200000, + "y": 24700.216146371717, + }, + Object { + "x": 1528902000000, + "y": 25261.025210523563, + }, + Object { + "x": 1528912800000, + "y": 26041.39789649068, + }, + Object { + "x": 1528923600000, + "y": 26123.556295209142, + }, + Object { + "x": 1528934400000, + "y": 46231.36177177638, + }, + Object { + "x": 1528945200000, + "y": 45350.42005506141, + }, + Object { + "x": 1528956000000, + "y": 48256.049354513096, + }, + Object { + "x": 1528966800000, + "y": 52360.30017052116, + }, ], "p95": Array [ - 80738.78571428556, - 77058.03529411761, - 77892.20721980717, - 77085.86687499998, - 80048.3462981744, - 84089.21370223971, - 84880.90143416924, - 84554.8884781166, - 81839.39583333326, - 85993.55410163336, - 85001.44588628765, - 86980.16445312503, - 84961.8710743802, - 88906.54601889332, - 90198.34708994703, - 135627.71242424246, - 167037.1993837535, - 128293.12184873945, - 130653.54236263742, - 131630.8902645502, - 133581.33541666638, - 132697.92762266204, - 140003.6918918918, - 138149.5673529411, - 121872.37504835591, - 116378.03873517792, - 131545.40999999995, - 133111.25804878055, - 144821.9855278593, - 134737.3997727272, - 141206.57726666646, - 137731.8994082841, - 141476.23189033198, - 149636.31340909077, - 151934.55000000002, - 82198.17857142858, - 85946.43199999983, - 78617.66249999996, - 79606.48333333322, - 76297.93999999986, - 80742.63333333324, - 81291.45969696966, - 73467.02500000004, - 69177.66999999993, - 71956.06111111109, - 68480.91142857139, - 68957.0999999999, - 67489.50416666668, - 71556.91249999998, - 72157.65128205132, - 76124.5625, - 141709.34661835746, - 132371.48641975303, - 186783.51503759398, - 99540.17819499348, - 95982.62454212455, - 89559.3525925925, - 95769.83153735634, - 94063.90833755062, - 96399.67269119772, - 96436.42520161276, - 91860.16988095238, - 105989.8333333334, - 97937.60342555979, - 98967.2249999999, - 97561.02469135808, - 102557.78813357186, - 100137.87578595306, - 98412.97120445351, - 101607.8328012912, - 92000.51368421057, - 78027.29473684198, - 80762.078801789, - 81160.83425925927, - 84215.58945578222, - 194188.21428571426, - 172616.2293896504, - 182653.81858220184, - 194970.75667682925, + Object { + "x": 1528124400000, + "y": 80738.78571428556, + }, + Object { + "x": 1528135200000, + "y": 77058.03529411761, + }, + Object { + "x": 1528146000000, + "y": 77892.20721980717, + }, + Object { + "x": 1528156800000, + "y": 77085.86687499998, + }, + Object { + "x": 1528167600000, + "y": 80048.3462981744, + }, + Object { + "x": 1528178400000, + "y": 84089.21370223971, + }, + Object { + "x": 1528189200000, + "y": 84880.90143416924, + }, + Object { + "x": 1528200000000, + "y": 84554.8884781166, + }, + Object { + "x": 1528210800000, + "y": 81839.39583333326, + }, + Object { + "x": 1528221600000, + "y": 85993.55410163336, + }, + Object { + "x": 1528232400000, + "y": 85001.44588628765, + }, + Object { + "x": 1528243200000, + "y": 86980.16445312503, + }, + Object { + "x": 1528254000000, + "y": 84961.8710743802, + }, + Object { + "x": 1528264800000, + "y": 88906.54601889332, + }, + Object { + "x": 1528275600000, + "y": 90198.34708994703, + }, + Object { + "x": 1528286400000, + "y": 135627.71242424246, + }, + Object { + "x": 1528297200000, + "y": 167037.1993837535, + }, + Object { + "x": 1528308000000, + "y": 128293.12184873945, + }, + Object { + "x": 1528318800000, + "y": 130653.54236263742, + }, + Object { + "x": 1528329600000, + "y": 131630.8902645502, + }, + Object { + "x": 1528340400000, + "y": 133581.33541666638, + }, + Object { + "x": 1528351200000, + "y": 132697.92762266204, + }, + Object { + "x": 1528362000000, + "y": 140003.6918918918, + }, + Object { + "x": 1528372800000, + "y": 138149.5673529411, + }, + Object { + "x": 1528383600000, + "y": 121872.37504835591, + }, + Object { + "x": 1528394400000, + "y": 116378.03873517792, + }, + Object { + "x": 1528405200000, + "y": 131545.40999999995, + }, + Object { + "x": 1528416000000, + "y": 133111.25804878055, + }, + Object { + "x": 1528426800000, + "y": 144821.9855278593, + }, + Object { + "x": 1528437600000, + "y": 134737.3997727272, + }, + Object { + "x": 1528448400000, + "y": 141206.57726666646, + }, + Object { + "x": 1528459200000, + "y": 137731.8994082841, + }, + Object { + "x": 1528470000000, + "y": 141476.23189033198, + }, + Object { + "x": 1528480800000, + "y": 149636.31340909077, + }, + Object { + "x": 1528491600000, + "y": 151934.55000000002, + }, + Object { + "x": 1528502400000, + "y": 82198.17857142858, + }, + Object { + "x": 1528513200000, + "y": 85946.43199999983, + }, + Object { + "x": 1528524000000, + "y": 78617.66249999996, + }, + Object { + "x": 1528534800000, + "y": 79606.48333333322, + }, + Object { + "x": 1528545600000, + "y": 76297.93999999986, + }, + Object { + "x": 1528556400000, + "y": 80742.63333333324, + }, + Object { + "x": 1528567200000, + "y": 81291.45969696966, + }, + Object { + "x": 1528578000000, + "y": 73467.02500000004, + }, + Object { + "x": 1528588800000, + "y": 69177.66999999993, + }, + Object { + "x": 1528599600000, + "y": 71956.06111111109, + }, + Object { + "x": 1528610400000, + "y": 68480.91142857139, + }, + Object { + "x": 1528621200000, + "y": 68957.0999999999, + }, + Object { + "x": 1528632000000, + "y": 67489.50416666668, + }, + Object { + "x": 1528642800000, + "y": 71556.91249999998, + }, + Object { + "x": 1528653600000, + "y": 72157.65128205132, + }, + Object { + "x": 1528664400000, + "y": 76124.5625, + }, + Object { + "x": 1528675200000, + "y": 141709.34661835746, + }, + Object { + "x": 1528686000000, + "y": 132371.48641975303, + }, + Object { + "x": 1528696800000, + "y": 186783.51503759398, + }, + Object { + "x": 1528707600000, + "y": 99540.17819499348, + }, + Object { + "x": 1528718400000, + "y": 95982.62454212455, + }, + Object { + "x": 1528729200000, + "y": 89559.3525925925, + }, + Object { + "x": 1528740000000, + "y": 95769.83153735634, + }, + Object { + "x": 1528750800000, + "y": 94063.90833755062, + }, + Object { + "x": 1528761600000, + "y": 96399.67269119772, + }, + Object { + "x": 1528772400000, + "y": 96436.42520161276, + }, + Object { + "x": 1528783200000, + "y": 91860.16988095238, + }, + Object { + "x": 1528794000000, + "y": 105989.8333333334, + }, + Object { + "x": 1528804800000, + "y": 97937.60342555979, + }, + Object { + "x": 1528815600000, + "y": 98967.2249999999, + }, + Object { + "x": 1528826400000, + "y": 97561.02469135808, + }, + Object { + "x": 1528837200000, + "y": 102557.78813357186, + }, + Object { + "x": 1528848000000, + "y": 100137.87578595306, + }, + Object { + "x": 1528858800000, + "y": 98412.97120445351, + }, + Object { + "x": 1528869600000, + "y": 101607.8328012912, + }, + Object { + "x": 1528880400000, + "y": 92000.51368421057, + }, + Object { + "x": 1528891200000, + "y": 78027.29473684198, + }, + Object { + "x": 1528902000000, + "y": 80762.078801789, + }, + Object { + "x": 1528912800000, + "y": 81160.83425925927, + }, + Object { + "x": 1528923600000, + "y": 84215.58945578222, + }, + Object { + "x": 1528934400000, + "y": 194188.21428571426, + }, + Object { + "x": 1528945200000, + "y": 172616.2293896504, + }, + Object { + "x": 1528956000000, + "y": 182653.81858220184, + }, + Object { + "x": 1528966800000, + "y": 194970.75667682925, + }, ], "p99": Array [ - 293257.27333333343, - 290195.8800000004, - 278548.1649999994, - 290701.8973333341, - 286839.5897777779, - 287979.5149999999, - 300107.5009999992, - 294402.2179999999, - 289849.459333332, - 296942.86299999955, - 292048.20571428596, - 299308.7371666667, - 292151.2377777781, - 302274.4192592592, - 299457.1612121209, - 350398.59259259375, - 421204.23333333334, - 368166.68976190523, - 367193.6128571426, - 375658.10190476174, - 368152.03822222137, - 365705.8319999995, - 380075.48533333326, - 375697.1923809518, - 351080.94111111073, - 339294.12799999997, - 378902.90649999987, - 384483.3233333327, - 394692.25000000105, - 403362.50399999996, - 396559.0274999993, - 371815.8320000008, - 405477.6133333326, - 413542.18133333366, - 424399.340000001, - 303815.9000000001, - 306305.0800000006, - 297521.94999999984, - 317938.0900000003, - 312262.3000000003, - 318428.8700000002, - 295421.4099999999, - 293067.86000000004, - 264935.71999999933, - 282795.0400000003, - 285390.8400000001, - 290402.24, - 293655.53, - 292723.56999999995, - 301051.32000000105, - 291322.0499999998, - 379855.2444444447, - 371175.2592000001, - 498378.4238888898, - 331118.6599999997, - 328101.3999999988, - 313951.54249999986, - 323340.5274074075, - 315055.5047619052, - 330070.03599999985, - 320531.54416666675, - 315137.16628571344, - 337251.4042424246, - 327054.9243636365, - 327653.0000000006, - 324505.1399999999, - 338040.3999999998, - 328600.5173333335, - 334060.93628571345, - 328569.4964999998, - 320227.32399999973, - 292019.2899999998, - 297757.72666666657, - 308034.4466666669, - 301128.4895238093, - 447266.9, - 409147.332500001, - 423121.9773333328, - 473485.4199999998, + Object { + "x": 1528124400000, + "y": 293257.27333333343, + }, + Object { + "x": 1528135200000, + "y": 290195.8800000004, + }, + Object { + "x": 1528146000000, + "y": 278548.1649999994, + }, + Object { + "x": 1528156800000, + "y": 290701.8973333341, + }, + Object { + "x": 1528167600000, + "y": 286839.5897777779, + }, + Object { + "x": 1528178400000, + "y": 287979.5149999999, + }, + Object { + "x": 1528189200000, + "y": 300107.5009999992, + }, + Object { + "x": 1528200000000, + "y": 294402.2179999999, + }, + Object { + "x": 1528210800000, + "y": 289849.459333332, + }, + Object { + "x": 1528221600000, + "y": 296942.86299999955, + }, + Object { + "x": 1528232400000, + "y": 292048.20571428596, + }, + Object { + "x": 1528243200000, + "y": 299308.7371666667, + }, + Object { + "x": 1528254000000, + "y": 292151.2377777781, + }, + Object { + "x": 1528264800000, + "y": 302274.4192592592, + }, + Object { + "x": 1528275600000, + "y": 299457.1612121209, + }, + Object { + "x": 1528286400000, + "y": 350398.59259259375, + }, + Object { + "x": 1528297200000, + "y": 421204.23333333334, + }, + Object { + "x": 1528308000000, + "y": 368166.68976190523, + }, + Object { + "x": 1528318800000, + "y": 367193.6128571426, + }, + Object { + "x": 1528329600000, + "y": 375658.10190476174, + }, + Object { + "x": 1528340400000, + "y": 368152.03822222137, + }, + Object { + "x": 1528351200000, + "y": 365705.8319999995, + }, + Object { + "x": 1528362000000, + "y": 380075.48533333326, + }, + Object { + "x": 1528372800000, + "y": 375697.1923809518, + }, + Object { + "x": 1528383600000, + "y": 351080.94111111073, + }, + Object { + "x": 1528394400000, + "y": 339294.12799999997, + }, + Object { + "x": 1528405200000, + "y": 378902.90649999987, + }, + Object { + "x": 1528416000000, + "y": 384483.3233333327, + }, + Object { + "x": 1528426800000, + "y": 394692.25000000105, + }, + Object { + "x": 1528437600000, + "y": 403362.50399999996, + }, + Object { + "x": 1528448400000, + "y": 396559.0274999993, + }, + Object { + "x": 1528459200000, + "y": 371815.8320000008, + }, + Object { + "x": 1528470000000, + "y": 405477.6133333326, + }, + Object { + "x": 1528480800000, + "y": 413542.18133333366, + }, + Object { + "x": 1528491600000, + "y": 424399.340000001, + }, + Object { + "x": 1528502400000, + "y": 303815.9000000001, + }, + Object { + "x": 1528513200000, + "y": 306305.0800000006, + }, + Object { + "x": 1528524000000, + "y": 297521.94999999984, + }, + Object { + "x": 1528534800000, + "y": 317938.0900000003, + }, + Object { + "x": 1528545600000, + "y": 312262.3000000003, + }, + Object { + "x": 1528556400000, + "y": 318428.8700000002, + }, + Object { + "x": 1528567200000, + "y": 295421.4099999999, + }, + Object { + "x": 1528578000000, + "y": 293067.86000000004, + }, + Object { + "x": 1528588800000, + "y": 264935.71999999933, + }, + Object { + "x": 1528599600000, + "y": 282795.0400000003, + }, + Object { + "x": 1528610400000, + "y": 285390.8400000001, + }, + Object { + "x": 1528621200000, + "y": 290402.24, + }, + Object { + "x": 1528632000000, + "y": 293655.53, + }, + Object { + "x": 1528642800000, + "y": 292723.56999999995, + }, + Object { + "x": 1528653600000, + "y": 301051.32000000105, + }, + Object { + "x": 1528664400000, + "y": 291322.0499999998, + }, + Object { + "x": 1528675200000, + "y": 379855.2444444447, + }, + Object { + "x": 1528686000000, + "y": 371175.2592000001, + }, + Object { + "x": 1528696800000, + "y": 498378.4238888898, + }, + Object { + "x": 1528707600000, + "y": 331118.6599999997, + }, + Object { + "x": 1528718400000, + "y": 328101.3999999988, + }, + Object { + "x": 1528729200000, + "y": 313951.54249999986, + }, + Object { + "x": 1528740000000, + "y": 323340.5274074075, + }, + Object { + "x": 1528750800000, + "y": 315055.5047619052, + }, + Object { + "x": 1528761600000, + "y": 330070.03599999985, + }, + Object { + "x": 1528772400000, + "y": 320531.54416666675, + }, + Object { + "x": 1528783200000, + "y": 315137.16628571344, + }, + Object { + "x": 1528794000000, + "y": 337251.4042424246, + }, + Object { + "x": 1528804800000, + "y": 327054.9243636365, + }, + Object { + "x": 1528815600000, + "y": 327653.0000000006, + }, + Object { + "x": 1528826400000, + "y": 324505.1399999999, + }, + Object { + "x": 1528837200000, + "y": 338040.3999999998, + }, + Object { + "x": 1528848000000, + "y": 328600.5173333335, + }, + Object { + "x": 1528858800000, + "y": 334060.93628571345, + }, + Object { + "x": 1528869600000, + "y": 328569.4964999998, + }, + Object { + "x": 1528880400000, + "y": 320227.32399999973, + }, + Object { + "x": 1528891200000, + "y": 292019.2899999998, + }, + Object { + "x": 1528902000000, + "y": 297757.72666666657, + }, + Object { + "x": 1528912800000, + "y": 308034.4466666669, + }, + Object { + "x": 1528923600000, + "y": 301128.4895238093, + }, + Object { + "x": 1528934400000, + "y": 447266.9, + }, + Object { + "x": 1528945200000, + "y": 409147.332500001, + }, + Object { + "x": 1528956000000, + "y": 423121.9773333328, + }, + Object { + "x": 1528966800000, + "y": 473485.4199999998, + }, ], }, "totalHits": 1297673, "tpmBuckets": Array [ Object { - "avg": 70293.29113924051, - "key": "HTTP 2xx", - "values": Array [ - 81460, - 82320, - 82485, - 83995, - 82805, - 82155, - 81915, - 81475, - 83510, - 82345, - 82330, - 82755, - 83375, - 82050, - 81235, - 75725, - 80890, - 82650, - 81055, - 82265, - 82515, - 83020, - 82610, - 80820, - 82600, - 82670, - 81555, - 83350, - 80960, - 82895, - 81650, - 82825, - 82715, - 82460, - 82020, - 22640, - 22785, - 22830, - 22930, - 23360, - 23425, - 22605, - 23060, - 22675, - 23030, - 23070, - 22535, - 23055, - 22935, - 22910, - 23075, - 81255, - 84125, - 81440, - 82460, - 82170, - 85015, - 81820, - 83225, - 83475, - 82490, - 82940, - 83425, - 81805, - 83290, - 82535, - 82090, - 82385, - 83775, - 82970, - 84060, - 84315, - 83275, - 83615, - 82885, - 75625, - 82160, - 82320, - 81845, + "dataPoints": Array [ + Object { + "x": 1528124400000, + "y": 81460, + }, + Object { + "x": 1528135200000, + "y": 82320, + }, + Object { + "x": 1528146000000, + "y": 82485, + }, + Object { + "x": 1528156800000, + "y": 83995, + }, + Object { + "x": 1528167600000, + "y": 82805, + }, + Object { + "x": 1528178400000, + "y": 82155, + }, + Object { + "x": 1528189200000, + "y": 81915, + }, + Object { + "x": 1528200000000, + "y": 81475, + }, + Object { + "x": 1528210800000, + "y": 83510, + }, + Object { + "x": 1528221600000, + "y": 82345, + }, + Object { + "x": 1528232400000, + "y": 82330, + }, + Object { + "x": 1528243200000, + "y": 82755, + }, + Object { + "x": 1528254000000, + "y": 83375, + }, + Object { + "x": 1528264800000, + "y": 82050, + }, + Object { + "x": 1528275600000, + "y": 81235, + }, + Object { + "x": 1528286400000, + "y": 75725, + }, + Object { + "x": 1528297200000, + "y": 80890, + }, + Object { + "x": 1528308000000, + "y": 82650, + }, + Object { + "x": 1528318800000, + "y": 81055, + }, + Object { + "x": 1528329600000, + "y": 82265, + }, + Object { + "x": 1528340400000, + "y": 82515, + }, + Object { + "x": 1528351200000, + "y": 83020, + }, + Object { + "x": 1528362000000, + "y": 82610, + }, + Object { + "x": 1528372800000, + "y": 80820, + }, + Object { + "x": 1528383600000, + "y": 82600, + }, + Object { + "x": 1528394400000, + "y": 82670, + }, + Object { + "x": 1528405200000, + "y": 81555, + }, + Object { + "x": 1528416000000, + "y": 83350, + }, + Object { + "x": 1528426800000, + "y": 80960, + }, + Object { + "x": 1528437600000, + "y": 82895, + }, + Object { + "x": 1528448400000, + "y": 81650, + }, + Object { + "x": 1528459200000, + "y": 82825, + }, + Object { + "x": 1528470000000, + "y": 82715, + }, + Object { + "x": 1528480800000, + "y": 82460, + }, + Object { + "x": 1528491600000, + "y": 82020, + }, + Object { + "x": 1528502400000, + "y": 22640, + }, + Object { + "x": 1528513200000, + "y": 22785, + }, + Object { + "x": 1528524000000, + "y": 22830, + }, + Object { + "x": 1528534800000, + "y": 22930, + }, + Object { + "x": 1528545600000, + "y": 23360, + }, + Object { + "x": 1528556400000, + "y": 23425, + }, + Object { + "x": 1528567200000, + "y": 22605, + }, + Object { + "x": 1528578000000, + "y": 23060, + }, + Object { + "x": 1528588800000, + "y": 22675, + }, + Object { + "x": 1528599600000, + "y": 23030, + }, + Object { + "x": 1528610400000, + "y": 23070, + }, + Object { + "x": 1528621200000, + "y": 22535, + }, + Object { + "x": 1528632000000, + "y": 23055, + }, + Object { + "x": 1528642800000, + "y": 22935, + }, + Object { + "x": 1528653600000, + "y": 22910, + }, + Object { + "x": 1528664400000, + "y": 23075, + }, + Object { + "x": 1528675200000, + "y": 81255, + }, + Object { + "x": 1528686000000, + "y": 84125, + }, + Object { + "x": 1528696800000, + "y": 81440, + }, + Object { + "x": 1528707600000, + "y": 82460, + }, + Object { + "x": 1528718400000, + "y": 82170, + }, + Object { + "x": 1528729200000, + "y": 85015, + }, + Object { + "x": 1528740000000, + "y": 81820, + }, + Object { + "x": 1528750800000, + "y": 83225, + }, + Object { + "x": 1528761600000, + "y": 83475, + }, + Object { + "x": 1528772400000, + "y": 82490, + }, + Object { + "x": 1528783200000, + "y": 82940, + }, + Object { + "x": 1528794000000, + "y": 83425, + }, + Object { + "x": 1528804800000, + "y": 81805, + }, + Object { + "x": 1528815600000, + "y": 83290, + }, + Object { + "x": 1528826400000, + "y": 82535, + }, + Object { + "x": 1528837200000, + "y": 82090, + }, + Object { + "x": 1528848000000, + "y": 82385, + }, + Object { + "x": 1528858800000, + "y": 83775, + }, + Object { + "x": 1528869600000, + "y": 82970, + }, + Object { + "x": 1528880400000, + "y": 84060, + }, + Object { + "x": 1528891200000, + "y": 84315, + }, + Object { + "x": 1528902000000, + "y": 83275, + }, + Object { + "x": 1528912800000, + "y": 83615, + }, + Object { + "x": 1528923600000, + "y": 82885, + }, + Object { + "x": 1528934400000, + "y": 75625, + }, + Object { + "x": 1528945200000, + "y": 82160, + }, + Object { + "x": 1528956000000, + "y": 82320, + }, + Object { + "x": 1528966800000, + "y": 81845, + }, ], + "key": "HTTP 2xx", }, Object { - "avg": 420.88607594936707, - "key": "HTTP 3xx", - "values": Array [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20205, - 2270, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 10775, - 0, - 0, - 0, + "dataPoints": Array [ + Object { + "x": 1528124400000, + "y": 0, + }, + Object { + "x": 1528135200000, + "y": 0, + }, + Object { + "x": 1528146000000, + "y": 0, + }, + Object { + "x": 1528156800000, + "y": 0, + }, + Object { + "x": 1528167600000, + "y": 0, + }, + Object { + "x": 1528178400000, + "y": 0, + }, + Object { + "x": 1528189200000, + "y": 0, + }, + Object { + "x": 1528200000000, + "y": 0, + }, + Object { + "x": 1528210800000, + "y": 0, + }, + Object { + "x": 1528221600000, + "y": 0, + }, + Object { + "x": 1528232400000, + "y": 0, + }, + Object { + "x": 1528243200000, + "y": 0, + }, + Object { + "x": 1528254000000, + "y": 0, + }, + Object { + "x": 1528264800000, + "y": 0, + }, + Object { + "x": 1528275600000, + "y": 0, + }, + Object { + "x": 1528286400000, + "y": 20205, + }, + Object { + "x": 1528297200000, + "y": 2270, + }, + Object { + "x": 1528308000000, + "y": 0, + }, + Object { + "x": 1528318800000, + "y": 0, + }, + Object { + "x": 1528329600000, + "y": 0, + }, + Object { + "x": 1528340400000, + "y": 0, + }, + Object { + "x": 1528351200000, + "y": 0, + }, + Object { + "x": 1528362000000, + "y": 0, + }, + Object { + "x": 1528372800000, + "y": 0, + }, + Object { + "x": 1528383600000, + "y": 0, + }, + Object { + "x": 1528394400000, + "y": 0, + }, + Object { + "x": 1528405200000, + "y": 0, + }, + Object { + "x": 1528416000000, + "y": 0, + }, + Object { + "x": 1528426800000, + "y": 0, + }, + Object { + "x": 1528437600000, + "y": 0, + }, + Object { + "x": 1528448400000, + "y": 0, + }, + Object { + "x": 1528459200000, + "y": 0, + }, + Object { + "x": 1528470000000, + "y": 0, + }, + Object { + "x": 1528480800000, + "y": 0, + }, + Object { + "x": 1528491600000, + "y": 0, + }, + Object { + "x": 1528502400000, + "y": 0, + }, + Object { + "x": 1528513200000, + "y": 0, + }, + Object { + "x": 1528524000000, + "y": 0, + }, + Object { + "x": 1528534800000, + "y": 0, + }, + Object { + "x": 1528545600000, + "y": 0, + }, + Object { + "x": 1528556400000, + "y": 0, + }, + Object { + "x": 1528567200000, + "y": 0, + }, + Object { + "x": 1528578000000, + "y": 0, + }, + Object { + "x": 1528588800000, + "y": 0, + }, + Object { + "x": 1528599600000, + "y": 0, + }, + Object { + "x": 1528610400000, + "y": 0, + }, + Object { + "x": 1528621200000, + "y": 0, + }, + Object { + "x": 1528632000000, + "y": 0, + }, + Object { + "x": 1528642800000, + "y": 0, + }, + Object { + "x": 1528653600000, + "y": 0, + }, + Object { + "x": 1528664400000, + "y": 0, + }, + Object { + "x": 1528675200000, + "y": 0, + }, + Object { + "x": 1528686000000, + "y": 0, + }, + Object { + "x": 1528696800000, + "y": 0, + }, + Object { + "x": 1528707600000, + "y": 0, + }, + Object { + "x": 1528718400000, + "y": 0, + }, + Object { + "x": 1528729200000, + "y": 0, + }, + Object { + "x": 1528740000000, + "y": 0, + }, + Object { + "x": 1528750800000, + "y": 0, + }, + Object { + "x": 1528761600000, + "y": 0, + }, + Object { + "x": 1528772400000, + "y": 0, + }, + Object { + "x": 1528783200000, + "y": 0, + }, + Object { + "x": 1528794000000, + "y": 0, + }, + Object { + "x": 1528804800000, + "y": 0, + }, + Object { + "x": 1528815600000, + "y": 0, + }, + Object { + "x": 1528826400000, + "y": 0, + }, + Object { + "x": 1528837200000, + "y": 0, + }, + Object { + "x": 1528848000000, + "y": 0, + }, + Object { + "x": 1528858800000, + "y": 0, + }, + Object { + "x": 1528869600000, + "y": 0, + }, + Object { + "x": 1528880400000, + "y": 0, + }, + Object { + "x": 1528891200000, + "y": 0, + }, + Object { + "x": 1528902000000, + "y": 0, + }, + Object { + "x": 1528912800000, + "y": 0, + }, + Object { + "x": 1528923600000, + "y": 0, + }, + Object { + "x": 1528934400000, + "y": 10775, + }, + Object { + "x": 1528945200000, + "y": 0, + }, + Object { + "x": 1528956000000, + "y": 0, + }, + Object { + "x": 1528966800000, + "y": 0, + }, ], + "key": "HTTP 3xx", }, Object { - "avg": 5108.9240506329115, - "key": "HTTP 4xx", - "values": Array [ - 6065, - 6025, - 5810, - 6190, - 5955, - 6370, - 6170, - 5820, - 6165, - 6115, - 6080, - 6000, - 6185, - 6155, - 5910, - 5625, - 6215, - 6235, - 5815, - 6100, - 6010, - 5960, - 6240, - 5945, - 6150, - 6030, - 5950, - 6160, - 5855, - 6160, - 6265, - 6250, - 5835, - 6290, - 5740, - 1420, - 1200, - 1365, - 1475, - 1405, - 1500, - 1320, - 1300, - 1395, - 1295, - 1455, - 1240, - 1555, - 1385, - 1395, - 1375, - 5835, - 6350, - 5815, - 5775, - 6085, - 6135, - 5970, - 5765, - 6055, - 6015, - 6345, - 5985, - 5920, - 5880, - 5810, - 6350, - 6120, - 6275, - 6035, - 6030, - 6270, - 6080, - 6315, - 6385, - 5915, - 6105, - 5990, - 6070, + "dataPoints": Array [ + Object { + "x": 1528124400000, + "y": 6065, + }, + Object { + "x": 1528135200000, + "y": 6025, + }, + Object { + "x": 1528146000000, + "y": 5810, + }, + Object { + "x": 1528156800000, + "y": 6190, + }, + Object { + "x": 1528167600000, + "y": 5955, + }, + Object { + "x": 1528178400000, + "y": 6370, + }, + Object { + "x": 1528189200000, + "y": 6170, + }, + Object { + "x": 1528200000000, + "y": 5820, + }, + Object { + "x": 1528210800000, + "y": 6165, + }, + Object { + "x": 1528221600000, + "y": 6115, + }, + Object { + "x": 1528232400000, + "y": 6080, + }, + Object { + "x": 1528243200000, + "y": 6000, + }, + Object { + "x": 1528254000000, + "y": 6185, + }, + Object { + "x": 1528264800000, + "y": 6155, + }, + Object { + "x": 1528275600000, + "y": 5910, + }, + Object { + "x": 1528286400000, + "y": 5625, + }, + Object { + "x": 1528297200000, + "y": 6215, + }, + Object { + "x": 1528308000000, + "y": 6235, + }, + Object { + "x": 1528318800000, + "y": 5815, + }, + Object { + "x": 1528329600000, + "y": 6100, + }, + Object { + "x": 1528340400000, + "y": 6010, + }, + Object { + "x": 1528351200000, + "y": 5960, + }, + Object { + "x": 1528362000000, + "y": 6240, + }, + Object { + "x": 1528372800000, + "y": 5945, + }, + Object { + "x": 1528383600000, + "y": 6150, + }, + Object { + "x": 1528394400000, + "y": 6030, + }, + Object { + "x": 1528405200000, + "y": 5950, + }, + Object { + "x": 1528416000000, + "y": 6160, + }, + Object { + "x": 1528426800000, + "y": 5855, + }, + Object { + "x": 1528437600000, + "y": 6160, + }, + Object { + "x": 1528448400000, + "y": 6265, + }, + Object { + "x": 1528459200000, + "y": 6250, + }, + Object { + "x": 1528470000000, + "y": 5835, + }, + Object { + "x": 1528480800000, + "y": 6290, + }, + Object { + "x": 1528491600000, + "y": 5740, + }, + Object { + "x": 1528502400000, + "y": 1420, + }, + Object { + "x": 1528513200000, + "y": 1200, + }, + Object { + "x": 1528524000000, + "y": 1365, + }, + Object { + "x": 1528534800000, + "y": 1475, + }, + Object { + "x": 1528545600000, + "y": 1405, + }, + Object { + "x": 1528556400000, + "y": 1500, + }, + Object { + "x": 1528567200000, + "y": 1320, + }, + Object { + "x": 1528578000000, + "y": 1300, + }, + Object { + "x": 1528588800000, + "y": 1395, + }, + Object { + "x": 1528599600000, + "y": 1295, + }, + Object { + "x": 1528610400000, + "y": 1455, + }, + Object { + "x": 1528621200000, + "y": 1240, + }, + Object { + "x": 1528632000000, + "y": 1555, + }, + Object { + "x": 1528642800000, + "y": 1385, + }, + Object { + "x": 1528653600000, + "y": 1395, + }, + Object { + "x": 1528664400000, + "y": 1375, + }, + Object { + "x": 1528675200000, + "y": 5835, + }, + Object { + "x": 1528686000000, + "y": 6350, + }, + Object { + "x": 1528696800000, + "y": 5815, + }, + Object { + "x": 1528707600000, + "y": 5775, + }, + Object { + "x": 1528718400000, + "y": 6085, + }, + Object { + "x": 1528729200000, + "y": 6135, + }, + Object { + "x": 1528740000000, + "y": 5970, + }, + Object { + "x": 1528750800000, + "y": 5765, + }, + Object { + "x": 1528761600000, + "y": 6055, + }, + Object { + "x": 1528772400000, + "y": 6015, + }, + Object { + "x": 1528783200000, + "y": 6345, + }, + Object { + "x": 1528794000000, + "y": 5985, + }, + Object { + "x": 1528804800000, + "y": 5920, + }, + Object { + "x": 1528815600000, + "y": 5880, + }, + Object { + "x": 1528826400000, + "y": 5810, + }, + Object { + "x": 1528837200000, + "y": 6350, + }, + Object { + "x": 1528848000000, + "y": 6120, + }, + Object { + "x": 1528858800000, + "y": 6275, + }, + Object { + "x": 1528869600000, + "y": 6035, + }, + Object { + "x": 1528880400000, + "y": 6030, + }, + Object { + "x": 1528891200000, + "y": 6270, + }, + Object { + "x": 1528902000000, + "y": 6080, + }, + Object { + "x": 1528912800000, + "y": 6315, + }, + Object { + "x": 1528923600000, + "y": 6385, + }, + Object { + "x": 1528934400000, + "y": 5915, + }, + Object { + "x": 1528945200000, + "y": 6105, + }, + Object { + "x": 1528956000000, + "y": 5990, + }, + Object { + "x": 1528966800000, + "y": 6070, + }, ], + "key": "HTTP 4xx", }, Object { - "avg": 5115.632911392405, - "key": "HTTP 5xx", - "values": Array [ - 6015, - 5980, - 6150, - 6165, - 6360, - 6090, - 6085, - 6175, - 6245, - 5790, - 6075, - 5955, - 6175, - 6060, - 5900, - 5455, - 5880, - 6215, - 6040, - 6010, - 6440, - 6205, - 6075, - 5760, - 6205, - 5885, - 6215, - 6275, - 5945, - 5915, - 6075, - 6410, - 5885, - 5995, - 6170, - 1420, - 1535, - 1415, - 1515, - 1630, - 1345, - 1485, - 1390, - 1445, - 1360, - 1395, - 1190, - 1440, - 1290, - 1320, - 1480, - 6065, - 6270, - 5675, - 6200, - 6075, - 6195, - 6045, - 6040, - 5880, - 6035, - 5990, - 5825, - 5940, - 6225, - 6190, - 6415, - 5990, - 5860, - 6145, - 6195, - 6155, - 6240, - 6100, - 6120, - 5440, - 6175, - 5805, - 5915, + "dataPoints": Array [ + Object { + "x": 1528124400000, + "y": 6015, + }, + Object { + "x": 1528135200000, + "y": 5980, + }, + Object { + "x": 1528146000000, + "y": 6150, + }, + Object { + "x": 1528156800000, + "y": 6165, + }, + Object { + "x": 1528167600000, + "y": 6360, + }, + Object { + "x": 1528178400000, + "y": 6090, + }, + Object { + "x": 1528189200000, + "y": 6085, + }, + Object { + "x": 1528200000000, + "y": 6175, + }, + Object { + "x": 1528210800000, + "y": 6245, + }, + Object { + "x": 1528221600000, + "y": 5790, + }, + Object { + "x": 1528232400000, + "y": 6075, + }, + Object { + "x": 1528243200000, + "y": 5955, + }, + Object { + "x": 1528254000000, + "y": 6175, + }, + Object { + "x": 1528264800000, + "y": 6060, + }, + Object { + "x": 1528275600000, + "y": 5900, + }, + Object { + "x": 1528286400000, + "y": 5455, + }, + Object { + "x": 1528297200000, + "y": 5880, + }, + Object { + "x": 1528308000000, + "y": 6215, + }, + Object { + "x": 1528318800000, + "y": 6040, + }, + Object { + "x": 1528329600000, + "y": 6010, + }, + Object { + "x": 1528340400000, + "y": 6440, + }, + Object { + "x": 1528351200000, + "y": 6205, + }, + Object { + "x": 1528362000000, + "y": 6075, + }, + Object { + "x": 1528372800000, + "y": 5760, + }, + Object { + "x": 1528383600000, + "y": 6205, + }, + Object { + "x": 1528394400000, + "y": 5885, + }, + Object { + "x": 1528405200000, + "y": 6215, + }, + Object { + "x": 1528416000000, + "y": 6275, + }, + Object { + "x": 1528426800000, + "y": 5945, + }, + Object { + "x": 1528437600000, + "y": 5915, + }, + Object { + "x": 1528448400000, + "y": 6075, + }, + Object { + "x": 1528459200000, + "y": 6410, + }, + Object { + "x": 1528470000000, + "y": 5885, + }, + Object { + "x": 1528480800000, + "y": 5995, + }, + Object { + "x": 1528491600000, + "y": 6170, + }, + Object { + "x": 1528502400000, + "y": 1420, + }, + Object { + "x": 1528513200000, + "y": 1535, + }, + Object { + "x": 1528524000000, + "y": 1415, + }, + Object { + "x": 1528534800000, + "y": 1515, + }, + Object { + "x": 1528545600000, + "y": 1630, + }, + Object { + "x": 1528556400000, + "y": 1345, + }, + Object { + "x": 1528567200000, + "y": 1485, + }, + Object { + "x": 1528578000000, + "y": 1390, + }, + Object { + "x": 1528588800000, + "y": 1445, + }, + Object { + "x": 1528599600000, + "y": 1360, + }, + Object { + "x": 1528610400000, + "y": 1395, + }, + Object { + "x": 1528621200000, + "y": 1190, + }, + Object { + "x": 1528632000000, + "y": 1440, + }, + Object { + "x": 1528642800000, + "y": 1290, + }, + Object { + "x": 1528653600000, + "y": 1320, + }, + Object { + "x": 1528664400000, + "y": 1480, + }, + Object { + "x": 1528675200000, + "y": 6065, + }, + Object { + "x": 1528686000000, + "y": 6270, + }, + Object { + "x": 1528696800000, + "y": 5675, + }, + Object { + "x": 1528707600000, + "y": 6200, + }, + Object { + "x": 1528718400000, + "y": 6075, + }, + Object { + "x": 1528729200000, + "y": 6195, + }, + Object { + "x": 1528740000000, + "y": 6045, + }, + Object { + "x": 1528750800000, + "y": 6040, + }, + Object { + "x": 1528761600000, + "y": 5880, + }, + Object { + "x": 1528772400000, + "y": 6035, + }, + Object { + "x": 1528783200000, + "y": 5990, + }, + Object { + "x": 1528794000000, + "y": 5825, + }, + Object { + "x": 1528804800000, + "y": 5940, + }, + Object { + "x": 1528815600000, + "y": 6225, + }, + Object { + "x": 1528826400000, + "y": 6190, + }, + Object { + "x": 1528837200000, + "y": 6415, + }, + Object { + "x": 1528848000000, + "y": 5990, + }, + Object { + "x": 1528858800000, + "y": 5860, + }, + Object { + "x": 1528869600000, + "y": 6145, + }, + Object { + "x": 1528880400000, + "y": 6195, + }, + Object { + "x": 1528891200000, + "y": 6155, + }, + Object { + "x": 1528902000000, + "y": 6240, + }, + Object { + "x": 1528912800000, + "y": 6100, + }, + Object { + "x": 1528923600000, + "y": 6120, + }, + Object { + "x": 1528934400000, + "y": 5440, + }, + Object { + "x": 1528945200000, + "y": 6175, + }, + Object { + "x": 1528956000000, + "y": 5805, + }, + Object { + "x": 1528966800000, + "y": 5915, + }, ], + "key": "HTTP 5xx", }, Object { - "avg": NaN, + "dataPoints": Array [], "key": "A Custom Bucket (that should be last)", - "values": Array [], }, ], } diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts index 9457a2ffc0b4a83..a977715e60fc1a1 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/fetcher.ts @@ -31,11 +31,17 @@ interface ResponseTimeBucket { } interface TransactionResultBucket { + /** + * transaction result eg. 2xx + */ key: string; doc_count: number; timeseries: { buckets: Array<{ key_as_string: string; + /** + * timestamp in ms + */ key: number; doc_count: number; }>; diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts index 9cd6ce11968ced9..0935d63824e96a4 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/index.ts @@ -6,37 +6,21 @@ import { getBucketSize } from '../../../helpers/get_bucket_size'; import { Setup } from '../../../helpers/setup_request'; -import { getAnomalySeries } from '../get_anomaly_series'; -import { AnomalyTimeSeriesResponse } from '../get_anomaly_series/transform'; import { timeseriesFetcher } from './fetcher'; -import { ApmTimeSeriesResponse, timeseriesTransformer } from './transform'; - -export interface TimeSeriesAPIResponse extends ApmTimeSeriesResponse { - anomalyTimeSeries?: AnomalyTimeSeriesResponse; -} +import { timeseriesTransformer } from './transform'; export async function getTimeseriesData(options: { serviceName: string; transactionType: string; transactionName?: string; setup: Setup; -}): Promise { +}) { const { start, end } = options.setup; const { bucketSize } = getBucketSize(start, end, 'auto'); const timeseriesResponse = await timeseriesFetcher(options); - const transformedTimeSeries = timeseriesTransformer({ + return timeseriesTransformer({ timeseriesResponse, bucketSize }); - - const anomalyTimeSeries = await getAnomalySeries({ - ...options, - timeSeriesDates: transformedTimeSeries.dates - }); - - return { - ...transformedTimeSeries, - anomalyTimeSeries - }; } diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts index e83218d1faf636f..dfaf86c5898689c 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.test.ts @@ -5,12 +5,15 @@ */ import { first, last } from 'lodash'; -import { TimeSeriesAPIResponse } from '.'; import { timeseriesResponse } from './mock-responses/timeseries_response'; -import { getTpmBuckets, timeseriesTransformer } from './transform'; +import { + ApmTimeSeriesResponse, + getTpmBuckets, + timeseriesTransformer +} from './transform'; describe('timeseriesTransformer', () => { - let res: TimeSeriesAPIResponse; + let res: ApmTimeSeriesResponse; beforeEach(async () => { res = await timeseriesTransformer({ timeseriesResponse, @@ -23,9 +26,11 @@ describe('timeseriesTransformer', () => { 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); + expect(first(res.responseTimes.avg).x).not.toBe(first(mockDates)); + expect(last(res.responseTimes.avg).x).not.toBe(last(mockDates)); + + expect(first(res.tpmBuckets[0].dataPoints).x).not.toBe(first(mockDates)); + expect(last(res.tpmBuckets[0].dataPoints).x).not.toBe(last(mockDates)); }); it('should have correct order', () => { @@ -105,8 +110,8 @@ describe('getTpmBuckets', () => { ]; const bucketSize = 10; expect(getTpmBuckets(buckets, bucketSize)).toEqual([ - { avg: 1500, key: 'HTTP 4xx', values: [1200, 1800] }, - { avg: 1800, key: 'HTTP 5xx', values: [3000, 600] } + { dataPoints: [{ x: 1, y: 1200 }, { x: 2, y: 1800 }], key: 'HTTP 4xx' }, + { dataPoints: [{ x: 1, y: 3000 }, { x: 2, y: 600 }], key: 'HTTP 5xx' } ]); }); }); diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts index 39fa50e0349d329..b151031f8531e82 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts @@ -5,24 +5,20 @@ */ import { isNumber, round, sortBy } from 'lodash'; -import mean from 'lodash.mean'; import { oc } from 'ts-optchain'; +import { Coordinate } from 'x-pack/plugins/apm/typings/timeseries'; import { ESResponse } from './fetcher'; -type MaybeNumber = number | null; - export interface ApmTimeSeriesResponse { totalHits: number; - dates: number[]; responseTimes: { - avg: MaybeNumber[]; - p95: MaybeNumber[]; - p99: MaybeNumber[]; + avg: Coordinate[]; + p95: Coordinate[]; + p99: Coordinate[]; }; tpmBuckets: Array<{ key: string; - avg: number; - values: number[]; + dataPoints: Coordinate[]; }>; overallAvgDuration?: number; } @@ -40,15 +36,12 @@ export function timeseriesTransformer({ const responseTimeBuckets = oc(aggs) .response_times.buckets([]) .slice(1, -1); - const dates = responseTimeBuckets.map(bucket => bucket.key); const { avg, p95, p99 } = getResponseTime(responseTimeBuckets); - const transactionResultBuckets = oc(aggs).transaction_results.buckets([]); const tpmBuckets = getTpmBuckets(transactionResultBuckets, bucketSize); return { totalHits: timeseriesResponse.hits.total, - dates, responseTimes: { avg, p95, @@ -64,15 +57,14 @@ export function getTpmBuckets( bucketSize: number ) { const buckets = transactionResultBuckets.map(({ key, timeseries }) => { - const tpmValues = timeseries.buckets - .slice(1, -1) - .map(bucket => round(bucket.doc_count * (60 / bucketSize), 1)); + const dataPoints = timeseries.buckets.slice(1, -1).map(bucket => { + return { + x: bucket.key, + y: round(bucket.doc_count * (60 / bucketSize), 1) + }; + }); - return { - key, - avg: mean(tpmValues), - values: tpmValues - }; + return { key, dataPoints }; }); return sortBy( @@ -88,15 +80,15 @@ function getResponseTime( (acc, bucket) => { const { '95.0': p95, '99.0': p99 } = bucket.pct.values; - acc.avg.push(bucket.avg.value); - acc.p95.push(isNumber(p95) ? p95 : null); - acc.p99.push(isNumber(p99) ? p99 : null); + acc.avg.push({ x: bucket.key, y: bucket.avg.value }); + acc.p95.push({ x: bucket.key, y: isNumber(p95) ? p95 : null }); + acc.p99.push({ x: bucket.key, y: isNumber(p99) ? p99 : null }); return acc; }, { - avg: [] as MaybeNumber[], - p95: [] as MaybeNumber[], - p99: [] as MaybeNumber[] + avg: [] as Coordinate[], + p95: [] as Coordinate[], + p99: [] as Coordinate[] } ); } diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/index.ts b/x-pack/plugins/apm/server/lib/transactions/charts/index.ts new file mode 100644 index 000000000000000..bae86bc04eafd26 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/transactions/charts/index.ts @@ -0,0 +1,38 @@ +/* + * 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 { Setup } from '../../helpers/setup_request'; +import { getAnomalySeries } from './get_anomaly_data'; +import { AnomalyTimeSeriesResponse } from './get_anomaly_data/transform'; +import { getTimeseriesData } from './get_timeseries_data'; +import { ApmTimeSeriesResponse } from './get_timeseries_data/transform'; + +export interface TimeSeriesAPIResponse { + apmTimeseries: ApmTimeSeriesResponse; + anomalyTimeseries?: AnomalyTimeSeriesResponse; +} + +function getDates(apmTimeseries: ApmTimeSeriesResponse) { + return apmTimeseries.responseTimes.avg.map(p => p.x); +} + +export async function getChartsData(options: { + serviceName: string; + transactionType: string; + transactionName?: string; + setup: Setup; +}): Promise { + const apmTimeseries = await getTimeseriesData(options); + const anomalyTimeseries = await getAnomalySeries({ + ...options, + timeSeriesDates: getDates(apmTimeseries) + }); + + return { + apmTimeseries, + anomalyTimeseries + }; +} diff --git a/x-pack/plugins/apm/typings/lodash.mean.d.ts b/x-pack/plugins/apm/typings/lodash.mean.d.ts index c61f9adf9efd409..0b9ca3f6914cb9a 100644 --- a/x-pack/plugins/apm/typings/lodash.mean.d.ts +++ b/x-pack/plugins/apm/typings/lodash.mean.d.ts @@ -5,6 +5,6 @@ */ declare module 'lodash.mean' { - function mean(numbers: number[]): number; + function mean(numbers: Array): number; export = mean; } diff --git a/x-pack/plugins/apm/typings/timeseries.ts b/x-pack/plugins/apm/typings/timeseries.ts new file mode 100644 index 000000000000000..91550b437f4c5fa --- /dev/null +++ b/x-pack/plugins/apm/typings/timeseries.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. + */ + +export interface Coordinate { + x: number; + y?: number | null; +}