Skip to content

Commit 365637f

Browse files
Merge pull request #2954 from DataDog/aleksandr-gringauz/RUM-11785/do-not-create-new-session
RUM-11785: Do not create a new session for TTID
2 parents ad12432 + fc9e589 commit 365637f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScope.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,13 @@ internal class RumSessionScope(
218218
val isBackgroundEvent = event.javaClass in RumViewManagerScope.validBackgroundEventTypes
219219
val isSdkInitInForeground = event is RumRawEvent.SdkInit && event.isAppInForeground
220220
val isSdkInitInBackground = event is RumRawEvent.SdkInit && !event.isAppInForeground
221-
val isAppStartEvent = event is RumRawEvent.AppStartTTIDEvent
222221

223222
// When the session is expired, time-out or stopSession API is called, session ended metric should be sent
224223
if (isExpired || isTimedOut || isActive.not()) {
225224
sessionEndedMetricDispatcher.endMetric(sessionId, sdkCore.time.serverTimeOffsetMs)
226225
}
227226

228-
if (isInteraction || isSdkInitInForeground || isAppStartEvent) {
227+
if (isInteraction || isSdkInitInForeground) {
229228
if (isNewSession || isExpired || isTimedOut) {
230229
val reason = if (isNewSession) {
231230
StartReason.USER_APP_LAUNCH

features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScopeTest.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ internal class RumSessionScopeTest {
14241424

14251425
@ParameterizedTest
14261426
@MethodSource("testScenarios")
1427-
fun `M call reportTTID and create new session W handleEvent { AppLaunchTTIDEvent }`(
1427+
fun `M call reportTTID W handleEvent { AppLaunchTTIDEvent }`(
14281428
scenario: RumStartupScenario,
14291429
forge: Forge
14301430
) {
@@ -1438,6 +1438,13 @@ internal class RumSessionScopeTest {
14381438
info = info
14391439
)
14401440

1441+
testedScope.handleEvent(
1442+
event = fakeInitialViewEvent,
1443+
datadogContext = fakeDatadogContext,
1444+
writeScope = mockEventWriteScope,
1445+
writer = mockWriter
1446+
)
1447+
14411448
// When
14421449
val result = testedScope.handleEvent(
14431450
event = event,
@@ -1484,6 +1491,13 @@ internal class RumSessionScopeTest {
14841491
info = info2
14851492
)
14861493

1494+
testedScope.handleEvent(
1495+
event = fakeInitialViewEvent,
1496+
datadogContext = fakeDatadogContext,
1497+
writeScope = mockEventWriteScope,
1498+
writer = mockWriter
1499+
)
1500+
14871501
// When
14881502
testedScope.handleEvent(
14891503
event = event1,

0 commit comments

Comments
 (0)