Skip to content

Commit 44de4f9

Browse files
TackAdamAdam Tackett
and
Adam Tackett
authored
Traces table fix for invalid date (#2399)
* add fallback for invalid date, remove duration 0 return Signed-off-by: Adam Tackett <[email protected]> * update cypress testing Signed-off-by: Adam Tackett <[email protected]> --------- Signed-off-by: Adam Tackett <[email protected]> Co-authored-by: Adam Tackett <[email protected]>
1 parent fc2fd14 commit 44de4f9

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ describe('Testing traces table', () => {
4242

4343
// test data contains output from data-prepper 0.8, which doesn't have fields denormalized
4444
// Trace Analytics should be able to handle the discrepancy if some fields cannot be parsed
45-
cy.contains('Invalid date').should('exist');
4645
cy.contains('-').should('exist');
4746
});
4847

@@ -366,6 +365,6 @@ describe('Testing traces Custom source', () => {
366365

367366
cy.get('a.euiLink.euiLink--primary').first().click();
368367
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
369-
cy.get('.overview-content').should('contain.text', 'be0a3dceda2ecf601fd2e476fef3ee07');
368+
cy.get('.overview-content').should('contain.text', 'd5bc99166e521eec173bcb7f9b0d3c43');
370369
});
371370
});

public/components/trace_analytics/components/traces/__tests__/__snapshots__/traces.test.tsx.snap

+4
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,7 @@ exports[`Traces component renders empty traces page 1`] = `
15571557
"align": "right",
15581558
"field": "latency",
15591559
"name": "Duration (ms)",
1560+
"render": [Function],
15601561
"sortable": true,
15611562
"truncateText": true,
15621563
},
@@ -1632,6 +1633,7 @@ exports[`Traces component renders empty traces page 1`] = `
16321633
"align": "right",
16331634
"field": "latency",
16341635
"name": "Duration (ms)",
1636+
"render": [Function],
16351637
"sortable": true,
16361638
"truncateText": true,
16371639
},
@@ -6298,6 +6300,7 @@ exports[`Traces component renders traces page 1`] = `
62986300
"align": "right",
62996301
"field": "latency",
63006302
"name": "Duration (ms)",
6303+
"render": [Function],
63016304
"sortable": true,
63026305
"truncateText": true,
63036306
},
@@ -6373,6 +6376,7 @@ exports[`Traces component renders traces page 1`] = `
63736376
"align": "right",
63746377
"field": "latency",
63756378
"name": "Duration (ms)",
6379+
"render": [Function],
63766380
"sortable": true,
63776381
"truncateText": true,
63786382
},

public/components/trace_analytics/components/traces/__tests__/__snapshots__/traces_table.test.tsx.snap

+5-7
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,7 @@ exports[`Traces table component renders traces table 1`] = `
18761876
"align": "right",
18771877
"field": "latency",
18781878
"name": "Duration (ms)",
1879+
"render": [Function],
18791880
"sortable": true,
18801881
"truncateText": true,
18811882
},
@@ -1963,6 +1964,7 @@ exports[`Traces table component renders traces table 1`] = `
19631964
"align": "right",
19641965
"field": "latency",
19651966
"name": "Duration (ms)",
1967+
"render": [Function],
19661968
"sortable": true,
19671969
"truncateText": true,
19681970
},
@@ -2854,7 +2856,7 @@ exports[`Traces table component renders traces table 1`] = `
28542856
}
28552857
}
28562858
setScopeRow={false}
2857-
textOnly={true}
2859+
textOnly={false}
28582860
truncateText={true}
28592861
>
28602862
<td
@@ -2871,13 +2873,9 @@ exports[`Traces table component renders traces table 1`] = `
28712873
Duration (ms)
28722874
</div>
28732875
<div
2874-
className="euiTableCellContent euiTableCellContent--alignRight euiTableCellContent--truncateText"
2876+
className="euiTableCellContent euiTableCellContent--alignRight euiTableCellContent--truncateText euiTableCellContent--overflowingContent"
28752877
>
2876-
<span
2877-
className="euiTableCellContent__text"
2878-
>
2879-
19.91
2880-
</span>
2878+
19.91
28812879
</div>
28822880
</td>
28832881
</EuiTableRowCell>

public/components/trace_analytics/components/traces/traces_table.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export function TracesTable(props: TracesTableProps) {
122122
align: 'right',
123123
sortable: true,
124124
truncateText: true,
125+
render: (item) => (item === 0 || item ? item : '-'),
125126
},
126127
{
127128
field: 'percentile_in_trace_group',

public/components/trace_analytics/requests/queries/traces_queries.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ export const getTracesQuery = (
151151
if (doc.containsKey('traceGroupFields.durationInNanos') && !doc['traceGroupFields.durationInNanos'].empty) {
152152
return Math.round(doc['traceGroupFields.durationInNanos'].value / 10000) / 100.0
153153
}
154-
155-
return 0
156154
`,
157155
lang: 'painless',
158156
},
@@ -173,7 +171,17 @@ export const getTracesQuery = (
173171
},
174172
last_updated: {
175173
max: {
176-
field: 'traceGroupFields.endTime',
174+
script: {
175+
source: `
176+
if (doc.containsKey('traceGroupFields.endTime') && !doc['traceGroupFields.endTime'].empty) {
177+
return doc['traceGroupFields.endTime'].value;
178+
}
179+
if (doc.containsKey('endTime') && !doc['endTime'].empty) {
180+
return doc['endTime'].value;
181+
}
182+
`,
183+
lang: 'painless',
184+
},
177185
},
178186
},
179187
},

0 commit comments

Comments
 (0)