Skip to content

Commit e7ab462

Browse files
fix(insights): fix issue with fcp and ttfb not rendering properly on eap Webvitals (#91591)
Fixes issues with FCP and TTFB samples not displaying properly on EAP Webvitals. This was due to some parts of the table in the samples slideout still using transaction metrics based data. Updates so that the slideout only uses spans data and handling.
1 parent 7a70629 commit e7ab462

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

static/app/views/insights/browser/webVitals/components/pageOverviewWebVitalsDetailPanel.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import type {
4040
import decodeBrowserTypes from 'sentry/views/insights/browser/webVitals/utils/queryParameterDecoders/browserType';
4141
import useProfileExists from 'sentry/views/insights/browser/webVitals/utils/useProfileExists';
4242
import {SampleDrawerBody} from 'sentry/views/insights/common/components/sampleDrawerBody';
43+
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
4344
import {useDomainViewFilters} from 'sentry/views/insights/pages/useFilters';
4445
import {SpanIndexedField, type SubregionCode} from 'sentry/views/insights/types';
4546
import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHeader/breadcrumbs';
@@ -49,8 +50,8 @@ type Column = GridColumnHeader;
4950

5051
const PAGELOADS_COLUMN_ORDER: GridColumnOrder[] = [
5152
{key: 'id', width: COL_WIDTH_UNDEFINED, name: t('Transaction')},
52-
{key: 'replayId', width: COL_WIDTH_UNDEFINED, name: t('Replay')},
5353
{key: 'profile.id', width: COL_WIDTH_UNDEFINED, name: t('Profile')},
54+
{key: 'replayId', width: COL_WIDTH_UNDEFINED, name: t('Replay')},
5455
{key: 'webVital', width: COL_WIDTH_UNDEFINED, name: t('Web Vital')},
5556
{key: 'score', width: COL_WIDTH_UNDEFINED, name: t('Score')},
5657
];
@@ -86,6 +87,7 @@ export function PageOverviewWebVitalsDetailPanel({
8687
const routes = useRoutes();
8788
const {replayExists} = useReplayExists();
8889
const domainViewFilters = useDomainViewFilters();
90+
const useEap = useInsightsEap();
8991

9092
const browserTypes = decodeBrowserTypes(location.query[SpanIndexedField.BROWSER_NAME]);
9193
const subregions = location.query[
@@ -128,7 +130,10 @@ export function PageOverviewWebVitalsDetailPanel({
128130
useTransactionSamplesCategorizedQuery({
129131
transaction: transaction ?? '',
130132
webVital,
131-
enabled: Boolean(webVital) && (!isInp || (!isSpansWebVital && useSpansWebVitals)),
133+
enabled:
134+
Boolean(webVital) &&
135+
!useEap &&
136+
(!isInp || (!isSpansWebVital && useSpansWebVitals)),
132137
browserTypes,
133138
subregions,
134139
});
@@ -137,7 +142,8 @@ export function PageOverviewWebVitalsDetailPanel({
137142
useSpanSamplesCategorizedQuery({
138143
transaction: transaction ?? '',
139144
webVital,
140-
enabled: Boolean(webVital) && (isInp || (isSpansWebVital && useSpansWebVitals)),
145+
enabled:
146+
Boolean(webVital) && (useEap || isInp || (isSpansWebVital && useSpansWebVitals)),
141147
browserTypes,
142148
subregions,
143149
});
@@ -331,7 +337,7 @@ export function PageOverviewWebVitalsDetailPanel({
331337
replayId: row.replayId,
332338
id: '', // id doesn't actually matter here. Just to satisfy type.
333339
'transaction.duration':
334-
isInp || (isSpansWebVital && useSpansWebVitals)
340+
useEap || isInp || (isSpansWebVital && useSpansWebVitals)
335341
? row[SpanIndexedField.SPAN_SELF_TIME]
336342
: // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
337343
row['transaction.duration'],
@@ -415,7 +421,7 @@ export function PageOverviewWebVitalsDetailPanel({
415421
return (
416422
<NoOverflow>
417423
{eventTarget ? (
418-
<Link to={eventTarget}>{getShortEventId(row.id)}</Link>
424+
<Link to={eventTarget}>{getShortEventId(row.trace)}</Link>
419425
) : (
420426
<span>{getShortEventId(row.id)}</span>
421427
)}
@@ -465,11 +471,15 @@ export function PageOverviewWebVitalsDetailPanel({
465471
renderBodyCell: renderSpansBodyCell,
466472
}}
467473
/>
468-
) : isSpansWebVital && useSpansWebVitals ? (
474+
) : useEap || (isSpansWebVital && useSpansWebVitals) ? (
469475
<GridEditable
470476
data={spansTableData}
471477
isLoading={isSpansLoading}
472-
columnOrder={SPANS_SAMPLES_COLUMN_ORDER}
478+
columnOrder={
479+
isSpansWebVital && useSpansWebVitals
480+
? SPANS_SAMPLES_COLUMN_ORDER
481+
: PAGELOADS_COLUMN_ORDER
482+
}
473483
columnSortBy={[sort]}
474484
grid={{
475485
renderHeadCell,

static/app/views/insights/browser/webVitals/queries/useSpanSamplesCategorizedQuery.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export function useSpanSamplesCategorizedQuery({
7878

7979
const isLoading = isGoodDataLoading || isMehDataLoading || isBadDataLoading;
8080

81-
const spanSamplesTableData: SpanSampleRowWithScore[] = data.sort(
82-
(a, b) => a.totalScore - b.totalScore
83-
);
81+
const spanSamplesTableData: SpanSampleRowWithScore[] = defined(webVital)
82+
? data.sort((a, b) => a[`${webVital}Score`] - b[`${webVital}Score`])
83+
: data.sort((a, b) => a.totalScore - b.totalScore);
8484

8585
return {
8686
data: spanSamplesTableData,

static/app/views/insights/browser/webVitals/queries/useSpanSamplesWebVitalsQuery.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ export function useSpanSamplesWebVitalsQuery({
141141
inpScore: Math.round((row[SpanIndexedField.INP_SCORE_RATIO] ?? 0) * 100),
142142
lcpScore: Math.round((row[SpanIndexedField.LCP_SCORE_RATIO] ?? 0) * 100),
143143
clsScore: Math.round((row[SpanIndexedField.CLS_SCORE_RATIO] ?? 0) * 100),
144+
fcpScore: Math.round((row[SpanIndexedField.FCP_SCORE_RATIO] ?? 0) * 100),
145+
ttfbScore: Math.round((row[SpanIndexedField.TTFB_SCORE_RATIO] ?? 0) * 100),
144146
projectSlug: row[SpanIndexedField.PROJECT],
145147
};
146148
})

static/app/views/insights/browser/webVitals/types.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ type SpanSampleRow = {
6060
[SpanIndexedField.CLS_SOURCE]?: string;
6161
};
6262

63-
export type SpanSampleRowWithScore = SpanSampleRow & {
64-
totalScore: number;
65-
};
63+
export type SpanSampleRowWithScore = SpanSampleRow & Score;
6664

6765
export type Opportunity = {
6866
opportunity: number;

0 commit comments

Comments
 (0)