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
feat(apple): User interaction instrumentation (#5098)
Add docs similar to user interaction instrumentation on Android.
As the implementations don't match exactly we can't create reusable docs.
Co-authored-by: Isabel <[email protected]>
Co-authored-by: Roman Zavarnitsyn <[email protected]>
Copy file name to clipboardExpand all lines: src/platforms/apple/common/performance/instrumentation/automatic-instrumentation.mdx
+61Lines changed: 61 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -164,6 +164,67 @@ SentrySDK.start { options in
164
164
}];
165
165
```
166
166
167
+
## User Interaction Instrumentation
168
+
169
+
<Alert level="info" title="Important">
170
+
171
+
This is an experimental feature and requires an opt-in. Experimental features are still a work-in-progress and may have bugs. We recognize the irony.
172
+
173
+
</Alert>
174
+
175
+
The UI instrumentation, once enabled, captures transactions for clicks. The UI instrumentation is disabled by default, but you can enable it by setting:
The SDK composes the transaction name out of the host `UIViewController` and the method that the `UIView` is calling; for example, `YourApp_LoginUIViewController.loginButton`. The transaction operation is set to `ui.action` plus the interaction type `click`. The transaction finishes automatically after it reaches the specified [idleTimeout](/platforms/android/configuration/options/#idle-timeout) and all of its child spans are finished. The `idleTimeoout` defaults to `3000` milliseconds (three seconds).
195
+
196
+
<Note>
197
+
198
+
If the UI transaction has idled, but didn't have any child spans added, it will be dropped.
199
+
200
+
</Note>
201
+
202
+
The SDK binds user interaction transactions to the `Scope` automatically if there's no other transaction set. Because of that, you can create spans using manual instrumentation, and those spans will be automatically associated with the running UI transaction.
203
+
204
+
```Swift
205
+
import Sentry
206
+
207
+
func loadUserDataOnClick() {
208
+
let span = SentrySDK.span
209
+
let innerSpan = span?.startChild(operation: "loadUserData")
When the user interaction transaction is not finished yet, but the user makes a new interaction, or the SDK starts a new UIViewController transaction, the SDK automatically finishes the previous user interaction transaction. This is because only one transaction can be bound to the scope at a time. However, if the same view has been interacted with (for example, a `UIButton` was clicked again within the `idleTimeout` window), the idle timer will be reset and the transaction duration will be extended with the `idleTimeout` value.
227
+
167
228
## Opt Out
168
229
169
230
You can opt out of UIViewController, App Start, Slow and Frozen Frames, and HTTP Instrumentation using options:
0 commit comments