-
-
Notifications
You must be signed in to change notification settings - Fork 203
/
SentryOptions.cs
218 lines (192 loc) · 9.81 KB
/
SentryOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
using ObjCRuntime;
// ReSharper disable once CheckNamespace
namespace Sentry;
public partial class SentryOptions
{
/// <summary>
/// Exposes additional options for the iOS platform.
/// </summary>
// ReSharper disable once InconsistentNaming
public IosOptions iOS { get; }
/// <summary>
/// Provides additional options for the iOS platform.
/// </summary>
public class IosOptions
{
private readonly SentryOptions _options;
internal IosOptions(SentryOptions options)
{
_options = options;
}
// ---------- From Cocoa's SentryOptions.h ----------
/// <summary>
/// Automatically attaches a screenshot when capturing an error or exception.
/// The default value is <c>false</c> (disabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/guides/ios/configuration/options/#attach-screenshot
/// </remarks>
public bool AttachScreenshot { get; set; } = false;
/// <summary>
/// The minimum amount of time an app should be unresponsive to be classified as an App Hanging.
/// The actual amount may be a little longer. Avoid using values lower than 100ms, which may cause a lot
/// of app hangs events being transmitted.
/// The default value is 2 seconds.
/// Requires setting <see cref="EnableAppHangTracking"/> to <c>true</c>.
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/configuration/app-hangs/
/// </remarks>
public TimeSpan AppHangTimeoutInterval { get; set; } = TimeSpan.FromSeconds(2);
/// <summary>
/// How long an idle transaction waits for new children after all its child spans finished.
/// Only UI event transactions are idle transactions.
/// The default value is 3 seconds.
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#user-interaction-instrumentation
/// </remarks>
public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(3);
/// <summary>
/// When enabled, the SDK tracks when the application stops responding for a specific amount of
/// time defined by the <see cref="AppHangTimeoutInterval"/> option.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/configuration/app-hangs/
/// </remarks>
public bool EnableAppHangTracking { get; set; } = true;
/// <summary>
/// When enabled, the SDK adds breadcrumbs for various system events.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/enriching-events/breadcrumbs/#automatic-breadcrumbs
/// </remarks>
public bool EnableAutoBreadcrumbTracking { get; set; } = true;
/// <summary>
/// When enabled, the SDK tracks performance for <see cref="UIViewController"/> subclasses and HTTP requests
/// automatically. It also measures the app start and slow and frozen frames.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// Performance Monitoring must be enabled for this option to take effect.
/// See: https://docs.sentry.io/platforms/apple/performance/
/// And: https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#opt-out
/// </remarks>
public bool EnableAutoPerformanceTracing { get; set; } = true;
/// <summary>
/// When enabled, the SDK tracks the performance of Core Data operations.
/// It requires enabling performance monitoring.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// Performance Monitoring must be enabled for this option to take effect.
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#core-data-instrumentation
/// </remarks>
public bool EnableCoreDataTracing { get; set; } = true;
/// <summary>
/// When enabled, the SDK tracks performance for file IO reads and writes with <see cref="NSData"/>
/// if auto performance tracking and <see cref="EnableSwizzling"/> are enabled.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#file-io-instrumentation
/// </remarks>
public bool EnableFileIOTracing { get; set; } = true;
/// <summary>
/// When enabled, the SDK adds breadcrumbs for each network request
/// if auto performance tracking and <see cref="EnableSwizzling"/> are enabled.
/// The default value is <c>true</c> (enabled).
/// </summary>
public bool EnableNetworkBreadcrumbs { get; set; } = true;
/// <summary>
/// When enabled, the SDK adds breadcrumbs for HTTP requests and tracks performance for HTTP requests
/// if auto performance tracking and <see cref="EnableSwizzling"/> are enabled.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#http-instrumentation
/// </remarks>
public bool EnableNetworkTracking { get; set; } = true;
/// <summary>
/// Whether to enable watchdog termination tracking or not.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// https://docs.sentry.io/platforms/apple/configuration/watchdog-terminations/
/// </remarks>
public bool EnableWatchdogTerminationTracking { get; set; } = true;
/// <summary>
/// Whether the SDK should use swizzling or not.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// When turned off the following features are disabled: breadcrumbs for touch events and
/// navigation with <see cref="UIViewController"/>, automatic instrumentation for <see cref="UIViewController"/>,
/// automatic instrumentation for HTTP requests, automatic instrumentation for file IO with <see cref="NSData"/>,
/// and automatically added sentry-trace header to HTTP requests for distributed tracing.
/// See https://docs.sentry.io/platforms/apple/configuration/swizzling/
/// </remarks>
public bool EnableSwizzling { get; set; } = true;
/// <summary>
/// When enabled, the SDK tracks performance for <see cref="UIViewController"/> subclasses.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#uiviewcontroller-instrumentation
/// </remarks>
public bool EnableUIViewControllerTracing { get; set; } = true;
/// <summary>
/// When enabled, the SDK creates transactions for UI events like buttons clicks, switch toggles,
/// and other UI elements that uses <see cref="UIControl.SendAction(Selector, NSObject?, UIEvent?)"/>.
/// The default value is <c>false</c> (disabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#user-interaction-instrumentation
/// </remarks>
public bool EnableUserInteractionTracing { get; set; } = false;
/// <summary>
/// When provided, this will be set as delegate on the <see cref="NSUrlSession"/> used for network
/// data-transfer tasks performed by the native Sentry Cocoa SDK.
/// </summary>
/// <remarks>
/// See https://github.com/getsentry/sentry-cocoa/issues/1168
/// </remarks>
public NSUrlSessionDelegate? UrlSessionDelegate { get; set; } = null;
// ---------- Other ----------
/// <summary>
/// Gets or sets a value that indicates if tracing features are enabled on the embedded Cocoa SDK.
/// The default value is <c>false</c> (disabled).
/// </summary>
public bool EnableCocoaSdkTracing { get; set; } = false;
internal List<string>? InAppExcludes { get; private set; }
internal List<string>? InAppIncludes { get; private set; }
/// <summary>
/// Add prefix to exclude from 'InApp' stacktrace list by the Cocoa SDK.
/// Note that this uses iOS module names, not .NET namespaces.
/// </summary>
/// <param name="prefix">The string used to filter the stacktrace to be excluded from InApp.</param>
/// <remarks>
/// https://docs.sentry.io/platforms/apple/configuration/options/#in-app-exclude
/// </remarks>
public void AddInAppExclude(string prefix)
{
InAppExcludes ??= new List<string>();
InAppExcludes.Add(prefix);
}
/// <summary>
/// Add prefix to include as in 'InApp' stacktrace by the Cocoa SDK.
/// Note that this uses iOS package names, not .NET namespaces.
/// </summary>
/// <param name="prefix">The string used to filter the stacktrace to be included in InApp.</param>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/configuration/options/#in-app-include
/// </remarks>
public void AddInAppInclude(string prefix)
{
InAppIncludes ??= new List<string>();
InAppIncludes.Add(prefix);
}
}
}