Skip to content

Commit 9e3f5bb

Browse files
authored
feat(replays): Cleanup Replay>Network table by hiding Type prefixes (#46292)
We don't show the network op prefixes anymore (before we did show the prefix `navigation.` but hid `resource.`) the prefix is still visible in the url though, which I don't think is a big deal. We can't scrub it from all the internal data structures because it's how we differentiate network spans from memory and other breadcrumb types. ![SCR-20230323-ky7](https://user-images.githubusercontent.com/187460/227375995-d446079d-cfeb-43a7-868b-3aa761a0917e.png) Relates to getsentry/team-replay#35
1 parent 66666d4 commit 9e3f5bb

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

static/app/views/replays/detail/network/networkTableCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ const NetworkTableCell = forwardRef<HTMLDivElement, Props>(
8484
() => (
8585
<Cell {...columnProps}>
8686
<Tooltip
87-
title={span.op.replace('resource.', '')}
87+
title={span.op.split('.')?.[1] ?? span.op}
8888
isHoverable
8989
showOnlyOnOverflow
9090
>
91-
<Text>{span.op.replace('resource.', '')}</Text>
91+
<Text>{span.op.split('.')?.[1] ?? span.op}</Text>
9292
</Tooltip>
9393
</Cell>
9494
),

static/app/views/replays/detail/network/useNetworkFilters.spec.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('useNetworkFilters', () => {
144144
});
145145

146146
it('should update the url when setters are called', () => {
147-
const TYPE_FILTER = ['fetch'];
147+
const TYPE_FILTER = ['resource.fetch'];
148148
const STATUS_FILTER = ['200'];
149149
const SEARCH_FILTER = 'pikachu';
150150

@@ -228,7 +228,7 @@ describe('useNetworkFilters', () => {
228228
mockUseLocation.mockReturnValue({
229229
pathname: '/',
230230
query: {
231-
f_n_type: ['fetch'],
231+
f_n_type: ['resource.fetch'],
232232
},
233233
} as Location<FilterFields>);
234234

@@ -257,7 +257,7 @@ describe('useNetworkFilters', () => {
257257
pathname: '/',
258258
query: {
259259
f_n_status: ['200'],
260-
f_n_type: ['fetch'],
260+
f_n_type: ['resource.fetch'],
261261
f_n_search: 'pokemon/',
262262
},
263263
} as Location<FilterFields>);
@@ -278,7 +278,7 @@ describe('getResourceTypes', () => {
278278
});
279279

280280
expect(result.current.getResourceTypes()).toStrictEqual([
281-
{label: 'fetch', value: 'fetch'},
281+
{label: 'fetch', value: 'resource.fetch'},
282282
]);
283283
});
284284

@@ -290,10 +290,10 @@ describe('getResourceTypes', () => {
290290
});
291291

292292
expect(result.current.getResourceTypes()).toStrictEqual([
293-
{label: 'fetch', value: 'fetch'},
294-
{label: 'link', value: 'link'},
295-
{label: 'navigation.navigate', value: 'navigation.navigate'},
296-
{label: 'script', value: 'script'},
293+
{label: 'fetch', value: 'resource.fetch'},
294+
{label: 'link', value: 'resource.link'},
295+
{label: 'navigate', value: 'navigation.navigate'},
296+
{label: 'script', value: 'resource.script'},
297297
]);
298298
});
299299

@@ -311,10 +311,10 @@ describe('getResourceTypes', () => {
311311
});
312312

313313
expect(result.current.getResourceTypes()).toStrictEqual([
314-
{label: 'fetch', value: 'fetch'},
315-
{label: 'link', value: 'link'},
316-
{label: 'navigation.navigate', value: 'navigation.navigate'},
317-
{label: 'script', value: 'script'},
314+
{label: 'fetch', value: 'resource.fetch'},
315+
{label: 'link', value: 'resource.link'},
316+
{label: 'navigate', value: 'navigation.navigate'},
317+
{label: 'script', value: 'resource.script'},
318318
]);
319319
});
320320
});

static/app/views/replays/detail/network/useNetworkFilters.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const FILTERS = {
3636
(status.includes(UNKNOWN_STATUS) && item.data.statusCode === undefined),
3737

3838
type: (item: NetworkSpan, types: string[]) =>
39-
types.length === 0 || types.includes(item.op.replace('resource.', '')),
39+
types.length === 0 || types.includes(item.op),
4040

4141
searchTerm: (item: NetworkSpan, searchTerm: string) =>
4242
JSON.stringify(item.description).toLowerCase().includes(searchTerm),
@@ -61,17 +61,11 @@ function useNetworkFilters({networkSpans}: Options): Return {
6161

6262
const getResourceTypes = useCallback(
6363
() =>
64-
Array.from(
65-
new Set(
66-
networkSpans
67-
.map(networkSpan => networkSpan.op.replace('resource.', ''))
68-
.concat(type)
69-
)
70-
)
71-
.sort()
64+
Array.from(new Set(networkSpans.map(networkSpan => networkSpan.op).concat(type)))
65+
.sort((a, b) => ((a.split('.')?.[1] ?? a) < (b.split('.')?.[1] ?? b) ? -1 : 1))
7266
.map(value => ({
7367
value,
74-
label: value,
68+
label: value.split('.')?.[1] ?? value,
7569
})),
7670
[networkSpans, type]
7771
);

0 commit comments

Comments
 (0)