Skip to content

Commit

Permalink
[APM] Handle correlations view with missing field names (#93443) (#94015
Browse files Browse the repository at this point in the history
)

* [APM] Handle correlations view with missing field names (#93443)

* fixes spelling

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
ogupte and kibanamachine authored Mar 9, 2021
1 parent 4eff7a0 commit 931b54f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -93,6 +94,7 @@ export function ErrorCorrelations({ onClose }: Props) {
transactionName,
transactionType,
fieldNames,
hasFieldNames,
]
);

Expand Down Expand Up @@ -123,7 +125,7 @@ export function ErrorCorrelations({ onClose }: Props) {
</EuiFlexItem>
<EuiFlexItem>
<ErrorTimeseriesChart
data={data}
data={hasFieldNames ? data : undefined}
status={status}
selectedSignificantTerm={selectedSignificantTerm}
/>
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export function LatencyCorrelations({ onClose }: Props) {
`apm.correlations.latency.fields:${serviceName}`,
defaultFieldNames
);
const hasFieldNames = fieldNames.length > 0;

const [
durationPercentile,
setDurationPercentile,
Expand All @@ -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: {
Expand Down Expand Up @@ -100,6 +102,7 @@ export function LatencyCorrelations({ onClose }: Props) {
transactionType,
durationPercentile,
fieldNames,
hasFieldNames,
]
);

Expand Down Expand Up @@ -131,7 +134,7 @@ export function LatencyCorrelations({ onClose }: Props) {
</h4>
</EuiTitle>
<LatencyDistributionChart
data={data}
data={hasFieldNames ? data : undefined}
status={status}
selectedSignificantTerm={selectedSignificantTerm}
/>
Expand All @@ -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}
Expand Down

0 comments on commit 931b54f

Please sign in to comment.