Skip to content

Commit 4f49bdf

Browse files
authored
feat(traceLinks): Add tooltip with link to docs (#89844)
Adds a hoverable tooltip with a link to the docs. The tooltip is shown when hovering 400 ms over the link. This prevents showing the tooltip when users just quickly click on it. ![image](https://github.com/user-attachments/assets/4aa7ab19-ecc2-4f8a-bf13-f0ed7d73081d) closes #89840
1 parent 2b64ac8 commit 4f49bdf

File tree

1 file changed

+69
-28
lines changed

1 file changed

+69
-28
lines changed

static/app/views/performance/newTraceDetails/traceLinksNavigation/traceLinkNavigationButton.tsx

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import type {
66
SpanLink,
77
TraceContextType,
88
} from 'sentry/components/events/interfaces/spans/types';
9+
import ExternalLink from 'sentry/components/links/externalLink';
910
import Link from 'sentry/components/links/link';
1011
import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
1112
import {IconChevron} from 'sentry/icons';
12-
import {t} from 'sentry/locale';
13+
import {t, tct} from 'sentry/locale';
1314
import {space} from 'sentry/styles/space';
1415
import {useLocation} from 'sentry/utils/useLocation';
1516
import useOrganization from 'sentry/utils/useOrganization';
@@ -104,39 +105,75 @@ export function TraceLinkNavigationButton({
104105

105106
if (previousTraceLink && isLinkedTraceAvailable) {
106107
return (
107-
<TraceLink
108-
color="gray500"
109-
to={getTraceDetailsUrl({
110-
traceSlug: previousTraceLink.trace_id,
111-
spanId: previousTraceLink.span_id,
112-
dateSelection,
113-
timestamp: linkedTraceTimestamp,
114-
location,
115-
organization,
116-
})}
108+
<StyledTooltip
109+
position="right"
110+
delay={400}
111+
isHoverable
112+
title={tct(
113+
`This links to the previous trace within the same session. To learn more, [link:read the docs].`,
114+
{
115+
link: (
116+
<ExternalLink
117+
href={
118+
'https://docs.sentry.io/concepts/key-terms/tracing/trace-view/#previous-and-next-traces'
119+
}
120+
/>
121+
),
122+
}
123+
)}
117124
>
118-
<IconChevron direction="left" />
119-
<TraceLinkText>{t('Go to Previous Trace')}</TraceLinkText>
120-
</TraceLink>
125+
<TraceLink
126+
color="gray500"
127+
to={getTraceDetailsUrl({
128+
traceSlug: previousTraceLink.trace_id,
129+
spanId: previousTraceLink.span_id,
130+
dateSelection,
131+
timestamp: linkedTraceTimestamp,
132+
location,
133+
organization,
134+
})}
135+
>
136+
<IconChevron direction="left" />
137+
<TraceLinkText>{t('Go to Previous Trace')}</TraceLinkText>
138+
</TraceLink>
139+
</StyledTooltip>
121140
);
122141
}
123142

124143
if (nextTraceData?.trace_id && nextTraceData.span_id && isLinkedTraceAvailable) {
125144
return (
126-
<TraceLink
127-
color="gray500"
128-
to={getTraceDetailsUrl({
129-
traceSlug: nextTraceData.trace_id,
130-
spanId: nextTraceData.span_id,
131-
dateSelection,
132-
timestamp: linkedTraceTimestamp,
133-
location,
134-
organization,
135-
})}
145+
<StyledTooltip
146+
position="left"
147+
delay={400}
148+
isHoverable
149+
title={tct(
150+
`This links to the next trace within the same session. To learn more, [link:read the docs].`,
151+
{
152+
link: (
153+
<ExternalLink
154+
href={
155+
'https://docs.sentry.io/concepts/key-terms/tracing/trace-view/#previous-and-next-traces'
156+
}
157+
/>
158+
),
159+
}
160+
)}
136161
>
137-
<TraceLinkText>{t('Go to Next Trace')}</TraceLinkText>
138-
<IconChevron direction="right" />
139-
</TraceLink>
162+
<TraceLink
163+
color="gray500"
164+
to={getTraceDetailsUrl({
165+
traceSlug: nextTraceData.trace_id,
166+
spanId: nextTraceData.span_id,
167+
dateSelection,
168+
timestamp: linkedTraceTimestamp,
169+
location,
170+
organization,
171+
})}
172+
>
173+
<TraceLinkText>{t('Go to Next Trace')}</TraceLinkText>
174+
<IconChevron direction="right" />
175+
</TraceLink>
176+
</StyledTooltip>
140177
);
141178
}
142179

@@ -165,10 +202,14 @@ const StyledTooltip = styled(Tooltip)`
165202

166203
const TraceLink = styled(Link)`
167204
font-weight: ${p => p.theme.fontWeightNormal};
168-
color: ${p => p.theme.subText};
169205
padding: ${space(0.25)} ${space(0.5)};
170206
display: flex;
171207
align-items: center;
208+
209+
color: ${p => p.theme.subText};
210+
:hover {
211+
color: ${p => p.theme.subText};
212+
}
172213
`;
173214

174215
const TraceLinkText = styled('span')`

0 commit comments

Comments
 (0)