Skip to content

Commit 295e8b1

Browse files
gggritsopriscilawebdev
authored andcommitted
feat(otlp): Use name attribute in more spaces in the span waterfall (#97704)
A few more visual updates to the span waterfall for those using OTel-friendly UI: 1. Update the span tree again. This time, bring it back closer to show it originally worked. Always show `span.op` (unless it's `"default"`). Show the span name if using OTel UI, otherwise show span description 2. Favour `db.query.text` attribute when creating a formatted description. This is a semantic attribute that contains the entire query, it should be used first 3. For OTel UI, show the span name in place of the span description in the span description section of the details panel 4. When making a "More Samples" link for OTel UI, create the query by using the `span.name` attribute instead of `span.description
1 parent dece80b commit 295e8b1

File tree

2 files changed

+44
-25
lines changed

2 files changed

+44
-25
lines changed

static/app/views/performance/newTraceDetails/traceDrawer/details/span/eapSections/description.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/utils';
4646
import type {TraceTree} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
4747
import type {TraceTreeNode} from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeNode';
48+
import {useOTelFriendlyUI} from 'sentry/views/performance/otlp/useOTelFriendlyUI';
4849
import {spanDetailsRouteWithQuery} from 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails/utils';
4950
import {usePerformanceGeneralProjectSettings} from 'sentry/views/performance/utils';
5051

@@ -73,9 +74,11 @@ export function SpanDescription({
7374
});
7475
const span = node.value;
7576
const hasExploreEnabled = organization.features.includes('visibility-explore-view');
77+
const shouldUseOTelFriendlyUI = useOTelFriendlyUI();
7678

7779
const category = findSpanAttributeValue(attributes, 'span.category');
7880
const dbSystem = findSpanAttributeValue(attributes, 'db.system');
81+
const dbQueryText = findSpanAttributeValue(attributes, 'db.query.text');
7982
const group = findSpanAttributeValue(attributes, 'span.group');
8083

8184
const resolvedModule: ModuleName = resolveSpanModule(span.op, category);
@@ -93,10 +96,15 @@ export function SpanDescription({
9396
return prettyPrintJsonString(span.description).prettifiedQuery;
9497
}
9598

96-
return formatter.toString(span.description ?? '');
97-
}, [span.description, resolvedModule, dbSystem]);
99+
return formatter.toString(dbQueryText ?? span.description ?? '');
100+
}, [span.description, resolvedModule, dbSystem, dbQueryText]);
98101

99-
const actions = span.description ? (
102+
const exploreAttributeName = shouldUseOTelFriendlyUI
103+
? SpanFields.NAME
104+
: SpanFields.SPAN_DESCRIPTION;
105+
const exploreAttributeValue = shouldUseOTelFriendlyUI ? span.name : span.description;
106+
107+
const actions = exploreAttributeValue ? (
100108
<BodyContentWrapper
101109
padding={
102110
resolvedModule === ModuleName.DB ? `${space(1)} ${space(2)}` : `${space(1)}`
@@ -116,8 +124,8 @@ export function SpanDescription({
116124
organization,
117125
location,
118126
node.event?.projectID,
119-
SpanFields.SPAN_DESCRIPTION,
120-
span.description,
127+
exploreAttributeName,
128+
exploreAttributeValue,
121129
TraceDrawerActionKind.INCLUDE
122130
)
123131
: spanDetailsRouteWithQuery({
@@ -132,8 +140,8 @@ export function SpanDescription({
132140
if (hasExploreEnabled) {
133141
traceAnalytics.trackExploreSearch(
134142
organization,
135-
SpanFields.SPAN_DESCRIPTION,
136-
span.description!,
143+
exploreAttributeName,
144+
exploreAttributeValue,
137145
TraceDrawerActionKind.INCLUDE,
138146
'drawer'
139147
);
@@ -184,6 +192,17 @@ export function SpanDescription({
184192
node={node}
185193
attributes={attributes}
186194
/>
195+
) : shouldUseOTelFriendlyUI && span.name ? (
196+
<DescriptionWrapper>
197+
<FormattedDescription>{span.name}</FormattedDescription>
198+
<CopyToClipboardButton
199+
borderless
200+
size="zero"
201+
iconSize="xs"
202+
text={span.name}
203+
tooltipProps={{disabled: true}}
204+
/>
205+
</DescriptionWrapper>
187206
) : (
188207
<DescriptionWrapper>
189208
{formattedDescription ? (

static/app/views/performance/newTraceDetails/traceRow/traceSpanRow.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,30 +82,30 @@ export function TraceSpanRow(
8282
<PlatformIcon
8383
platform={props.projects[props.node.metadata.project_slug ?? ''] ?? 'default'}
8484
/>
85-
{shouldUseOTelFriendlyUI &&
86-
isEAPSpanNode(props.node) &&
87-
props.node.value.name ? (
88-
<React.Fragment>
89-
<span className="TraceName" title={props.node.value.name}>
90-
{ellipsize(props.node.value.name, 100)}
91-
</span>
92-
</React.Fragment>
93-
) : (
94-
<React.Fragment>
95-
{props.node.value.op && props.node.value.op !== 'default' && (
96-
<React.Fragment>
97-
<span className="TraceOperation">{props.node.value.op}</span>
98-
<strong className="TraceEmDash"></strong>
99-
</React.Fragment>
100-
)}
85+
<React.Fragment>
86+
{props.node.value.op && props.node.value.op !== 'default' && (
87+
<React.Fragment>
88+
<span className="TraceOperation">{props.node.value.op}</span>
89+
<strong className="TraceEmDash"></strong>
90+
</React.Fragment>
91+
)}
92+
{shouldUseOTelFriendlyUI &&
93+
isEAPSpanNode(props.node) &&
94+
props.node.value.name ? (
95+
<React.Fragment>
96+
<span className="TraceName" title={props.node.value.name}>
97+
{ellipsize(props.node.value.name, 100)}
98+
</span>
99+
</React.Fragment>
100+
) : (
101101
<span className="TraceDescription" title={props.node.value.description}>
102102
{getNodeDescriptionPrefix(props.node)}
103103
{props.node.value.description
104104
? ellipsize(props.node.value.description, 100)
105105
: (spanId ?? 'unknown')}
106106
</span>
107-
</React.Fragment>
108-
)}
107+
)}
108+
</React.Fragment>
109109
</div>
110110
</div>
111111
<div

0 commit comments

Comments
 (0)