Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {
const {key} = col;

if (key === NORMALIZED_DESCRIPTION) {
const fileExtension = row[NORMALIZED_DESCRIPTION].split('.').pop() || '';
const fileExtension = (row[NORMALIZED_DESCRIPTION] ?? '').split('.').pop() || '';
Comment thread
gggritso marked this conversation as resolved.
const extraLinkQueryParams = {};
if (filters[SpanFields.USER_GEO_SUBREGION]) {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
Expand All @@ -156,7 +156,7 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {
moduleName={ModuleName.RESOURCE}
projectId={row[PROJECT_ID]}
spanOp={row[SPAN_OP]}
description={row[NORMALIZED_DESCRIPTION]}
description={row[NORMALIZED_DESCRIPTION] ?? ''}
group={row[SPAN_GROUP]}
extraLinkQueryParams={extraLinkQueryParams}
/>
Expand All @@ -173,7 +173,7 @@ function ResourceTable({sort, defaultResourceTypes}: Props) {
return <DurationCell milliseconds={row[key]} />;
}
if (key === SPAN_OP) {
const fileExtension = row[NORMALIZED_DESCRIPTION].split('.').pop() || '';
const fileExtension = (row[NORMALIZED_DESCRIPTION] ?? '').split('.').pop() || '';
const spanOp = row[key];
if (fileExtension === 'js' || spanOp === 'resource.script') {
return <span>{t('JavaScript')}</span>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default function OverviewAssetsByTimeSpentWidget(props: LoadableChartWidg
<SpanDescriptionCell
projectId={Number(item[SpanFields.PROJECT_ID])}
group={item[SpanFields.SPAN_GROUP]}
description={item[SpanFields.NORMALIZED_DESCRIPTION]}
description={item[SpanFields.NORMALIZED_DESCRIPTION] ?? ''}
moduleName={ModuleName.RESOURCE}
/>
<TimeSpentCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function OverviewSlowQueriesChartWidget(props: LoadableChartWidge
<SpanDescriptionCell
projectId={Number(item['project.id'])}
group={item['span.group']}
description={item['sentry.normalized_description']}
description={item['sentry.normalized_description'] ?? ''}
moduleName={ModuleName.DB}
/>
<ControllerText>{item.transaction}</ControllerText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default function OverviewTimeConsumingQueriesWidget(
<SpanDescriptionCell
projectId={Number(item[SpanFields.PROJECT_ID])}
group={item[SpanFields.SPAN_GROUP]}
description={item[SpanFields.NORMALIZED_DESCRIPTION]}
description={item[SpanFields.NORMALIZED_DESCRIPTION] ?? ''}
moduleName={ModuleName.DB}
/>
<TimeSpentCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function renderBodyCell(
return (
<SpanDescriptionCell
moduleName={ModuleName.DB}
description={row['sentry.normalized_description']}
description={row['sentry.normalized_description'] ?? ''}
group={row['span.group']}
projectId={row['project.id']}
system={system}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function DatabaseSpanSummaryPage() {
<DatabaseSpanDescription
groupId={groupId}
preliminaryDescription={
spanMetrics?.[SpanFields.NORMALIZED_DESCRIPTION]
spanMetrics?.[SpanFields.NORMALIZED_DESCRIPTION] ?? undefined
}
/>
</DescriptionContainer>
Expand Down
15 changes: 12 additions & 3 deletions static/app/views/insights/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ export type SpanNumberFields =
| SpanFields.TTFD;

// TODO: Enforce that these fields all come from SpanFields
export type SpanStringFields =
// These fields should never be `null` when coming from the backend. This list
// is _not_ up-to-date! If you discover more nullable string fields, update this
// list. In theory, maybe _all_ of these fields are actually nullable in
// reality, which means we'll need to update a lot of code.
export type NonNullableStringFields =
| SpanFields.COMMAND
| SpanFields.REQUEST_METHOD
| SpanFields.HTTP_REQUEST_METHOD
Expand Down Expand Up @@ -300,7 +304,6 @@ export type SpanStringFields =
| SpanFields.DEVICE_CLASS
| SpanFields.SPAN_ACTION
| SpanFields.SPAN_DOMAIN
| SpanFields.NORMALIZED_DESCRIPTION
| SpanFields.MESSAGING_MESSAGE_BODY_SIZE
| SpanFields.MESSAGING_MESSAGE_RECEIVE_LATENCY
| SpanFields.MESSAGING_MESSAGE_RETRY_COUNT
Expand All @@ -327,6 +330,10 @@ export type SpanStringFields =
| SpanFields.USER_DISPLAY
| SpanFields.SENTRY_ORIGIN;

type NullableStringFields = SpanFields.NORMALIZED_DESCRIPTION;

export type SpanStringFields = NullableStringFields | NonNullableStringFields;

type WebVitalsMeasurements =
| SpanFields.CLS_SCORE
| SpanFields.FCP_SCORE
Expand Down Expand Up @@ -491,7 +498,9 @@ type SpanResponseRaw = {
} & {
[Property in WebVitalsMeasurements as `${WebVitalsFunctions}(${Property})`]: number;
} & {
[Property in SpanStringFields as `${Property}`]: string;
[Property in NonNullableStringFields as `${Property}`]: string;
} & {
[Property in NullableStringFields as `${Property}`]: string | null;
} & {
[Property in SpanNumberFields as `${Property}`]: number;
} & {
Expand Down
Loading