-
-
Notifications
You must be signed in to change notification settings - Fork 371
Description
Description
Problem Statement
Currently, the iOS SDK uses a hardcoded 30-second deadline timeout (SENTRY_AUTO_TRANSACTION_DEADLINE) for auto-generated transactions. This prevents users from configuring the timeout duration for their specific use cases.
The Android SDK already has a configurable deadlineTimeout option (see Android docs), but iOS lacks this capability.
Solution
Add a new deadlineTimeout option to SentryOptions that:
- Defaults to 30 seconds (maintaining backward compatibility)
- Can be configured by users to match their transaction duration requirements
- Is passed through to
SentryTracerviaSentryTracerConfiguration - Replaces the hardcoded
SENTRY_AUTO_TRANSACTION_DEADLINEconstant
Implementation Requirements
1. Add Public Option to SentryOptions
File: Sources/Swift/Options.swift
Add a new property:
/// The maximum duration in seconds for auto-generated transactions before they are automatically finished
/// with a deadline_exceeded status. Only applies to auto-generated transactions (UI events, etc.).
/// @note The default is 30 seconds.
@objc public var deadlineTimeout: TimeInterval = 30.0File: Sources/Sentry/SentryOptionsInternal.m
Add parsing support for the option in the initWithDict:validOptions: method:
if ([options[@"deadlineTimeout"] isKindOfClass:[NSNumber class]]) {
sentryOptions.deadlineTimeout = [options[@"deadlineTimeout"] doubleValue];
}2. Pass Option to SentryTracer
File: Sources/Sentry/include/SentryTracerConfiguration.h
Add a new property:
/**
* The maximum duration in seconds for auto-generated transactions before they are automatically finished
* with a deadline_exceeded status.
*
* Default is 30 seconds.
*/
@property (nonatomic) NSTimeInterval deadlineTimeout;File: Sources/Sentry/SentryTracerConfiguration.m
Initialize the property in init:
self.deadlineTimeout = 30.0;File: Sources/Sentry/SentryTracer.m
- Replace the hardcoded
SENTRY_AUTO_TRANSACTION_DEADLINEconstant usage with_configuration.deadlineTimeout - Update
startDeadlineTimeoutmethod to use the configuration value instead of the constant
File: Sources/Sentry/SentryUIEventTrackerTransactionMode.m
Pass the deadlineTimeout from options to the tracer configuration when creating auto transactions.
3. Documentation
Repository: getsentry/sentry-docs
Add documentation for the new option in the iOS configuration options page:
- Location: Similar to how
idleTimeoutis documented - Include description, default value, and use cases
- Reference the Android equivalent for consistency
Testing Requirements
- Unit tests verifying the default value (30 seconds)
- Unit tests verifying custom values are respected
- Integration tests ensuring auto transactions respect the configured timeout
- Verify backward compatibility (existing behavior unchanged when not configured)
Related Code
Sources/Sentry/SentryTracer.m:50- Hardcoded constantSENTRY_AUTO_TRANSACTION_DEADLINESources/Sentry/SentryTracer.m:256-273-startDeadlineTimeoutmethodSources/Sentry/SentryTracer.m:155-157- Auto transaction deadline timeout initialization- Android equivalent: deadlineTimeout option
References
- Android deadlineTimeout docs
- iOS idleTimeout docs - Similar option for reference