Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUM-2441 Print RUM app, session and view ID in LogCat #1760

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe to expose it in the Logcat ? The session Id and view Id is something we generated but the applicationId is the actual RUM application ID.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only exposed when being ran via Synthetics.
Also the RUM Application ID is an identifier, not a token or a key. Just having the App id gives no permission by itself

}

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