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
) (#94197)

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

* fixes spelling

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
ogupte and kibanamachine authored Mar 11, 2021
1 parent 11f4ea8 commit d7ba901
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 @@ -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: {
Expand All @@ -92,6 +93,7 @@ export function ErrorCorrelations({ onClose }: Props) {
transactionType,
uiFilters,
fieldNames,
hasFieldNames,
]
);

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

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

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

0 comments on commit d7ba901

Please sign in to comment.