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 7afb7427c210f..e5d6aad693869 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 @@ -58,12 +58,10 @@ export function getTpmBuckets({ const buckets = transactionResultBuckets.map( ({ key: resultKey, timeseries }) => { const dataPoints = timeseries.buckets.map((bucket) => { - // calculate request/minute. Avoid up-scaling numbers if bucketSize is below 60s (1 minute). - // Eg. 1 request during a 10 second window should be displayed as "1 rpm" instead of "6 rpm". - const tmpValue = bucket.count.value * (60 / Math.max(60, bucketSize)); return { x: bucket.key, - y: tmpValue, + // divide by minutes + y: bucket.count.value / (bucketSize / 60), }; }); diff --git a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/__snapshots__/transaction_charts.snap b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/__snapshots__/transaction_charts.snap index 75dc775d887e4..a75b8918ed5e4 100644 --- a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/__snapshots__/transaction_charts.snap +++ b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/__snapshots__/transaction_charts.snap @@ -750,15 +750,15 @@ Object { "dataPoints": Array [ Object { "x": 1601389800000, - "y": 3, + "y": 6, }, Object { "x": 1601389830000, - "y": 2, + "y": 4, }, Object { "x": 1601389860000, - "y": 1, + "y": 2, }, Object { "x": 1601389890000, @@ -766,15 +766,15 @@ Object { }, Object { "x": 1601389920000, - "y": 4, + "y": 8, }, Object { "x": 1601389950000, - "y": 1, + "y": 2, }, Object { "x": 1601389980000, - "y": 1, + "y": 2, }, Object { "x": 1601390010000, @@ -782,15 +782,15 @@ Object { }, Object { "x": 1601390040000, - "y": 11, + "y": 22, }, Object { "x": 1601390070000, - "y": 4, + "y": 8, }, Object { "x": 1601390100000, - "y": 1, + "y": 2, }, Object { "x": 1601390130000, @@ -798,11 +798,11 @@ Object { }, Object { "x": 1601390160000, - "y": 10, + "y": 20, }, Object { "x": 1601390190000, - "y": 1, + "y": 2, }, Object { "x": 1601390220000, @@ -814,7 +814,7 @@ Object { }, Object { "x": 1601390280000, - "y": 1, + "y": 2, }, Object { "x": 1601390310000, @@ -822,7 +822,7 @@ Object { }, Object { "x": 1601390340000, - "y": 1, + "y": 2, }, Object { "x": 1601390370000, @@ -834,11 +834,11 @@ Object { }, Object { "x": 1601390430000, - "y": 1, + "y": 2, }, Object { "x": 1601390460000, - "y": 4, + "y": 8, }, Object { "x": 1601390490000, @@ -846,11 +846,11 @@ Object { }, Object { "x": 1601390520000, - "y": 3, + "y": 6, }, Object { "x": 1601390550000, - "y": 3, + "y": 6, }, Object { "x": 1601390580000, @@ -866,7 +866,7 @@ Object { }, Object { "x": 1601390670000, - "y": 2, + "y": 4, }, Object { "x": 1601390700000, @@ -878,23 +878,23 @@ Object { }, Object { "x": 1601390760000, - "y": 2, + "y": 4, }, Object { "x": 1601390790000, - "y": 2, + "y": 4, }, Object { "x": 1601390820000, - "y": 3, + "y": 6, }, Object { "x": 1601390850000, - "y": 1, + "y": 2, }, Object { "x": 1601390880000, - "y": 6, + "y": 12, }, Object { "x": 1601390910000, @@ -902,7 +902,7 @@ Object { }, Object { "x": 1601390940000, - "y": 3, + "y": 6, }, Object { "x": 1601390970000, @@ -910,7 +910,7 @@ Object { }, Object { "x": 1601391000000, - "y": 5, + "y": 10, }, Object { "x": 1601391030000, @@ -922,19 +922,19 @@ Object { }, Object { "x": 1601391090000, - "y": 1, + "y": 2, }, Object { "x": 1601391120000, - "y": 4, + "y": 8, }, Object { "x": 1601391150000, - "y": 1, + "y": 2, }, Object { "x": 1601391180000, - "y": 2, + "y": 4, }, Object { "x": 1601391210000, @@ -942,11 +942,11 @@ Object { }, Object { "x": 1601391240000, - "y": 3, + "y": 6, }, Object { "x": 1601391270000, - "y": 1, + "y": 2, }, Object { "x": 1601391300000, @@ -958,7 +958,7 @@ Object { }, Object { "x": 1601391360000, - "y": 1, + "y": 2, }, Object { "x": 1601391390000, @@ -966,7 +966,7 @@ Object { }, Object { "x": 1601391420000, - "y": 1, + "y": 2, }, Object { "x": 1601391450000, @@ -974,11 +974,11 @@ Object { }, Object { "x": 1601391480000, - "y": 2, + "y": 4, }, Object { "x": 1601391510000, - "y": 6, + "y": 12, }, Object { "x": 1601391540000, @@ -986,7 +986,7 @@ Object { }, Object { "x": 1601391570000, - "y": 1, + "y": 2, }, Object { "x": 1601391600000, @@ -1020,7 +1020,7 @@ Object { }, Object { "x": 1601389950000, - "y": 1, + "y": 2, }, Object { "x": 1601389980000, @@ -1032,7 +1032,7 @@ Object { }, Object { "x": 1601390040000, - "y": 1, + "y": 2, }, Object { "x": 1601390070000, @@ -1048,7 +1048,7 @@ Object { }, Object { "x": 1601390160000, - "y": 2, + "y": 4, }, Object { "x": 1601390190000, @@ -1116,7 +1116,7 @@ Object { }, Object { "x": 1601390670000, - "y": 1, + "y": 2, }, Object { "x": 1601390700000, @@ -1128,7 +1128,7 @@ Object { }, Object { "x": 1601390760000, - "y": 1, + "y": 2, }, Object { "x": 1601390790000, @@ -1250,27 +1250,27 @@ Object { "dataPoints": Array [ Object { "x": 1601389800000, - "y": 4, + "y": 8, }, Object { "x": 1601389830000, - "y": 3, + "y": 6, }, Object { "x": 1601389860000, - "y": 2, + "y": 4, }, Object { "x": 1601389890000, - "y": 2, + "y": 4, }, Object { "x": 1601389920000, - "y": 1, + "y": 2, }, Object { "x": 1601389950000, - "y": 4, + "y": 8, }, Object { "x": 1601389980000, @@ -1278,23 +1278,23 @@ Object { }, Object { "x": 1601390010000, - "y": 3, + "y": 6, }, Object { "x": 1601390040000, - "y": 3, + "y": 6, }, Object { "x": 1601390070000, - "y": 1, + "y": 2, }, Object { "x": 1601390100000, - "y": 2, + "y": 4, }, Object { "x": 1601390130000, - "y": 3, + "y": 6, }, Object { "x": 1601390160000, @@ -1302,15 +1302,15 @@ Object { }, Object { "x": 1601390190000, - "y": 3, + "y": 6, }, Object { "x": 1601390220000, - "y": 2, + "y": 4, }, Object { "x": 1601390250000, - "y": 3, + "y": 6, }, Object { "x": 1601390280000, @@ -1318,15 +1318,15 @@ Object { }, Object { "x": 1601390310000, - "y": 3, + "y": 6, }, Object { "x": 1601390340000, - "y": 3, + "y": 6, }, Object { "x": 1601390370000, - "y": 2, + "y": 4, }, Object { "x": 1601390400000, @@ -1334,159 +1334,159 @@ Object { }, Object { "x": 1601390430000, - "y": 3, + "y": 6, }, Object { "x": 1601390460000, - "y": 1, + "y": 2, }, Object { "x": 1601390490000, - "y": 3, + "y": 6, }, Object { "x": 1601390520000, - "y": 1, + "y": 2, }, Object { "x": 1601390550000, - "y": 2, + "y": 4, }, Object { "x": 1601390580000, - "y": 2, + "y": 4, }, Object { "x": 1601390610000, - "y": 2, + "y": 4, }, Object { "x": 1601390640000, - "y": 1, + "y": 2, }, Object { "x": 1601390670000, - "y": 2, + "y": 4, }, Object { "x": 1601390700000, - "y": 2, + "y": 4, }, Object { "x": 1601390730000, - "y": 3, + "y": 6, }, Object { "x": 1601390760000, - "y": 1, + "y": 2, }, Object { "x": 1601390790000, - "y": 2, + "y": 4, }, Object { "x": 1601390820000, - "y": 3, + "y": 6, }, Object { "x": 1601390850000, - "y": 2, + "y": 4, }, Object { "x": 1601390880000, - "y": 2, + "y": 4, }, Object { "x": 1601390910000, - "y": 4, + "y": 8, }, Object { "x": 1601390940000, - "y": 1, + "y": 2, }, Object { "x": 1601390970000, - "y": 3, + "y": 6, }, Object { "x": 1601391000000, - "y": 1, + "y": 2, }, Object { "x": 1601391030000, - "y": 3, + "y": 6, }, Object { "x": 1601391060000, - "y": 2, + "y": 4, }, Object { "x": 1601391090000, - "y": 3, + "y": 6, }, Object { "x": 1601391120000, - "y": 2, + "y": 4, }, Object { "x": 1601391150000, - "y": 2, + "y": 4, }, Object { "x": 1601391180000, - "y": 1, + "y": 2, }, Object { "x": 1601391210000, - "y": 2, + "y": 4, }, Object { "x": 1601391240000, - "y": 2, + "y": 4, }, Object { "x": 1601391270000, - "y": 2, + "y": 4, }, Object { "x": 1601391300000, - "y": 3, + "y": 6, }, Object { "x": 1601391330000, - "y": 2, + "y": 4, }, Object { "x": 1601391360000, - "y": 2, + "y": 4, }, Object { "x": 1601391390000, - "y": 3, + "y": 6, }, Object { "x": 1601391420000, - "y": 3, + "y": 6, }, Object { "x": 1601391450000, - "y": 2, + "y": 4, }, Object { "x": 1601391480000, - "y": 1, + "y": 2, }, Object { "x": 1601391510000, - "y": 3, + "y": 6, }, Object { "x": 1601391540000, - "y": 1, + "y": 2, }, Object { "x": 1601391570000, - "y": 4, + "y": 8, }, Object { "x": 1601391600000, diff --git a/x-pack/test/apm_api_integration/trial/tests/csm/__snapshots__/page_views.snap b/x-pack/test/apm_api_integration/trial/tests/csm/__snapshots__/page_views.snap new file mode 100644 index 0000000000000..38b009fc73d34 --- /dev/null +++ b/x-pack/test/apm_api_integration/trial/tests/csm/__snapshots__/page_views.snap @@ -0,0 +1,280 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`CSM page views when there is data returns page views 1`] = ` +Object { + "items": Array [ + Object { + "x": 1600149947000, + "y": 1, + }, + Object { + "x": 1600149957000, + "y": 0, + }, + Object { + "x": 1600149967000, + "y": 0, + }, + Object { + "x": 1600149977000, + "y": 0, + }, + Object { + "x": 1600149987000, + "y": 0, + }, + Object { + "x": 1600149997000, + "y": 0, + }, + Object { + "x": 1600150007000, + "y": 0, + }, + Object { + "x": 1600150017000, + "y": 0, + }, + Object { + "x": 1600150027000, + "y": 1, + }, + Object { + "x": 1600150037000, + "y": 0, + }, + Object { + "x": 1600150047000, + "y": 0, + }, + Object { + "x": 1600150057000, + "y": 0, + }, + Object { + "x": 1600150067000, + "y": 0, + }, + Object { + "x": 1600150077000, + "y": 1, + }, + Object { + "x": 1600150087000, + "y": 0, + }, + Object { + "x": 1600150097000, + "y": 0, + }, + Object { + "x": 1600150107000, + "y": 0, + }, + Object { + "x": 1600150117000, + "y": 0, + }, + Object { + "x": 1600150127000, + "y": 0, + }, + Object { + "x": 1600150137000, + "y": 0, + }, + Object { + "x": 1600150147000, + "y": 0, + }, + Object { + "x": 1600150157000, + "y": 0, + }, + Object { + "x": 1600150167000, + "y": 0, + }, + Object { + "x": 1600150177000, + "y": 1, + }, + Object { + "x": 1600150187000, + "y": 0, + }, + Object { + "x": 1600150197000, + "y": 0, + }, + Object { + "x": 1600150207000, + "y": 1, + }, + Object { + "x": 1600150217000, + "y": 0, + }, + Object { + "x": 1600150227000, + "y": 0, + }, + Object { + "x": 1600150237000, + "y": 1, + }, + ], + "topItems": Array [], +} +`; + +exports[`CSM page views when there is data returns page views with breakdown 1`] = ` +Object { + "items": Array [ + Object { + "Chrome": 1, + "x": 1600149947000, + "y": 1, + }, + Object { + "x": 1600149957000, + "y": 0, + }, + Object { + "x": 1600149967000, + "y": 0, + }, + Object { + "x": 1600149977000, + "y": 0, + }, + Object { + "x": 1600149987000, + "y": 0, + }, + Object { + "x": 1600149997000, + "y": 0, + }, + Object { + "x": 1600150007000, + "y": 0, + }, + Object { + "x": 1600150017000, + "y": 0, + }, + Object { + "Chrome": 1, + "x": 1600150027000, + "y": 1, + }, + Object { + "x": 1600150037000, + "y": 0, + }, + Object { + "x": 1600150047000, + "y": 0, + }, + Object { + "x": 1600150057000, + "y": 0, + }, + Object { + "x": 1600150067000, + "y": 0, + }, + Object { + "Chrome": 1, + "x": 1600150077000, + "y": 1, + }, + Object { + "x": 1600150087000, + "y": 0, + }, + Object { + "x": 1600150097000, + "y": 0, + }, + Object { + "x": 1600150107000, + "y": 0, + }, + Object { + "x": 1600150117000, + "y": 0, + }, + Object { + "x": 1600150127000, + "y": 0, + }, + Object { + "x": 1600150137000, + "y": 0, + }, + Object { + "x": 1600150147000, + "y": 0, + }, + Object { + "x": 1600150157000, + "y": 0, + }, + Object { + "x": 1600150167000, + "y": 0, + }, + Object { + "Chrome": 1, + "x": 1600150177000, + "y": 1, + }, + Object { + "x": 1600150187000, + "y": 0, + }, + Object { + "x": 1600150197000, + "y": 0, + }, + Object { + "Chrome Mobile": 1, + "x": 1600150207000, + "y": 1, + }, + Object { + "x": 1600150217000, + "y": 0, + }, + Object { + "x": 1600150227000, + "y": 0, + }, + Object { + "Chrome Mobile": 1, + "x": 1600150237000, + "y": 1, + }, + ], + "topItems": Array [ + "Chrome", + "Chrome Mobile", + ], +} +`; + +exports[`CSM page views when there is no data returns empty list 1`] = ` +Object { + "items": Array [], + "topItems": Array [], +} +`; + +exports[`CSM page views when there is no data returns empty list with breakdowns 1`] = ` +Object { + "items": Array [], + "topItems": Array [], +} +`;