Add autoTransactionDeadlineTimeoutMillis option#4555
Conversation
Co-authored-by: stefano.siano <stefano.siano@sentry.io>
Co-authored-by: stefano.siano <stefano.siano@sentry.io>
small cleanup updated changelog
Performance metrics 🚀
|
|
@sentry review |
PR DescriptionThis pull request introduces a new configuration option, Click to see moreKey Technical Changes
Architecture DecisionsThe decision was made to add a new option to Dependencies and InteractionsThis change primarily affects the transaction creation process within the Android SDK. It interacts with Risk ConsiderationsA potential risk is that setting a very long or infinite deadline timeout (by setting the option to 0 or a negative value) could lead to transactions remaining open indefinitely, potentially impacting performance and resource usage. Users should be aware of this when configuring the option. Another consideration is ensuring that the new option is properly documented and communicated to users to avoid confusion. Notable Implementation DetailsThe implementation handles zero and negative values for |
|
|
||
| // Set deadline timeout based on configured option | ||
| val deadlineTimeoutMillis = scopes.options.autoTransactionDeadlineTimeoutMillis | ||
| // No deadline when zero or negative value is set | ||
| it.deadlineTimeout = if (deadlineTimeoutMillis <= 0) null else deadlineTimeoutMillis |
There was a problem hiding this comment.
The Kotlin implementation follows the same pattern as the Java implementations, which is good for consistency. However, consider extracting the deadline timeout logic into a utility method to reduce code duplication across ActivityLifecycleIntegration, SentryGestureListener, and SentryNavigationListener.
| // Set deadline timeout based on configured option | |
| val deadlineTimeoutMillis = scopes.options.autoTransactionDeadlineTimeoutMillis | |
| // No deadline when zero or negative value is set | |
| it.deadlineTimeout = if (deadlineTimeoutMillis <= 0) null else deadlineTimeoutMillis | |
| // Consider creating a utility method like: | |
| // private fun getDeadlineTimeoutFromOptions(options: SentryOptions): Long? { | |
| // val deadlineTimeoutMillis = options.autoTransactionDeadlineTimeoutMillis | |
| // return if (deadlineTimeoutMillis <= 0) null else deadlineTimeoutMillis | |
| // } |
Did we get this right? 👍 / 👎 to inform future reviews.
📜 Description
Adds
autoTransactionDeadlineTimeoutMillistoSentryOptionsto control the deadline for automatic transactions (Activity, Gesture, Navigation).It defaults to 30 seconds, and a value
<= 0disables the deadline entirely.💡 Motivation and Context
Fixes #4251
💚 How did you test it?
Unit tests
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps