Skip to content

Commit 289a040

Browse files
authored
fix: Fix span details showing incorrect span start info (#689)
1 parent 0fcb37d commit 289a040

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/many-coats-return.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@spotlightjs/spotlight': patch
3+
'@spotlightjs/electron': patch
4+
'@spotlightjs/overlay': patch
5+
'@spotlightjs/astro': patch
6+
---
7+
8+
Fix span details showing incorrect span start time

packages/overlay/src/integrations/sentry/components/explore/traces/spans/SpanDetails.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export default function SpanDetails({
8686
totalDuration: number;
8787
}) {
8888
const [spanNodeWidth, setSpanNodeWidth] = useState<number>(50);
89+
const spanRelativeStart = span.start_timestamp - startTimestamp;
8990

9091
const spanDuration = span.timestamp - span.start_timestamp;
9192

@@ -115,15 +116,15 @@ export default function SpanDetails({
115116
<DateTime date={span.start_timestamp} />
116117
<span>&mdash;</span>
117118
<span>
118-
<strong>{getFormattedDuration(spanDuration)}</strong> into trace
119+
<strong>{getFormattedDuration(spanRelativeStart)}</strong> into trace
119120
</span>
120121
</div>
121122
<div className="flex-1">
122123
<div className="border-primary-800 relative h-8 border py-1">
123124
<div
124125
className="bg-primary-800 absolute bottom-0 top-0 -m-0.5 flex w-full items-center p-0.5"
125126
style={{
126-
left: `min(${(spanDuration / totalDuration) * 100}%, 100% - 1px)`,
127+
left: `min(${(spanRelativeStart / totalDuration) * 100}%, 100% - 1px)`,
127128
width: `max(1px, ${(spanDuration / totalDuration) * 100}%)`,
128129
}}
129130
>

0 commit comments

Comments
 (0)