From 01f239e922fa5297dede76188ddab8b1b2460e2e Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Tue, 29 Sep 2020 12:11:52 +0200 Subject: [PATCH] Review feedback --- .../apm/public/hooks/useTransactionDistribution.ts | 6 ++---- .../basic/tests/transaction_groups/distribution.ts | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts b/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts index 1143639f10f47..cd3e02d155602 100644 --- a/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts +++ b/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts @@ -69,13 +69,11 @@ export function useTransactionDistribution(urlParams: IUrlParams) { // selected sample was not found. select a new one: // sorted by total number of requests, but only pick // from buckets that have samples - const bucketsSortedByPreference = response.buckets + const bucketsSortedByCount = response.buckets .filter((bucket) => !isEmpty(bucket.samples)) .sort((bucket) => bucket.count); - const preferredSample = maybe( - bucketsSortedByPreference[0]?.samples[0] - ); + const preferredSample = maybe(bucketsSortedByCount[0]?.samples[0]); history.push({ ...history.location, diff --git a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/distribution.ts b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/distribution.ts index 61dc6ea63c252..6ea050d2eea3c 100644 --- a/x-pack/test/apm_api_integration/basic/tests/transaction_groups/distribution.ts +++ b/x-pack/test/apm_api_integration/basic/tests/transaction_groups/distribution.ts @@ -17,14 +17,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { const archiveName = 'apm_8.0.0'; const metadata = archives_metadata[archiveName]; - // url parameters - const { start, end } = metadata; - const uiFilters = {}; - const url = `/api/apm/services/opbeans-java/transaction_groups/distribution?${qs.stringify({ - start, - end, - uiFilters, + start: metadata.start, + end: metadata.end, + uiFilters: {}, transactionName: 'APIRestController#stats', transactionType: 'request', })}`;