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

Include unfinished spans in transactions

Open bruno-garcia opened this issue 3 years ago • 3 comments

When a transaction is finished, the SDK tries to send the data to Sentry.

If an open Span (one that was not finished) exist in that transaction, the SDK removes that span before sending the data to Sentry.

That was done because Sentry will discard the transaction if unfinished spans are included. More context on this thread: https://github.com/getsentry/develop/issues/274

An alternative solution used by the JavaScript SDK is to complete those spans with the timestamp of the finishing transaction and setting the status to deadline_exceeded . We should align with this approach as it shows something was going on even though it wasn't completed during the transaction.

Java: https://github.com/getsentry/sentry-java/issues/1690 Cocoa: https://github.com/getsentry/sentry-cocoa/issues/1303

bruno-garcia avatar Aug 31 '21 19:08 bruno-garcia

blocked by https://getsentry.atlassian.net/browse/INGEST-1109 (internal)

SimonCropp avatar Apr 26 '22 21:04 SimonCropp

Created related issue on Relay: https://github.com/getsentry/relay/issues/1244 Blocked by this ^

bruno-garcia avatar Apr 27 '22 01:04 bruno-garcia

Worth noting once we start adding unfinished Spans we'll need to notify the minimum Self Hosted version required since the old version of Relay dropped transactions completely if they had an unfinished span (reason why all SDKs compensated that with dropping or lying about a span being finished)

bruno-garcia avatar Apr 27 '22 01:04 bruno-garcia

@jamescrosswell @bitsandfoxes this is unblocked now and since we're on a major we should definitely include this one.

Android/Java SDKs added on 7.0.0 and it's the reason they mention new Self hosted min version 22.12: From their README:

Since version 7.0.0 of this SDK, Sentry version >= 22.12.0 is required to properly ingest transactions with unfinished spans.

Related PRs:

  • https://github.com/getsentry/relay/pull/1690
  • https://github.com/getsentry/sentry-dart/pull/1577
  • https://github.com/getsentry/sentry-cocoa/pull/1592
  • https://github.com/getsentry/sentry-java/pull/2859

bruno-garcia avatar Dec 14 '23 00:12 bruno-garcia

From what I can tell, this was implemented about 3 years ago in https://github.com/getsentry/sentry-dotnet/pull/1296 so there's nothing to do here:

https://github.com/getsentry/sentry-dotnet/blob/175623c91c7c7a660ed3a5bafb6d4bd31ba86cb7/src/Sentry/TransactionTracer.cs#L373-L380

jamescrosswell avatar Jan 05 '24 01:01 jamescrosswell

From what I can tell, this was implemented about 3 years ago in #1296 so there's nothing to do here:

https://github.com/getsentry/sentry-dotnet/blob/175623c91c7c7a660ed3a5bafb6d4bd31ba86cb7/src/Sentry/TransactionTracer.cs#L373-L380

The goal is to delete that code. We don't need to "fake" finish stuff since Relay will deal with that. 4.0 is a good time to change this (since it'll break transactions on self hosted Sentry older then 22.12.0

bruno-garcia avatar Jan 05 '24 20:01 bruno-garcia