Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function useFindAdjacentTrace({
projectId,
environment,
currentTraceId,
currentSpanId,
adjacentTraceId,
adjacentTraceSpanId,
hasAdjacentTraceLink,
Expand All @@ -39,7 +38,6 @@ export function useFindAdjacentTrace({
let _projectId: number | undefined = undefined;
let _environment: string | undefined = undefined;
let _currentTraceId: string | undefined;
let _currentSpanId: string | undefined;
let _adjacentTraceAttribute: TraceItemResponseAttribute | undefined = undefined;

for (const a of attributes ?? []) {
Expand All @@ -49,8 +47,6 @@ export function useFindAdjacentTrace({
_environment = a.value;
} else if (a.name === 'trace' && a.type === 'str') {
_currentTraceId = a.value;
} else if (a.name === 'transaction.span_id' && a.type === 'str') {
_currentSpanId = a.value;
} else if (a.name === 'previous_trace' && a.type === 'str') {
_adjacentTraceAttribute = a;
}
Expand All @@ -74,7 +70,6 @@ export function useFindAdjacentTrace({
projectId: _projectId,
environment: _environment,
currentTraceId: _currentTraceId,
currentSpanId: _currentSpanId,
hasAdjacentTraceLink: _hasAdjacentTraceLink,
adjacentTraceSampled: _adjacentTraceSampledFlag === '1',
adjacentTraceId: _adjacentTraceId,
Expand All @@ -84,7 +79,12 @@ export function useFindAdjacentTrace({

const searchQuery =
direction === 'next'
? `sentry.previous_trace:${currentTraceId}-${currentSpanId}-1`
? // relaxed the next trace lookup to match spans containing only the
// traceId and not the spanId of the current trace root. We can't
// always be sure that the current trace root is indeed the span the
// next span would link towards, because sometimes the root might be a web
// vital span instead of the actual intial span from the SDK's perspective.
`sentry.previous_trace:${currentTraceId}-*-1`
: `id:${adjacentTraceSpanId} trace:${adjacentTraceId}`;

const enabled =
Expand Down
Loading