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 4e8a8e3f5092..c3b5f52dd84b 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 @@ -63,10 +63,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: { @@ -93,6 +94,7 @@ export function ErrorCorrelations({ onClose }: Props) { transactionName, transactionType, fieldNames, + hasFieldNames, ] ); @@ -123,7 +125,7 @@ export function ErrorCorrelations({ onClose }: Props) { @@ -134,7 +136,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 76e9a9242efb..77571421ed00 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 @@ -61,6 +61,8 @@ export function LatencyCorrelations({ onClose }: Props) { `apm.correlations.latency.fields:${serviceName}`, defaultFieldNames ); + const hasFieldNames = fieldNames.length > 0; + const [ durationPercentile, setDurationPercentile, @@ -71,7 +73,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: { @@ -100,6 +102,7 @@ export function LatencyCorrelations({ onClose }: Props) { transactionType, durationPercentile, fieldNames, + hasFieldNames, ] ); @@ -131,7 +134,7 @@ export function LatencyCorrelations({ onClose }: Props) { @@ -144,7 +147,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}