Skip to content

Commit

Permalink
RUM-2441 Print RUM app, session and view ID in LogCat
Browse files Browse the repository at this point in the history
  • Loading branch information
xgouchet committed Dec 11, 2023
1 parent 2f894e9 commit e9a2bcf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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
Expand Down Expand Up @@ -77,6 +78,7 @@ 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ internal interface RumScope {
* @return the context related to this scope
*/
fun getRumContext(): RumContext

companion object {
internal const val SYNTHETICS_LOGCAT_TAG = "DatadogSynthetics"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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
Expand Down Expand Up @@ -200,6 +201,9 @@ 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.datadog.android.rum.internal.domain.scope

import android.util.Log
import androidx.annotation.WorkerThread
import com.datadog.android.api.InternalLogger
import com.datadog.android.api.feature.Feature
Expand Down Expand Up @@ -67,6 +68,9 @@ internal open class RumViewScope(
set(value) {
oldViewIds += field
field = value
if (getRumContext().syntheticsTestId!=null) {
Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.view.id=$viewId")
}
}
private val oldViewIds = mutableSetOf<String>()
private val startedNanos: Long = eventTime.nanoTime
Expand Down Expand Up @@ -141,6 +145,9 @@ internal open class RumViewScope(
cpuVitalMonitor.register(cpuVitalListener)
memoryVitalMonitor.register(memoryVitalListener)
frameRateVitalMonitor.register(frameRateVitalListener)
if (parentScope.getRumContext().syntheticsTestId != null) {
Log.i(RumScope.SYNTHETICS_LOGCAT_TAG, "_dd.view.id=$viewId")
}
}

// region RumScope
Expand Down Expand Up @@ -1167,7 +1174,7 @@ internal open class RumViewScope(
*
* As we take the inverse, the min of the inverse is the inverse of the max and
* vice-versa.
* For instance, if the the min frame time is 20ms (50 fps) and the max is 500ms (2 fps),
* For instance, if the min frame time is 20ms (50 fps) and the max is 500ms (2 fps),
* the max frame rate is 50 fps (1/minValue) and the min is 2 fps (1/maxValue).
*
* As the frame times are reported in nanoseconds, we need to add a multiplier.
Expand Down
1 change: 0 additions & 1 deletion local_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ if [[ $ANALYSIS == 1 ]]; then
echo "------ Detekt public API rules"
detekt --config "$DD_SOURCE/domains/mobile/config/android/gitlab/detekt/detekt-public-api.yml"


if [[ $COMPILE == 1 ]]; then
# Assemble is required to get generated classes type resolution
echo "------ Assemble Libraries"
Expand Down

0 comments on commit e9a2bcf

Please sign in to comment.