Skip to content

Commit

Permalink
Merge pull request #1158 from DataDog/nogorodnikov/prepare-merge-sdkv…
Browse files Browse the repository at this point in the history
…2-into-develop

RUMM-2752: Prepare merge of SDK v2 branch into develop branch
  • Loading branch information
0xnm authored Nov 25, 2022
2 parents 32afedf + 76d290f commit 8d6e9c5
Show file tree
Hide file tree
Showing 31 changed files with 106 additions and 562 deletions.
17 changes: 2 additions & 15 deletions dd-sdk-android/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ object com.datadog.android.Datadog
fun setUserInfo(String? = null, String? = null, String? = null, Map<String, Any?> = emptyMap())
fun addUserExtraInfo(Map<String, Any?> = emptyMap())
fun enableRumDebugging(Boolean)
fun stopSessionRecording()
fun startSessionRecording()
val _internal: _InternalProxy
object com.datadog.android.DatadogEndpoint
const val LOGS_US1: String
Expand All @@ -30,11 +28,6 @@ object com.datadog.android.DatadogEndpoint
const val NTP_1: String
const val NTP_2: String
const val NTP_3: String
const val SESSION_REPLAY_US1: String
const val SESSION_REPLAY_US3: String
const val SESSION_REPLAY_US5: String
const val SESSION_REPLAY_US1_FED: String
const val SESSION_REPLAY_EU1: String
class com.datadog.android.DatadogEventListener : okhttp3.EventListener
override fun callStart(okhttp3.Call)
override fun dnsStart(okhttp3.Call, String)
Expand Down Expand Up @@ -68,7 +61,6 @@ enum com.datadog.android.DatadogSite
fun logsEndpoint(): String
fun tracesEndpoint(): String
fun rumEndpoint(): String
fun sessionReplayEndpoint(): String
class com.datadog.android._InternalProxy
class _TelemetryProxy
fun debug(String)
Expand All @@ -85,7 +77,7 @@ enum com.datadog.android.core.configuration.BatchSize
- LARGE
data class com.datadog.android.core.configuration.Configuration
class Builder
constructor(Boolean, Boolean, Boolean, Boolean, Boolean)
constructor(Boolean, Boolean, Boolean, Boolean)
fun build(): Configuration
fun setUseDeveloperModeWhenDebuggable(Boolean): Builder
fun setFirstPartyHosts(List<String>): Builder
Expand All @@ -95,7 +87,6 @@ data class com.datadog.android.core.configuration.Configuration
fun useCustomTracesEndpoint(String): Builder
fun useCustomCrashReportsEndpoint(String): Builder
fun useCustomRumEndpoint(String): Builder
fun useCustomSessionReplayEndpoint(String): Builder
fun trackInteractions(Array<com.datadog.android.rum.tracking.ViewAttributesProvider> = emptyArray(), com.datadog.android.rum.tracking.InteractionPredicate = NoOpInteractionPredicate()): Builder
fun disableInteractionTracking(): Builder
fun trackLongTasks(Long = DEFAULT_LONG_TASK_THRESHOLD_MS): Builder
Expand All @@ -116,16 +107,13 @@ data class com.datadog.android.core.configuration.Configuration
fun setLogEventMapper(com.datadog.android.event.EventMapper<com.datadog.android.log.model.LogEvent>): Builder
fun setAdditionalConfiguration(Map<String, Any>): Builder
fun setProxy(java.net.Proxy, okhttp3.Authenticator?): Builder
fun setSecurityConfig(SecurityConfig): Builder
fun setSessionReplayPrivacy(com.datadog.android.sessionreplay.SessionReplayPrivacy): Builder
fun setEncryption(com.datadog.android.security.Encryption): Builder
fun setVitalsUpdateFrequency(VitalsUpdateFrequency): Builder
companion object
data class com.datadog.android.core.configuration.Credentials
constructor(String, String, String, String?, String? = null)
companion object
const val NO_VARIANT: String
data class com.datadog.android.core.configuration.SecurityConfig
constructor(com.datadog.android.security.Encryption?)
enum com.datadog.android.core.configuration.UploadFrequency
constructor(Long)
- FREQUENT
Expand Down Expand Up @@ -326,7 +314,6 @@ enum com.datadog.android.plugin.Feature
- CRASH
- TRACE
- RUM
- SESSION_REPLAY
enum com.datadog.android.privacy.TrackingConsent
- GRANTED
- NOT_GRANTED
Expand Down
20 changes: 0 additions & 20 deletions dd-sdk-android/src/main/kotlin/com/datadog/android/Datadog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -212,26 +212,6 @@ object Datadog {
}
}

