Skip to content

Commit c20d162

Browse files
Add iOS experimental EnableAppHangTrackingV2 binding (#3877)
* Add experimental EnableAppHangTrackingV2 configuration flag to the dotnet SDK * Update CHANGELOG.md * reformatted BindableSentryOptions * Apply suggestions from code review --------- Co-authored-by: Bruno Garcia <[email protected]>
1 parent c2c737b commit c20d162

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 5.0.1
44

5+
### Features
6+
7+
- .NET on iOS: Add experimental EnableAppHangTrackingV2 configuration flag to the options binding SDK ([#3877](https://github.com/getsentry/sentry-dotnet/pull/3877))
8+
59
### Fixes
610

711
- .NET Mobile: Disable and made obsolete the iOS Watchdog termination feature which is based on heuristics that don't work in .NET ([#3867](https://github.com/getsentry/sentry-dotnet/pull/3867))

src/Sentry/Platforms/Cocoa/BindableSentryOptions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class NativeOptions
1414
public TimeSpan? AppHangTimeoutInterval { get; set; }
1515
public TimeSpan? IdleTimeout { get; set; }
1616
public bool? EnableAppHangTracking { get; set; }
17+
public bool? EnableAppHangTrackingV2 { get; set; }
1718
public bool? EnableAutoBreadcrumbTracking { get; set; }
1819
public bool? EnableAutoPerformanceTracing { get; set; }
1920
public bool? EnableCoreDataTracing { get; set; }
@@ -32,6 +33,7 @@ public void ApplyTo(SentryOptions.NativeOptions options)
3233
options.AppHangTimeoutInterval = AppHangTimeoutInterval ?? options.AppHangTimeoutInterval;
3334
options.IdleTimeout = IdleTimeout ?? options.IdleTimeout;
3435
options.EnableAppHangTracking = EnableAppHangTracking ?? options.EnableAppHangTracking;
36+
options.EnableAppHangTrackingV2 = EnableAppHangTrackingV2 ?? options.EnableAppHangTrackingV2;
3537
options.EnableAutoBreadcrumbTracking = EnableAutoBreadcrumbTracking ?? options.EnableAutoBreadcrumbTracking;
3638
options.EnableAutoPerformanceTracing = EnableAutoPerformanceTracing ?? options.EnableAutoPerformanceTracing;
3739
options.EnableCoreDataTracing = EnableCoreDataTracing ?? options.EnableCoreDataTracing;

src/Sentry/Platforms/Cocoa/SentryOptions.cs

+17
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,23 @@ internal NativeOptions(SentryOptions options)
6868
/// </remarks>
6969
public bool EnableAppHangTracking { get; set; } = true;
7070

71+
/// <summary>
72+
/// IMPORTANT: This feature is experimental and may have bugs.
73+
/// <br/>
74+
/// As of version 8.39.0-beta.1 of the sentry-cocoa SDK, you can enable AppHangsV2, which is available on iOS and tvOS.
75+
/// The main difference is that AppHangsV2 differentiates between fully-blocking and non-fully-blocking
76+
/// app hangs, which you might choose to ignore. A fully-blocking app hang is when the main thread is stuck
77+
/// completely, and the app can't render a single frame.
78+
/// A non-fully-blocking app hang is when the app appears stuck to the user, but can still render a few frames.
79+
/// Fully-blocking app hangs are more actionable because the stacktrace shows the exact blocking location on
80+
/// the main thread. Non-fully-blocking app hangs can have a stacktrace that doesn't highlight the exact
81+
/// blocking location, since the main thread isn't completely blocked.
82+
/// </summary>
83+
/// <remarks>
84+
/// See https://docs.sentry.io/platforms/apple/configuration/app-hangs/#app-hangs-v2
85+
/// </remarks>
86+
public bool EnableAppHangTrackingV2 { get; set; } = true;
87+
7188
/// <summary>
7289
/// When enabled, the SDK adds breadcrumbs for various system events.
7390
/// The default value is <c>true</c> (enabled).

src/Sentry/Platforms/Cocoa/SentrySdk.cs

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ private static void InitSentryCocoaSdk(SentryOptions options)
121121
nativeOptions.IdleTimeout = options.Native.IdleTimeout.TotalSeconds;
122122
nativeOptions.Dist = options.Distribution;
123123
nativeOptions.EnableAppHangTracking = options.Native.EnableAppHangTracking;
124+
nativeOptions.EnableAppHangTrackingV2 = options.Native.EnableAppHangTrackingV2;
124125
nativeOptions.EnableAutoBreadcrumbTracking = options.Native.EnableAutoBreadcrumbTracking;
125126
nativeOptions.EnableAutoPerformanceTracing = options.Native.EnableAutoPerformanceTracing;
126127
nativeOptions.EnableCoreDataTracing = options.Native.EnableCoreDataTracing;

0 commit comments

Comments
 (0)