diff --git a/x-pack/plugins/apm/public/components/app/correlations/error_correlations.tsx b/x-pack/plugins/apm/public/components/app/correlations/error_correlations.tsx index e5e7b0c7e1738..b27beb25ecc34 100644 --- a/x-pack/plugins/apm/public/components/app/correlations/error_correlations.tsx +++ b/x-pack/plugins/apm/public/components/app/correlations/error_correlations.tsx @@ -62,10 +62,11 @@ export function ErrorCorrelations({ onClose }: Props) { `apm.correlations.errors.fields:${serviceName}`, defaultFieldNames ); + const hasFieldNames = fieldNames.length > 0; const { data, status } = useFetcher( (callApmApi) => { - if (start && end) { + if (start && end && hasFieldNames) { return callApmApi({ endpoint: 'GET /api/apm/correlations/failed_transactions', params: { @@ -92,6 +93,7 @@ export function ErrorCorrelations({ onClose }: Props) { transactionType, uiFilters, fieldNames, + hasFieldNames, ] ); @@ -122,7 +124,7 @@ export function ErrorCorrelations({ onClose }: Props) { @@ -133,7 +135,7 @@ export function ErrorCorrelations({ onClose }: Props) { 'xpack.apm.correlations.error.percentageColumnName', { defaultMessage: '% of failed transactions' } )} - significantTerms={data?.significantTerms} + significantTerms={hasFieldNames ? data?.significantTerms : []} status={status} setSelectedSignificantTerm={setSelectedSignificantTerm} onFilter={onClose} diff --git a/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx b/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx index dd77b7266a387..da3bd109d5dc6 100644 --- a/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx +++ b/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx @@ -60,6 +60,8 @@ export function LatencyCorrelations({ onClose }: Props) { `apm.correlations.latency.fields:${serviceName}`, defaultFieldNames ); + const hasFieldNames = fieldNames.length > 0; + const [ durationPercentile, setDurationPercentile, @@ -70,7 +72,7 @@ export function LatencyCorrelations({ onClose }: Props) { const { data, status } = useFetcher( (callApmApi) => { - if (start && end) { + if (start && end && hasFieldNames) { return callApmApi({ endpoint: 'GET /api/apm/correlations/slow_transactions', params: { @@ -99,6 +101,7 @@ export function LatencyCorrelations({ onClose }: Props) { uiFilters, durationPercentile, fieldNames, + hasFieldNames, ] ); @@ -130,7 +133,7 @@ export function LatencyCorrelations({ onClose }: Props) { @@ -143,7 +146,7 @@ export function LatencyCorrelations({ onClose }: Props) { 'xpack.apm.correlations.latency.percentageColumnName', { defaultMessage: '% of slow transactions' } )} - significantTerms={data?.significantTerms} + significantTerms={hasFieldNames ? data?.significantTerms : []} status={status} setSelectedSignificantTerm={setSelectedSignificantTerm} onFilter={onClose}