/**
* Stops the session recording.
*
* Session Replay feature will only work for recorded
* sessions.
*/
fun stopSessionRecording() {
(globalSdkCore as? DatadogCore)?.sessionReplayFeature?.stopRecording()
}

/**
* Starts/resumes the session recording.
*
* Session Replay feature will only work for recorded
* sessions.
*/
fun startSessionRecording() {
(globalSdkCore as? DatadogCore)?.sessionReplayFeature?.startRecording()
}

/**
* For Datadog internal use only.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,48 +153,4 @@ object DatadogEndpoint {
const val NTP_3: String = "3.datadog.pool.ntp.org"

// endregion

// region Session Replay

/**
* The US1 endpoint for Session Replay (US based servers).
* Use this in your [Configuration] if you want to point to
* [app.datadoghq.com](https://app.datadoghq.com)
* @see [Configuration]
*/
const val SESSION_REPLAY_US1: String = "https://session-replay.browser-intake-datadoghq.com"

/**
* The US3 endpoint for Session Replay (US based servers).
* Use this in your [Configuration] if you want to point to
* [us3.datadoghq.com](https://us3.datadoghq.com)
* @see [Configuration]
*/
const val SESSION_REPLAY_US3: String = "https://session-replay.browser-intake-us3-datadoghq.com"

/**
* The US5 endpoint for Session replay (US based servers).
* Use this in your [Configuration] if you want to point to
* [us5.datadoghq.com](https://us5.datadoghq.com)
* @see [Configuration]
*/
const val SESSION_REPLAY_US5: String = "https://session-replay.browser-intake-us5-datadoghq.com"

/**
* The US1_FED endpoint for Session replay (US based servers, FedRAMP compliant).
* Use this in your [Configuration] if you want to point to [app.ddog-gov.com](https://app
* .ddog-gov.com)
* @see [Configuration]
*/
const val SESSION_REPLAY_US1_FED: String = "https://session-replay.browser-intake-ddog-gov.com"

/**
* The EU1 endpoint for Session Replay (EU based servers).
* Use this in your [Configuration] if you want to point to
* [app.datadoghq.eu](https://app.datadoghq.eu)
* @see [Configuration]
*/
const val SESSION_REPLAY_EU1: String = "https://session-replay.browser-intake-datadoghq.eu"

// endregion
}
13 changes: 0 additions & 13 deletions dd-sdk-android/src/main/kotlin/com/datadog/android/DatadogSite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,4 @@ enum class DatadogSite(val siteName: String) {
EU1 -> DatadogEndpoint.RUM_EU1
}
}

