Skip to content

Commit 9f7e01f

Browse files
narsaynorathMichaelSun48
authored andcommitted
fix(app-start): Add trace to event samples query (#69581)
The UI expects this data field to be present, otherwise the URLs for the events don't route properly. Add the field but also restrict the visible columns to ones defined in the name map
1 parent d642fdf commit 9f7e01f

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

static/app/views/starfish/views/appStartup/screenSummary/eventSamples.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function EventSamples({
8282

8383
const newQuery: NewQuery = {
8484
name: '',
85-
fields: ['transaction.id', 'project.name', 'profile_id', 'span.duration'],
85+
fields: ['trace', 'transaction.id', 'project.name', 'profile_id', 'span.duration'],
8686
query: searchQuery.formatString(),
8787
dataset: DiscoverDatasets.SPANS_INDEXED,
8888
version: 2,

static/app/views/starfish/views/screens/screenLoadSpans/eventSamplesTable.spec.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,38 @@ describe('EventSamplesTable', function () {
236236
'/mock-pathname/?customSortKey=-duration'
237237
);
238238
});
239+
240+
it('only displays data for the columns defined in the name map', async function () {
241+
mockQuery = {
242+
name: '',
243+
fields: ['transaction.id', 'duration'],
244+
query: '',
245+
version: 2,
246+
};
247+
248+
mockEventView = EventView.fromNewQueryWithLocation(mockQuery, mockLocation);
249+
render(
250+
<EventSamplesTable
251+
eventIdKey="transaction.id"
252+
columnNameMap={{duration: 'Duration'}}
253+
cursorName="customCursorName"
254+
eventView={mockEventView}
255+
isLoading={false}
256+
profileIdKey="profile.id"
257+
sort={{
258+
field: 'transaction.id',
259+
kind: 'desc',
260+
}}
261+
sortKey="customSortKey"
262+
data={{data: [{id: '1', 'transaction.id': 'abc', duration: 'def'}], meta: {}}}
263+
/>
264+
);
265+
266+
// Although ID is queried for, because it's not defined in the map
267+
// it isn't rendered
268+
expect(
269+
await screen.findByRole('columnheader', {name: 'Duration'})
270+
).toBeInTheDocument();
271+
expect(screen.getAllByRole('columnheader')).toHaveLength(1);
272+
});
239273
});

static/app/views/starfish/views/screens/screenLoadSpans/eventSamplesTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ export function EventSamplesTable({
188188
isLoading={isLoading}
189189
data={data?.data as TableDataRow[]}
190190
columnOrder={eventViewColumns
191-
.filter((col: TableColumn<React.ReactText>) => col.name !== 'project.name')
191+
.filter((col: TableColumn<React.ReactText>) =>
192+
Object.keys(columnNameMap).includes(col.name)
193+
)
192194
.map((col: TableColumn<React.ReactText>) => {
193195
return {...col, name: columnNameMap[col.key]};
194196
})}

0 commit comments

Comments
 (0)