Skip to content

Commit e0a0f36

Browse files
stefanosianolucas-zimerman
authored andcommitted
Add deadlineTimeout Android option (#14396)
1 parent b944204 commit e0a0f36

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

docs/platforms/android/configuration/options.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@ This only affects [user interaction transactions](/platforms/android/tracing/ins
175175

176176
</ConfigKey>
177177

178+
<ConfigKey name="deadline-timeout">
179+
180+
The deadline time, measured in ms, to wait until a transaction will be automatically forcefully finished, even if a child span is currently running.
181+
182+
The default is `30000`.
183+
184+
_(New in version 8.18.0)_
185+
186+
<Alert>
187+
188+
This only affects [automatic transactions](/platforms/android/tracing/instrumentation/automatic-instrumentation/).
189+
190+
</Alert>
191+
192+
</ConfigKey>
193+
178194
<ConfigKey name="enabled">
179195

180196
Specifies whether this SDK should send events to Sentry. Defaults to `true`. Setting this to `enabled: false` doesn't prevent all overhead from Sentry instrumentation. To disable Sentry completely, depending on environment, call `SentryAndroid.init` conditionally.

docs/platforms/android/tracing/instrumentation/automatic-instrumentation.mdx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,38 @@ plugins {
338338

339339
#### Transaction Lifetime
340340

341-
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). You can also disable the idle timeout by setting it to `null`, but the transaction must be finished manually in this case.
341+
The transaction finishes automatically after it reaches the specified [idleTimeout](/platforms/android/configuration/options/#idle-timeout) and all of its child spans are finished, or after it reaches the specified [deadlineTimeout](/platforms/android/configuration/options/#deadline-timeout), even if child spans are still running.
342+
343+
The `idleTimeout` defaults to `3000` milliseconds (three seconds), and the `deadlineTimeout` defaults to `30000` milliseconds (thirty seconds). You can also disable the idle timeout and deadline timeout by setting them to `null`, but the transaction must be finished manually in this case.
344+
345+
To change the timeouts you can:
346+
347+
```xml {filename:AndroidManifest.xml}
348+
<application>
349+
<meta-data android:name="io.sentry.traces.idle-timeout" android:value="10000" />
350+
<meta-data android:name="io.sentry.traces.deadline-timeout" android:value="0" /> <!-- 0 disable deadline timeout -->
351+
</application>
352+
```
353+
```java
354+
import io.sentry.android.core.SentryAndroid;
355+
356+
SentryAndroid.init(this, options -> {
357+
options.setIdleTimeout(null); // disable idle timeout
358+
options.setDeadlineTimeout(0); // disable deadline timeout
359+
});
360+
```
361+
```kotlin
362+
import io.sentry.android.core.SentryAndroid
363+
364+
SentryAndroid.init(this) { options ->
365+
options.idleTimeout = null // disable idle timeout
366+
options.deadlineTimeout = 0 // disable deadline timeout
367+
}
368+
```
342369

343370
<Alert>
344371

345-
If the UI transaction has idled, but didn't have any child spans added, it will be dropped.
372+
If the UI transaction didn't have any child spans added, it will be dropped.
346373

347374
</Alert>
348375

0 commit comments

Comments
 (0)