/**
* Returns the endpoint to use to upload RUM Events to this site.
*/
fun sessionReplayEndpoint(): String {
return when (this) {
US1 -> DatadogEndpoint.SESSION_REPLAY_US1
US3 -> DatadogEndpoint.SESSION_REPLAY_US3
US5 -> DatadogEndpoint.SESSION_REPLAY_US5
US1_FED -> DatadogEndpoint.SESSION_REPLAY_US1_FED
EU1 -> DatadogEndpoint.SESSION_REPLAY_EU1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.datadog.android.rum.tracking.NoOpInteractionPredicate
import com.datadog.android.rum.tracking.TrackingStrategy
import com.datadog.android.rum.tracking.ViewAttributesProvider
import com.datadog.android.rum.tracking.ViewTrackingStrategy
import com.datadog.android.security.Encryption
import com.datadog.android.sessionreplay.SessionReplayPrivacy
import com.datadog.android.telemetry.model.TelemetryConfigurationEvent
import okhttp3.Authenticator
Expand All @@ -63,7 +64,6 @@ internal constructor(
internal val tracesConfig: Feature.Tracing?,
internal val crashReportConfig: Feature.CrashReport?,
internal val rumConfig: Feature.RUM?,
internal val sessionReplayConfig: Feature.SessionReplay?,
internal val additionalConfig: Map<String, Any>
) {

Expand All @@ -75,7 +75,7 @@ internal constructor(
val uploadFrequency: UploadFrequency,
val proxy: Proxy?,
val proxyAuth: Authenticator,
val securityConfig: SecurityConfig,
val encryption: Encryption?,
val webViewTrackingHosts: List<String>,
val site: DatadogSite
)
Expand Down Expand Up @@ -130,21 +130,18 @@ internal constructor(
* @param tracesEnabled whether Spans are tracked and sent to Datadog
* @param crashReportsEnabled whether crashes are tracked and sent to Datadog
* @param rumEnabled whether RUM events are tracked and sent to Datadog
* @param sessionReplayEnabled whether RUM Session Replay is enabled or not
*/
@Suppress("TooManyFunctions")
class Builder(
val logsEnabled: Boolean,
val tracesEnabled: Boolean,
val crashReportsEnabled: Boolean,
val rumEnabled: Boolean,
val sessionReplayEnabled: Boolean
val rumEnabled: Boolean
) {
private var logsConfig: Feature.Logs = DEFAULT_LOGS_CONFIG
private var tracesConfig: Feature.Tracing = DEFAULT_TRACING_CONFIG
private var crashReportConfig: Feature.CrashReport = DEFAULT_CRASH_CONFIG
private var rumConfig: Feature.RUM = DEFAULT_RUM_CONFIG
private var sessionReplayConfig: Feature.SessionReplay = DEFAULT_SESSION_REPLAY_CONFIG
private var additionalConfig: Map<String, Any> = emptyMap()

private var coreConfig = DEFAULT_CORE_CONFIG
Expand All @@ -161,7 +158,6 @@ internal constructor(
tracesConfig = if (tracesEnabled) tracesConfig else null,
crashReportConfig = if (crashReportsEnabled) crashReportConfig else null,
rumConfig = if (rumEnabled) rumConfig else null,
sessionReplayConfig = if (sessionReplayEnabled) sessionReplayConfig else null,
additionalConfig = additionalConfig
)
}
Expand Down Expand Up @@ -227,9 +223,6 @@ internal constructor(
crashReportConfig = crashReportConfig.copy(endpointUrl = site.logsEndpoint())
rumConfig = rumConfig.copy(endpointUrl = site.rumEndpoint())
coreConfig = coreConfig.copy(needsClearTextHttp = false, site = site)
sessionReplayConfig = sessionReplayConfig.copy(
endpointUrl = site.sessionReplayEndpoint()
)
return this
}

Expand Down Expand Up @@ -277,20 +270,6 @@ internal constructor(
return this
}

/**
* Let the SDK target a custom server for the Session Replay feature.
*/
fun useCustomSessionReplayEndpoint(endpoint: String): Builder {
applyIfFeatureEnabled(
PluginFeature.SESSION_REPLAY,
"useCustomSessionReplayEndpoint"
) {
sessionReplayConfig = sessionReplayConfig.copy(endpointUrl = endpoint)
checkCustomEndpoint(endpoint)
}
return this
}

/**
* Enable the user interaction automatic tracker. By enabling this feature the SDK will intercept
* UI interaction events (e.g.: taps, scrolls, swipes) and automatically send those as RUM UserActions for you.
Expand Down Expand Up @@ -400,9 +379,6 @@ internal constructor(
PluginFeature.CRASH -> crashReportConfig = crashReportConfig.copy(
plugins = crashReportConfig.plugins + plugin
)
else -> {
devLogger.w(PLUGINS_DEPRECATED_WARN_MESSAGE)
}
}
}
return this
Expand Down Expand Up @@ -626,29 +602,18 @@ internal constructor(
}

/**
* Allows to set the necessary security configuration (used to control local
* data storage encryption, for example).
* @param config Security config to use. If not provided, default one will be used (no
* encryption for local data storage).
* Allows to set the encryption for the local data. By default no encryption is used for
* the local data.
*
* @param dataEncryption An encryption object complying [Encryption] interface.
*/
fun setSecurityConfig(config: SecurityConfig): Builder {
fun setEncryption(dataEncryption: Encryption): Builder {
coreConfig = coreConfig.copy(
securityConfig = config
encryption = dataEncryption
)
return this
}

/**
* Sets the privacy rule for the Session Replay feature.
* If not specified all the elements will be masked by default (MASK_ALL).
* @see SessionReplayPrivacy.ALLOW_ALL
* @see SessionReplayPrivacy.MASK_ALL
*/
fun setSessionReplayPrivacy(privacy: SessionReplayPrivacy): Builder {
sessionReplayConfig = sessionReplayConfig.copy(privacy = privacy)
return this
}

private fun checkCustomEndpoint(endpoint: String) {
if (endpoint.startsWith("http://")) {
coreConfig = coreConfig.copy(needsClearTextHttp = true)
Expand All @@ -674,7 +639,6 @@ internal constructor(
PluginFeature.TRACE -> tracesEnabled
PluginFeature.CRASH -> crashReportsEnabled
PluginFeature.RUM -> rumEnabled
PluginFeature.SESSION_REPLAY -> sessionReplayEnabled
}
if (featureEnabled) {
@Suppress("UnsafeThirdPartyFunctionCall") // internal safe call
Expand Down Expand Up @@ -714,7 +678,7 @@ internal constructor(
uploadFrequency = UploadFrequency.AVERAGE,
proxy = null,
proxyAuth = Authenticator.NONE,
securityConfig = SecurityConfig.DEFAULT,
encryption = null,
webViewTrackingHosts = emptyList(),
site = DatadogSite.US1
)
Expand Down Expand Up @@ -750,11 +714,6 @@ internal constructor(
trackFrustrations = true,
vitalsMonitorUpdateFrequency = VitalsUpdateFrequency.AVERAGE
)
internal val DEFAULT_SESSION_REPLAY_CONFIG = Feature.SessionReplay(
endpointUrl = DatadogEndpoint.SESSION_REPLAY_US1,
plugins = emptyList(),
privacy = SessionReplayPrivacy.MASK_ALL
)

internal const val ERROR_FEATURE_DISABLED = "The %s feature has been disabled in your " +
"Configuration.Builder, but you're trying to edit the RUM configuration with the " +
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ internal class CoreFeature {
private fun readConfigurationSettings(configuration: Configuration.Core) {
batchSize = configuration.batchSize
uploadFrequency = configuration.uploadFrequency
localDataEncryption = configuration.securityConfig.localDataEncryption
localDataEncryption = configuration.encryption
site = configuration.site
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ enum class Feature(internal val featureName: String) {
LOG("Logging"),
CRASH("Crash Reporting"),
TRACE("Tracing"),
RUM("RUM"),
SESSION_REPLAY("Session Replay")
RUM("RUM")
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ internal class TelemetryEventHandler(
telemetrySampleRate = rumConfig?.telemetrySamplingRate?.toLong(),
useProxy = coreConfig?.proxy != null,
trackFrustrations = rumConfig?.trackFrustrations,
useLocalEncryption = coreConfig?.securityConfig?.localDataEncryption != null,
useLocalEncryption = coreConfig?.encryption != null,
viewTrackingStrategy = viewTrackingStrategy,
trackBackgroundEvents = rumConfig?.backgroundEventTracking,
trackInteractions = rumConfig?.userActionTrackingStrategy != null,
Expand Down
Loading

0 comments on commit 8d6e9c5

Please sign in to comment.