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-4413 Add telemetry on SR resources track #2027

Merged
merged 1 commit into from
May 13, 2024
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
1 change: 1 addition & 0 deletions dd-sdk-android-core/api/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ interface com.datadog.android.api.feature.Feature
const val RUM_FEATURE_NAME: String
const val TRACING_FEATURE_NAME: String
const val SESSION_REPLAY_FEATURE_NAME: String
const val SESSION_REPLAY_RESOURCES_FEATURE_NAME: String
const val NDK_CRASH_REPORTS_FEATURE_NAME: String
interface com.datadog.android.api.feature.FeatureContextUpdateReceiver
fun onContextUpdate(String, Map<String, Any?>)
Expand Down
2 changes: 2 additions & 0 deletions dd-sdk-android-core/api/dd-sdk-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public abstract interface class com/datadog/android/api/feature/Feature {
public static final field NDK_CRASH_REPORTS_FEATURE_NAME Ljava/lang/String;
public static final field RUM_FEATURE_NAME Ljava/lang/String;
public static final field SESSION_REPLAY_FEATURE_NAME Ljava/lang/String;
public static final field SESSION_REPLAY_RESOURCES_FEATURE_NAME Ljava/lang/String;
public static final field TRACING_FEATURE_NAME Ljava/lang/String;
public abstract fun getName ()Ljava/lang/String;
public abstract fun onInitialize (Landroid/content/Context;)V
Expand All @@ -310,6 +311,7 @@ public final class com/datadog/android/api/feature/Feature$Companion {
public static final field NDK_CRASH_REPORTS_FEATURE_NAME Ljava/lang/String;
public static final field RUM_FEATURE_NAME Ljava/lang/String;
public static final field SESSION_REPLAY_FEATURE_NAME Ljava/lang/String;
public static final field SESSION_REPLAY_RESOURCES_FEATURE_NAME Ljava/lang/String;
public static final field TRACING_FEATURE_NAME Ljava/lang/String;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ interface Feature {
*/
const val SESSION_REPLAY_FEATURE_NAME: String = "session-replay"

/**
* Session Replay Resources sub-feature name.
*/
const val SESSION_REPLAY_RESOURCES_FEATURE_NAME: String = "session-replay-resources"
Copy link
Member

Choose a reason for hiding this comment

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

By adding this here, the feature name for Resources is now defined in two places - in Feature and also in the feature itself. I notice that this is also the case for Session Replay. Do we want to consolidate both of them to use only the constants from Feature and have a SST?


/**
* NDK Crash Reports feature name.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ internal class BatchMetricsDispatcher(
Feature.LOGS_FEATURE_NAME -> LOGS_TRACK_NAME
Feature.TRACING_FEATURE_NAME -> TRACE_TRACK_NAME
Feature.SESSION_REPLAY_FEATURE_NAME -> SR_TRACK_NAME
Feature.SESSION_REPLAY_RESOURCES_FEATURE_NAME -> SR_RESOURCES_TRACK_NAME

else -> null
}
}
Expand All @@ -183,6 +185,7 @@ internal class BatchMetricsDispatcher(
internal const val LOGS_TRACK_NAME = "logs"
internal const val TRACE_TRACK_NAME = "trace"
internal const val SR_TRACK_NAME = "sr"
internal const val SR_RESOURCES_TRACK_NAME = "sr-resources"

private const val METRICS_DISPATCHER_DEFAULT_SAMPLING_RATE = 15f

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ internal class BatchMetricsDispatcherTest {
Feature.RUM_FEATURE_NAME,
Feature.TRACING_FEATURE_NAME,
Feature.LOGS_FEATURE_NAME,
Feature.SESSION_REPLAY_FEATURE_NAME
Feature.SESSION_REPLAY_FEATURE_NAME,
Feature.SESSION_REPLAY_RESOURCES_FEATURE_NAME
)
)
whenever(mockDateTimeProvider.getDeviceTimestamp()).doReturn(currentTimeInMillis)
Expand Down Expand Up @@ -655,6 +656,7 @@ internal class BatchMetricsDispatcherTest {
Feature.LOGS_FEATURE_NAME -> BatchMetricsDispatcher.LOGS_TRACK_NAME
Feature.TRACING_FEATURE_NAME -> BatchMetricsDispatcher.TRACE_TRACK_NAME
Feature.SESSION_REPLAY_FEATURE_NAME -> BatchMetricsDispatcher.SR_TRACK_NAME
Feature.SESSION_REPLAY_RESOURCES_FEATURE_NAME -> BatchMetricsDispatcher.SR_RESOURCES_TRACK_NAME
else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import com.datadog.android.sample.picture.PicassoImageLoader
import com.datadog.android.sample.user.UserFragment
import com.datadog.android.sessionreplay.SessionReplay
import com.datadog.android.sessionreplay.SessionReplayConfiguration
import com.datadog.android.sessionreplay.SessionReplayPrivacy
import com.datadog.android.sessionreplay.material.MaterialExtensionSupport
import com.datadog.android.timber.DatadogTree
import com.datadog.android.trace.AndroidTracer
Expand Down Expand Up @@ -149,6 +150,7 @@ class SampleApplication : Application() {
useCustomEndpoint(BuildConfig.DD_OVERRIDE_SESSION_REPLAY_URL)
}
}
.setPrivacy(SessionReplayPrivacy.MASK_USER_INPUT)
.addExtensionSupport(MaterialExtensionSupport())
.build()
SessionReplay.enable(sessionReplayConfig)
Expand Down