-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The goal of UI transactions is to capture transactions based on user interactions. Currently, the offer of auto-generated transactions on mobile is limited, with only creating transactions when an app loads a screen. To provide more value, we want to extend the auto-generated transactions by generating transactions on UI events.
Internal Notion page. https://getsentry.atlassian.net/browse/MOBILE-239
- feat: UI events transactions sentry-java#1975
- feat: UI event transactions for clicks sentry-cocoa#1784
- UI Event transactions for clicks GA sentry-cocoa#1843
- Document
UI Event Transactiondevelop#647
The default idle timeout is 3 seconds.
Scenarios
Scenarios are written in the Gherkin syntax.
Scenario: Discard UI event transactions without child spans
Given an auto-generated UI event transaction
And the transaction has no child spans
When the idleTimeout times out
Then the SDK discards the transaction
An empty transaction of a UI event doesn’t add any value.
Scenario: Set time to last finished child span
Given an auto-generated UI event transaction
And the transaction has one finished child span
When the idleTimeout times out
Then the SDK finishes the transaction
And trims the end time of the transaction to the one of the latest finished child span
Scenario: Don't reset timeout when the second last span finishes
Given an auto-generated UI event transaction
And the transaction has two child spans
When the SDK finishes the first child span
Then the SDK doesn't reset the idle timeout
Scenario: Reset timeout when the last span finishes
Given an auto-generated UI event transaction
And the transaction has two child spans
When the SDK finishes the second child span
Then the SDK resets the idle timeout
Scenario: Cancel timeout when starting a span
Given an auto-generated UI event transaction
When the SDK starts a child span
Then the SDK cancels the idle timeout
And waits for the child to finish
Scenario: Ongoing screen load transaction
Given an ongoing screen load transaction
When the SDK starts a new UI event transaction
Then the SDK doesn’t bind the new transaction to the scope
Scenario: Ongoing UI event transaction
Given an ongoing UI event transaction
When the SDK creates a new screen load transaction
Then the SDK finishes the previous transactions
And removes it from the scope
And sets the status to canceled
And waits for its children to finish
Scenario: Manually created transaction on the scope
Given an ongoing manually transaction bound to the scope by the user
When the SDK creates a new auto-generated transaction
Then the SDK doesn’t add the new auto-generated transaction to the scope
Scenario: Same UI element with same event
Given an ongoing UI event transaction
When the user triggers the same UI event with the same type
Then the SDK resets the timeout
And doesn’t create a new transaction
Scenario: Same UI element with different event
Given an ongoing UI event transaction
When the user triggers the same UI element with a different event
Or the user triggers the different UI element
Then the SDK finishes the ongoing transaction
And sets the status to OK
And waits for the children to finish
And cancels the timeout (Actually, it shouldn't make a difference if you cancel it or not, as the SDK will add new spans to the new transaction)
And removes the ongoing transaction from the scope
And starts a new transaction
And puts the new transaction on the scope
Scenario: UI event triggered but transaction ended
Given an auto-generated transaction from a any event
And the transaction finished
When the user triggers the same event
Then the SDK starts a new transaction
Scenario: Transaction name
When the user clicks a button
Then the SDK starts a transaction
And the transaction name is the [[screen.name](http://screen.name/)](http://screen.name) + [[view.id](http://view.id/)](http://view.id) or the accessibility identifier of the view (e.g. `LoginActivity.login_button`)
Scenario: Transaction name [view.id](http://view.id) or accessibility identifier not specified
When the user clicks a button
And the button has no [[view.id](http://view.id/)](http://view.id) or accessibility identifier
Then the SDK doesn’t start a transaction
And prints a warning to the console