Skip to content

Commit 58f267f

Browse files
Abdkhan14Abdullah Khan
and
Abdullah Khan
authored
feat(new-trace-drawer-details): Not displaying rows with no values. (#70151)
<img width="470" alt="Screenshot 2024-05-02 at 1 47 59 PM" src="https://github.com/getsentry/sentry/assets/60121741/43dc58da-f2be-43c4-b436-385d7184775f"> --------- Co-authored-by: Abdullah Khan <abdullahkhan@PG9Y57YDXQ.local>
1 parent 4e86bc3 commit 58f267f

File tree

4 files changed

+39
-35
lines changed

4 files changed

+39
-35
lines changed

static/app/components/events/opsBreakdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type OpStats = {
4444

4545
const TOP_N_SPANS = 4;
4646

47-
type OpBreakdownType = OpStats[];
47+
export type OpBreakdownType = OpStats[];
4848

4949
type Props = {
5050
event: Event | AggregateEventTransaction;

static/app/views/performance/newTraceDetails/traceDrawer/details/span/sections/ancestry.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {assert} from 'sentry/types/utils';
2222
import {defined} from 'sentry/utils';
2323
import EventView from 'sentry/utils/discover/eventView';
2424
import {generateEventSlug} from 'sentry/utils/discover/urls';
25+
import type {TraceFullDetailed} from 'sentry/utils/performance/quickTrace/types';
2526
import type {
2627
TraceTree,
2728
TraceTreeNode,
@@ -39,20 +40,14 @@ type TransactionResult = {
3940
};
4041

4142
function SpanChild({
42-
node,
43+
childTransaction,
4344
organization,
4445
location,
4546
}: {
47+
childTransaction: TraceTreeNode<TraceFullDetailed>;
4648
location: Location;
47-
node: TraceTreeNode<TraceTree.Span>;
4849
organization: Organization;
4950
}) {
50-
const childTransaction = node.value.childTransactions?.[0];
51-
52-
if (!childTransaction) {
53-
return null;
54-
}
55-
5651
const transactionResult: TransactionResult = {
5752
'project.name': childTransaction.value.project_slug,
5853
transaction: childTransaction.value.transaction,
@@ -216,11 +211,21 @@ export function getSpanAncestryAndGroupingItems({
216211
subject: t('Parent Span ID'),
217212
});
218213

219-
items.push({
220-
key: 'transaction_name',
221-
value: <SpanChild node={node} organization={organization} location={location} />,
222-
subject: t('Child Transaction'),
223-
});
214+
const childTransaction = node.value.childTransactions?.[0];
215+
216+
if (childTransaction) {
217+
items.push({
218+
key: 'child_transaction',
219+
value: (
220+
<SpanChild
221+
childTransaction={childTransaction}
222+
organization={organization}
223+
location={location}
224+
/>
225+
),
226+
subject: t('Child Transaction'),
227+
});
228+
}
224229

225230
if (span.same_process_as_parent) {
226231
items.push({

static/app/views/performance/newTraceDetails/traceDrawer/details/transaction/sections/generalInfo.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {Location} from 'history';
33
import omit from 'lodash/omit';
44

55
import {CopyToClipboardButton} from 'sentry/components/copyToClipboardButton';
6+
import {generateStats} from 'sentry/components/events/opsBreakdown';
67
import QuestionTooltip from 'sentry/components/questionTooltip';
78
import {PAGE_URL_PARAM} from 'sentry/constants/pageFilters';
89
import {t} from 'sentry/locale';
@@ -111,19 +112,23 @@ function GeneralInfo({
111112
),
112113
});
113114

114-
items.push({
115-
key: 'ops_breakdown',
116-
subject: (
117-
<TraceDrawerComponents.FlexBox style={{gap: '5px'}}>
118-
{t('Ops Breakdown')}
119-
<QuestionTooltip
120-
title={t('Applicable to the children of this event only')}
121-
size="xs"
122-
/>
123-
</TraceDrawerComponents.FlexBox>
124-
),
125-
value: <OpsBreakdown event={event} />,
126-
});
115+
const breakdown = generateStats(event, {type: 'no_filter'});
116+
117+
if (breakdown.length > 0) {
118+
items.push({
119+
key: 'ops_breakdown',
120+
subject: (
121+
<TraceDrawerComponents.FlexBox style={{gap: '5px'}}>
122+
{t('Ops Breakdown')}
123+
<QuestionTooltip
124+
title={t('Applicable to the children of this event only')}
125+
size="xs"
126+
/>
127+
</TraceDrawerComponents.FlexBox>
128+
),
129+
value: <OpsBreakdown breakdown={breakdown} />,
130+
});
131+
}
127132

128133
return <TraceDrawerComponents.SectionCard items={items} title={t('General')} />;
129134
}

static/app/views/performance/newTraceDetails/traceDrawer/details/transaction/sections/opsBreakDown.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import {useState} from 'react';
22

3-
import {generateStats} from 'sentry/components/events/opsBreakdown';
3+
import type {OpBreakdownType} from 'sentry/components/events/opsBreakdown';
44
import PerformanceDuration from 'sentry/components/performanceDuration';
55
import {t} from 'sentry/locale';
66
import {space} from 'sentry/styles/space';
7-
import type {EventTransaction} from 'sentry/types';
87

9-
export function OpsBreakdown({event}: {event: EventTransaction}) {
8+
export function OpsBreakdown({breakdown}: {breakdown: OpBreakdownType}) {
109
const [showingAll, setShowingAll] = useState(false);
11-
const breakdown = event && generateStats(event, {type: 'no_filter'});
12-
13-
if (breakdown.length <= 0) {
14-
return null;
15-
}
1610

1711
const renderText = showingAll ? t('Show less') : t('Show more') + '...';
1812

0 commit comments

Comments
 (0)