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

Support transaction finishing automatically with 'idle timeout'

Open bruno-garcia opened this issue 4 years ago • 1 comments

The idea is to have transactions that do not have a specified ending but a timeout instead. As if we had a mode for finishing transactions automatically once no new spans are added to it for N milliseconds, or a general timeout.

This would also be used by Unity, for example, when a scene loads. Potentially other UI frameworks like MAUI, WinForms, Uno, Avalonia and WPF. In all cases, user interaction can be a trigger. Without a specified end time, it runs until 'enough' has been tracked.

We need to define the spec in the develop.sentry.dev docs and align with other implementations of it. This is an approach used by the JS on the browser (and React Native). Similar behavior exists in different SDKs such as JavaScript and Android.

In terms of Span operation names, some have been defined already. For example, under Mobile here we see: ui.action.click which often rely on this behavior of completing based on a sliding expiration instead of a 'finish' call into the SDK.

Solution Brainstorm

This could be achieved by extending TransactionTracer with an optional parameter for the timeout. This should work independently of wait for children and simply trigger a finish after a set time period.

Other SDKs implementation of this:

  • Cocoa: https://github.com/getsentry/sentry-cocoa/blob/d2076a999d23fff77ff5736d6ae7c6734e49b8e0/Sources/Sentry/SentryTracer.m#L97
  • Dart: https://github.com/getsentry/sentry-dart/blob/a5e904f5a26ffdfc8b6065a68c6152ea936b0644/dart/lib/src/sentry_tracer.dart#L43
  • Java: https://github.com/getsentry/sentry-java/blob/fa3886ffaae668ef2e5d57783df89bfd8bb0c6bb/sentry/src/main/java/io/sentry/SentryTracer.java#L100

bruno-garcia avatar Jun 22 '21 20:06 bruno-garcia

I'll need this for MAUI also, to add automatic instrumentation for performance tracing.

mattjohnsonpint avatar Jul 13 '22 22:07 mattjohnsonpint

spec/SDK docs for this: https://develop.sentry.dev/sdk/performance/ui-event-transactions/

bruno-garcia avatar Jun 28 '23 21:06 bruno-garcia