You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx
+100-14
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,6 @@ If another transaction is already bound to the scope (if it's been set manually,
39
39
40
40
To disable the `UIViewController` Tracing:
41
41
42
-
43
42
```swift {tabTitle:Swift}
44
43
importSentry
45
44
@@ -67,7 +66,6 @@ SentrySDK.start { options in
67
66
68
67
You can deactivate tracing for specific UIViewControllers by configuring <PlatformLink to="/configuration/swizzling#skip-swizzling-for-specific-classes">`swizzleClassNameExcludes`</PlatformLink>:
This feature is available for iOS, tvOS, and Mac Catalyst.
@@ -141,7 +138,6 @@ You can filter for different app start types in [Discover](/product/explore/disc
141
138
142
139
To enable prewarmed app start tracing:
143
140
144
-
145
141
```swift {tabTitle:Swift}
146
142
import Sentry
147
143
@@ -178,7 +174,6 @@ Network Tracking is enabled by default once you <PlatformLink to="/tracing/">set
178
174
179
175
To disable the HTTP instrumentation:
180
176
181
-
182
177
```swift {tabTitle:Swift}
183
178
import Sentry
184
179
@@ -207,7 +202,6 @@ Sentry adds an extra header with the trace id in the outgoing HTTP requests to c
207
202
You can set the `tracePropagationTarget` option to filter which requests Sentry adds the extra header to.
208
203
For example, to ensure that only your app backend will receive the trace id.
209
204
210
-
211
205
```swift {tabTitle:Swift}
212
206
import Sentry
213
207
@@ -234,8 +228,7 @@ If `tracePropagationTargets` is not provided, trace data is attached to every ou
234
228
235
229
The Sentry SDK adds spans for file I/O operations to ongoing transactions bound to the scope. Currently, the SDK supports operations with [NSData][NSData], but many other APIs like [NSFileManager][NSFileManager], [NSString][NSString] and [NSBundle][NSBundle] uses [NSData][NSData].
236
230
237
-
Since 8.0.0, this feature has been enabled by default. To disable it:
238
-
231
+
Since 8.0.0, this feature has been enabled by default to trace `NSData` operations. To disable it:
239
232
240
233
```swift {tabTitle:Swift}
241
234
import Sentry
@@ -261,17 +254,114 @@ SentrySDK.start { options in
261
254
}];
262
255
```
263
256
257
+
Starting with iOS 18, macOS 15, and tvOS 18, the `NSFileManager` is no longer backed by `NSData` and needs to be swizzled directly.
258
+
This feature is currently experimental and disabled by default.
259
+
To use automatic file I/O tracing for `NSFileManager` you need to enable it:
Starting with iOS 18, tvOS 18, and macOS 15 the Swift classes `Data` and `FileManager` are no longer backed by their Objective-C counterparts `NSData` and `NSFileManager` and therefore cannot be instrumented automatically anymore. Instead, please use [Manual File I/O Tracing](#manual-fileio-tracing).
Starting with version 8.48.0, the Sentry SDK offers extensions for the types `Data` and `FileManager` to track reading and writing data, as well as creating, moving, copying, and deleting files.
291
+
292
+
The method signatures of the extension resemble the ones of the original types, but they add a span to the current transaction:
293
+
294
+
**Data Operations:**
295
+
296
+
- `Data.init(contentsOfUrlWithSentryTracing:)` for `Data(contentsOf:)`
297
+
- `data.writeWithSentryTracing(to:options:)` for `data.write(to:)`
298
+
299
+
```swift {tabTitle:Swift}
300
+
// Read data from a file URL
301
+
let data = Data(contentsOfUrlWithSentryTracing: url)
302
+
303
+
// Write data to a file URL
304
+
data.writeWithSentryTracing(to: url)
305
+
```
306
+
307
+
**FileManager Operations:**
308
+
309
+
-`FileManager.createFileWithSentryTracing(atPath:contents:attributes:)` for `FileManager.createFile(atPath:contents:attributes:)`
310
+
-`FileManager.moveItemWithSentryTracing(at:to:)` for `FileManager.moveItem(at:to:)`
311
+
-`FileManager.moveItemWithSentryTracing(atPath:toPath:)` for `FileManager.moveItem(atPath:toPath:)`
312
+
-`FileManager.copyItemWithSentryTracing(at:to:)` for `FileManager.copyItem(at:to:)`
313
+
-`FileManager.copyItemWithSentryTracing(atPath:toPath:)` for `FileManager.copyItem(atPath:toPath:)`
314
+
-`FileManager.removeItemWithSentryTracing(at:)` for `FileManager.removeItem(at:)`
315
+
-`FileManager.removeItemWithSentryTracing(atPath:)` for `FileManager.removeItem(atPath:)`
We recommend you disable the swizzling of `NSData` and `NSFileManager` when using manual file I/O tracing, as the internal behavior of these classes differs between platform versions and can cause duplicate spans in your traces.
The Sentry SDK adds spans for Core Data operations to ongoing transactions bound to the scope. Currently, the SDK supports fetch and save operations with [NSManagedObjectContext](https://developer.apple.com/documentation/coredata/nsmanagedobjectcontext).
272
363
Since 8.0.0, this feature has been enabled by default. To disable it:
273
364
274
-
275
365
```swift {tabTitle:Swift}
276
366
import Sentry
277
367
@@ -300,7 +390,6 @@ SentrySDK.start { options in
300
390
301
391
User interaction tracing, once enabled, captures transactions for clicks. This feature is unavailable for SwiftUI. Since 8.0.0, this feature has been enabled by default. To disable it:
302
392
303
-
304
393
```swift {tabTitle:Swift}
305
394
import Sentry
306
395
@@ -381,10 +470,8 @@ By adding a span for a view controller when it's loaded, time to full display (T
381
470
382
471
Since Cocoa SDK version 8.33.0, the SDK doesn't create [time to initial display (TTID)](#time-to-initial-display) and time to full display (TTFD) spans for UIViewControllers presented in the background, because the logic requires UI frames to be drawn.
383
472
384
-
385
473
_Time to full display is disabled by default, but you can enable it by setting:_
386
474
387
-
388
475
```swift {tabTitle:Swift}
389
476
importSentry
390
477
@@ -427,15 +514,14 @@ _(New in version 8.18.0), stable since 8.42.0._
427
514
428
515
We're working to update our **Performance** product offering in order to be able to provide better insights and highlight specific actions you can take to improve your mobile app's overall performance. The `performanceV2` option changes the following behavior:
429
516
430
-
* The app start duration will now finish when the first frame is drawn instead of when the OS posts the `UIWindowDidBecomeVisibleNotification`.
517
+
- The app start duration will now finish when the first frame is drawn instead of when the OS posts the `UIWindowDidBecomeVisibleNotification`.
431
518
432
519
This change will be the default in the next major version.
433
520
434
521
## Opt Out
435
522
436
523
You can opt out of all automatic instrumentations using the options:
0 commit comments