sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Do not set TraceContext.origin for exceptions when no active transaction available

Open romtsn opened this issue 1 year ago • 3 comments

Description

https://sentry-sdks.sentry.io/issues/4567235831/?project=5428559&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=7d&stream_index=0

image

After TwP we set the trace origin to manual by default, but probably we shouldn't just set it for errors if there's no active transactions, otherwise it looks a bit weird

romtsn avatar Jan 16 '24 12:01 romtsn

https://sentry-sdks.sentry.io/issues/2862440042/?project=5428557&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=14d&stream_index=4

That's how it should look when there's only error events in a trace (no origin field set at all).

If there's an active transaction on the scope, then we should use its origin value for the error events in the same trace.

romtsn avatar Jan 17 '24 14:01 romtsn

@adinauer do you know if we should show this field at all when there are no active transactions in a trace?

romtsn avatar Jan 17 '24 14:01 romtsn

@romtsn have you checked how the trace context is set on the event in your case? Is it just the default here?

Are you sure this was introduced with TwP changes and not before when we added the transaction name source?

My guess is, we can remove the default. We just need to retest manual transactions then.

Other SDKs might behave the same: https://github.com/getsentry/sentry-javascript/blob/5f0b50624df7b21e95d6c825fb75ca544163d3de/packages/core/src/tracing/span.ts#L137

adinauer avatar Jan 22 '24 06:01 adinauer