Skip to content

feat(trace-tabs-ui): Adding ops to search on click and hiding trace level ops breakdown #91684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2025
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
12 changes: 8 additions & 4 deletions static/app/views/performance/newTraceDetails/trace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
scoreToStatus,
STATUS_TEXT,
} from 'sentry/views/insights/browser/webVitals/utils/scoreToStatus';
import {useHasTraceTabsUI} from 'sentry/views/performance/newTraceDetails/useHasTraceTabsUI';

import type {TraceMetaQueryResults} from './traceApi/useTraceMeta';
import {TraceTree} from './traceModels/traceTree';
Expand Down Expand Up @@ -145,6 +146,7 @@ export function Trace({
const traceState = useTraceState();
const traceDispatch = useTraceStateDispatch();
const {theme: colorMode} = useLegacyStore(ConfigStore);
const hasTraceTabsUi = useHasTraceTabsUI();

const rerenderRef = useRef<TraceProps['rerender']>(rerender);
rerenderRef.current = rerender;
Expand Down Expand Up @@ -410,10 +412,12 @@ export function Trace({
className="TraceScrollbarContainer"
ref={manager.registerHorizontalScrollBarContainerRef}
>
<TraceLevelOpsBreakdown
isTraceLoading={isLoading}
metaQueryResults={metaQueryResults}
/>
{hasTraceTabsUi ? null : (
<TraceLevelOpsBreakdown
isTraceLoading={isLoading}
metaQueryResults={metaQueryResults}
/>
)}
<div className="TraceScrollbarScroller" />
</div>
<div className="TraceDivider" ref={manager.registerDividerRef} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ const VitalPillName = styled('div')<{status: PerformanceScore}>`

height: 100%;
padding: 0 ${space(1)};
border: solid 1px ${p => makePerformanceScoreColors(p.theme)[p.status].border};
border: solid 1px
${p =>
p.status === 'none'
? p.theme.border
: makePerformanceScoreColors(p.theme)[p.status].border};
border-radius: ${p => p.theme.borderRadius} 0 0 ${p => p.theme.borderRadius};

background-color: ${p => makePerformanceScoreColors(p.theme)[p.status].light};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Fragment, type PropsWithChildren, useMemo, useState} from 'react';
import {Fragment, type PropsWithChildren, useCallback, useMemo, useState} from 'react';
import {css, useTheme} from '@emotion/react';
import styled from '@emotion/styled';
import type {LocationDescriptor} from 'history';
Expand Down Expand Up @@ -426,6 +426,15 @@ function Highlights({
headerContent,
bodyContent,
}: HighlightProps) {
const dispatch = useTraceStateDispatch();

const onOpsBreakdownRowClick = useCallback(
(op: string) => {
dispatch({type: 'set query', query: `op:${op}`, source: 'external'});
},
[dispatch]
);

if (!isTransactionNode(node) && !isSpanNode(node) && !isEAPSpanNode(node)) {
return null;
}
Expand Down Expand Up @@ -475,9 +484,9 @@ function Highlights({
<PanelBody>{bodyContent}</PanelBody>
</StyledPanel>
{isEAPSpanNode(node) ? (
<HighLightEAPOpsBreakdown node={node} />
<HighLightEAPOpsBreakdown onRowClick={onOpsBreakdownRowClick} node={node} />
) : event ? (
<HighLightsOpsBreakdown event={event} />
<HighLightsOpsBreakdown onRowClick={onOpsBreakdownRowClick} event={event} />
) : null}
</HighlightsRightColumn>
</HighlightsWrapper>
Expand All @@ -490,7 +499,13 @@ const StyledPanel = styled(Panel)`
margin-bottom: 0;
`;

function HighLightsOpsBreakdown({event}: {event: EventTransaction}) {
function HighLightsOpsBreakdown({
event,
onRowClick,
}: {
event: EventTransaction;
onRowClick: (op: string) => void;
}) {
const theme = useTheme();
const breakdown = generateStats(event, {type: 'no_filter'});

Expand All @@ -508,7 +523,10 @@ function HighLightsOpsBreakdown({event}: {event: EventTransaction}) {
const pctLabel = isFinite(percentage) ? Math.round(percentage * 100) : '∞';

return (
<HighlightsOpRow key={operationName}>
<HighlightsOpRow
key={operationName}
onClick={() => onRowClick(operationName)}
>
<IconCircleFill size="xs" color={color as Color} />
{operationName}
<HighlightsOpPct>{pctLabel}%</HighlightsOpPct>
Expand All @@ -520,7 +538,13 @@ function HighLightsOpsBreakdown({event}: {event: EventTransaction}) {
);
}

function HighLightEAPOpsBreakdown({node}: {node: TraceTreeNode<TraceTree.EAPSpan>}) {
function HighLightEAPOpsBreakdown({
node,
onRowClick,
}: {
node: TraceTreeNode<TraceTree.EAPSpan>;
onRowClick: (op: string) => void;
}) {
const theme = useTheme();
const breakdown = node.eapSpanOpsBreakdown;

Expand Down Expand Up @@ -555,7 +579,10 @@ function HighLightEAPOpsBreakdown({node}: {node: TraceTreeNode<TraceTree.EAPSpan
const pctLabel = Math.round(currOp.percentage);

return (
<HighlightsOpRow key={operationName}>
<HighlightsOpRow
key={operationName}
onClick={() => onRowClick(operationName)}
>
<IconCircleFill size="xs" color={color as Color} />
{operationName}
<HighlightsOpPct>{pctLabel}%</HighlightsOpPct>
Expand Down Expand Up @@ -586,6 +613,7 @@ const HighlightsSpanCount = styled('div')`
const HighlightsOpRow = styled(FlexBox)`
font-size: 13px;
gap: ${space(0.5)};
cursor: pointer;
`;

const HighlightsOpsBreakdownWrapper = styled(FlexBox)`
Expand Down
Loading