From 48344ed4a27d5f417c4cb49276d81bf1d3db1074 Mon Sep 17 00:00:00 2001 From: "Xavier F. Gouchet" Date: Mon, 8 Jan 2024 13:46:41 +0100 Subject: [PATCH] RUM-2441 make synthetics logs more verbose --- .../rum/internal/domain/scope/RumApplicationScope.kt | 2 -- .../rum/internal/domain/scope/RumSessionScope.kt | 4 ---- .../android/rum/internal/domain/scope/RumViewScope.kt | 11 +++++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumApplicationScope.kt b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumApplicationScope.kt index 9d0e112094..daf4b76a32 100644 --- a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumApplicationScope.kt +++ b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumApplicationScope.kt @@ -7,7 +7,6 @@ package com.datadog.android.rum.internal.domain.scope import android.app.ActivityManager -import android.util.Log import androidx.annotation.WorkerThread import com.datadog.android.api.InternalLogger import com.datadog.android.api.feature.Feature @@ -78,7 +77,6 @@ internal class RumApplicationScope( syntheticsTestId = event.testId, syntheticsResultId = event.resultId ) - Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.application.id=${rumContext.applicationId}") } val isInteraction = (event is RumRawEvent.StartView) || (event is RumRawEvent.StartAction) diff --git a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScope.kt b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScope.kt index 7343f2fc72..3829468356 100644 --- a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScope.kt +++ b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumSessionScope.kt @@ -6,7 +6,6 @@ package com.datadog.android.rum.internal.domain.scope -import android.util.Log import androidx.annotation.WorkerThread import com.datadog.android.api.feature.Feature import com.datadog.android.api.storage.DataWriter @@ -201,9 +200,6 @@ internal class RumSessionScope( sessionId = UUID.randomUUID().toString() sessionStartNs.set(nanoTime) sessionListener?.onSessionStarted(sessionId, !keepSession) - if (getRumContext().syntheticsTestId != null) { - Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.session.id=$sessionId") - } } private fun updateSessionStateForSessionReplay(state: State, sessionId: String) { diff --git a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt index 8d0e8a80b2..95f277aeba 100644 --- a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt +++ b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumViewScope.kt @@ -70,10 +70,14 @@ internal open class RumViewScope( set(value) { oldViewIds += field field = value - if (getRumContext().syntheticsTestId != null) { + val rumContext = getRumContext() + if (rumContext.syntheticsTestId != null) { + Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.application.id=${rumContext.applicationId}") + Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.session.id=${rumContext.sessionId}") Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.view.id=$viewId") } } + private val oldViewIds = mutableSetOf() private val startedNanos: Long = eventTime.nanoTime @@ -147,7 +151,10 @@ internal open class RumViewScope( cpuVitalMonitor.register(cpuVitalListener) memoryVitalMonitor.register(memoryVitalListener) frameRateVitalMonitor.register(frameRateVitalListener) - if (parentScope.getRumContext().syntheticsTestId != null) { + val rumContext = parentScope.getRumContext() + if (rumContext.syntheticsTestId != null) { + Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.application.id=${rumContext.applicationId}") + Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.session.id=${rumContext.sessionId}") Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.view.id=$viewId") } }