From c17f90afad6c05e407e342c0b3a95198c102fb66 Mon Sep 17 00:00:00 2001 From: Marius Constantin Date: Mon, 16 Sep 2024 11:24:03 +0200 Subject: [PATCH] Apply code review changes --- .../com/datadog/android/_InternalProxy.kt | 17 +- .../android/core/internal/DatadogCore.kt | 7 +- .../core/internal/logger/SdkInternalLogger.kt | 16 +- .../com/datadog/android/InternalProxyTest.kt | 18 +- .../core/DatadogCoreInitializationTest.kt | 6 +- .../internal/logger/SdkInternalLoggerTest.kt | 48 ++-- ...InternalTelemetryApiUsageForgeryFactory.kt | 2 +- ...InternalTelemetryDebugLogForgeryFactory.kt | 2 +- ...InternalTelemetryErrorLogForgeryFactory.kt | 8 +- .../InternalTelemetryMetricForgeryFactory.kt | 2 +- features/dd-sdk-android-rum/api/apiSurface | 67 ----- .../api/dd-sdk-android-rum.api | 233 ------------------ .../generate_telemetry_models.gradle.kts | 3 + .../android/rum/internal/RumFeature.kt | 52 ++-- .../internal/TelemetryEventHandler.kt | 3 - .../android/rum/internal/RumFeatureTest.kt | 47 +--- .../internal/TelemetryEventHandlerTest.kt | 3 +- .../android/core/stub/StubInternalLogger.kt | 2 +- 18 files changed, 64 insertions(+), 472 deletions(-) diff --git a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/_InternalProxy.kt b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/_InternalProxy.kt index 4a043dcbdd..9797bcdd4b 100644 --- a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/_InternalProxy.kt +++ b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/_InternalProxy.kt @@ -50,7 +50,7 @@ class _InternalProxy internal constructor( message = message, additionalProperties = null ) - rumFeature?.sendEvent(bundleEventIntoTelemetry(telemetryEvent)) + rumFeature?.sendEvent(telemetryEvent) } fun error(message: String, throwable: Throwable? = null) { @@ -58,7 +58,7 @@ class _InternalProxy internal constructor( message = message, error = throwable ) - rumFeature?.sendEvent(bundleEventIntoTelemetry(telemetryEvent)) + rumFeature?.sendEvent(telemetryEvent) } fun error(message: String, stack: String?, kind: String?) { @@ -67,19 +67,8 @@ class _InternalProxy internal constructor( stacktrace = stack, kind = kind ) - rumFeature?.sendEvent(bundleEventIntoTelemetry(telemetryEvent)) + rumFeature?.sendEvent(telemetryEvent) } - - // region Internal - - private fun bundleEventIntoTelemetry(event: Any): Map { - return mapOf( - "type" to "telemetry_event", - "event" to event - ) - } - - // endregion } @Suppress("PropertyName") diff --git a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/DatadogCore.kt b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/DatadogCore.kt index 745fec66a0..e056805021 100644 --- a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/DatadogCore.kt +++ b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/DatadogCore.kt @@ -511,12 +511,7 @@ internal class DatadogCore( batchUploadFrequency = configuration.coreConfig.uploadFrequency.baseStepMs, batchProcessingLevel = configuration.coreConfig.batchProcessingLevel.maxBatchesPerUploadJob ) - rumFeature.sendEvent( - mapOf( - "type" to "telemetry_event", - "event" to event - ) - ) + rumFeature.sendEvent(event) } coreFeature.uploadExecutorService.scheduleSafe( diff --git a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/logger/SdkInternalLogger.kt b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/logger/SdkInternalLogger.kt index 2e17f38223..5e83f859a0 100644 --- a/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/logger/SdkInternalLogger.kt +++ b/dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/logger/SdkInternalLogger.kt @@ -104,7 +104,7 @@ internal class SdkInternalLogger( message = messageBuilder(), additionalProperties = additionalProperties ) - rumFeature.sendEvent(bundleEventIntoTelemetry(metricEvent)) + rumFeature.sendEvent(metricEvent) } override fun startPerformanceMeasure( @@ -132,20 +132,13 @@ internal class SdkInternalLogger( ) { if (!RateBasedSampler(samplingRate).sample()) return val rumFeature = sdkCore?.getFeature(Feature.RUM_FEATURE_NAME) ?: return - rumFeature.sendEvent(bundleEventIntoTelemetry(apiUsageEvent)) + rumFeature.sendEvent(apiUsageEvent) } // endregion // region Internal - private fun bundleEventIntoTelemetry(event: Any): Map { - return mapOf( - TYPE_KEY to TELEMETRY_EVENT_MESSAGE_TYPE, - TELEMETRY_EVENT_KEY to event - ) - } - private fun logToUser( level: InternalLogger.Level, messageBuilder: () -> String, @@ -234,7 +227,7 @@ internal class SdkInternalLogger( additionalProperties = additionalProperties ) } - rumFeature.sendEvent(bundleEventIntoTelemetry(telemetryEvent)) + rumFeature.sendEvent(telemetryEvent) } private fun InternalLogger.Level.toLogLevel(): Int { @@ -259,9 +252,6 @@ internal class SdkInternalLogger( companion object { internal const val SDK_LOG_TAG = "DD_LOG" internal const val DEV_LOG_TAG = "Datadog" - private const val TYPE_KEY = "type" - private const val TELEMETRY_EVENT_MESSAGE_TYPE = "telemetry_event" - internal const val TELEMETRY_EVENT_KEY = "event" } // endregion diff --git a/dd-sdk-android-core/src/test/kotlin/com/datadog/android/InternalProxyTest.kt b/dd-sdk-android-core/src/test/kotlin/com/datadog/android/InternalProxyTest.kt index 37fdd2281f..e98669ffb8 100644 --- a/dd-sdk-android-core/src/test/kotlin/com/datadog/android/InternalProxyTest.kt +++ b/dd-sdk-android-core/src/test/kotlin/com/datadog/android/InternalProxyTest.kt @@ -52,11 +52,9 @@ internal class InternalProxyTest { proxy._telemetry.debug(message) // Then - argumentCaptor> { + argumentCaptor { verify(mockRumFeatureScope).sendEvent(capture()) - val payload = firstValue - assert(payload["type"] == "telemetry_event") - val logEvent = payload["event"] as InternalTelemetryEvent.Log.Debug + val logEvent = firstValue as InternalTelemetryEvent.Log.Debug assertThat(logEvent.message).isEqualTo(message) } } @@ -77,11 +75,9 @@ internal class InternalProxyTest { proxy._telemetry.error(message, stack, kind) // Then - argumentCaptor> { + argumentCaptor { verify(mockRumFeatureScope).sendEvent(capture()) - val payload = firstValue - assert(payload["type"] == "telemetry_event") - val logEvent = payload["event"] as InternalTelemetryEvent.Log.Error + val logEvent = firstValue as InternalTelemetryEvent.Log.Error assertThat(logEvent.message).isEqualTo(message) assertThat(logEvent.stacktrace).isEqualTo(stack) assertThat(logEvent.kind).isEqualTo(kind) @@ -103,11 +99,9 @@ internal class InternalProxyTest { proxy._telemetry.error(message, throwable) // Then - argumentCaptor> { + argumentCaptor { verify(mockRumFeatureScope).sendEvent(capture()) - val payload = firstValue - assert(payload["type"] == "telemetry_event") - val logEvent = payload["event"] as InternalTelemetryEvent.Log.Error + val logEvent = firstValue as InternalTelemetryEvent.Log.Error assertThat(logEvent.message).isEqualTo(message) assertThat(logEvent.error).isEqualTo(throwable) } diff --git a/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/DatadogCoreInitializationTest.kt b/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/DatadogCoreInitializationTest.kt index 791cd2b8dd..c212da1a34 100644 --- a/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/DatadogCoreInitializationTest.kt +++ b/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/DatadogCoreInitializationTest.kt @@ -373,11 +373,9 @@ internal class DatadogCoreInitializationTest { } testedCore.coreFeature.uploadExecutorService.shutdownNow() - argumentCaptor> { + argumentCaptor { verify(mockRumFeature).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val telemetryConfigurationEvent = firstValue["event"] as InternalTelemetryEvent.Configuration + val telemetryConfigurationEvent = firstValue as InternalTelemetryEvent.Configuration assertThat(telemetryConfigurationEvent.trackErrors) .isEqualTo(configuration.crashReportsEnabled) assertThat(telemetryConfigurationEvent.batchSize) diff --git a/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/internal/logger/SdkInternalLoggerTest.kt b/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/internal/logger/SdkInternalLoggerTest.kt index 45805cb33f..de4349e503 100644 --- a/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/internal/logger/SdkInternalLoggerTest.kt +++ b/dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/internal/logger/SdkInternalLoggerTest.kt @@ -283,11 +283,9 @@ internal class SdkInternalLoggerTest { ) // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val logEvent = firstValue["event"] as InternalTelemetryEvent.Log.Debug + val logEvent = firstValue as InternalTelemetryEvent.Log.Debug assertThat(logEvent.message).isEqualTo(fakeMessage) assertThat(logEvent.additionalProperties).isNull() } @@ -318,11 +316,9 @@ internal class SdkInternalLoggerTest { ) // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val logEvent = firstValue["event"] as InternalTelemetryEvent.Log.Debug + val logEvent = firstValue as InternalTelemetryEvent.Log.Debug assertThat(logEvent.message).isEqualTo(fakeMessage) assertThat(logEvent.additionalProperties).isEqualTo(fakeAdditionalProperties) } @@ -350,11 +346,9 @@ internal class SdkInternalLoggerTest { ) // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val logEvent = firstValue["event"] as InternalTelemetryEvent.Log.Debug + val logEvent = firstValue as InternalTelemetryEvent.Log.Debug assertThat(logEvent.message).isEqualTo(fakeMessage) assertThat(logEvent.additionalProperties).isEmpty() } @@ -383,11 +377,9 @@ internal class SdkInternalLoggerTest { ) // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val logEvent = firstValue["event"] as InternalTelemetryEvent.Log.Error + val logEvent = firstValue as InternalTelemetryEvent.Log.Error assertThat(logEvent.message).isEqualTo(fakeMessage) assertThat(logEvent.additionalProperties).isEqualTo(fakeAdditionalProperties) } @@ -417,11 +409,9 @@ internal class SdkInternalLoggerTest { ) // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val logEvent = firstValue["event"] as InternalTelemetryEvent.Log.Error + val logEvent = firstValue as InternalTelemetryEvent.Log.Error assertThat(logEvent.message).isEqualTo(fakeMessage) assertThat(logEvent.error).isEqualTo(fakeThrowable) assertThat(logEvent.additionalProperties).isEqualTo(fakeAdditionalProperties) @@ -452,11 +442,9 @@ internal class SdkInternalLoggerTest { } // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val logEvent = firstValue["event"] as InternalTelemetryEvent.Log.Debug + val logEvent = firstValue as InternalTelemetryEvent.Log.Debug assertThat(logEvent.message).isEqualTo(fakeMessage) } } @@ -481,11 +469,9 @@ internal class SdkInternalLoggerTest { ) // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val metricEvent = firstValue["event"] as InternalTelemetryEvent.Metric + val metricEvent = firstValue as InternalTelemetryEvent.Metric assertThat(metricEvent.message).isEqualTo(fakeMessage) assertThat(metricEvent.additionalProperties).isEqualTo(fakeAdditionalProperties) } @@ -578,11 +564,9 @@ internal class SdkInternalLoggerTest { testedInternalLogger.logApiUsage(fakeApiUsageInternalTelemetryEvent, 100.0f) // Then - argumentCaptor>() { + argumentCaptor() { verify(mockRumFeatureScope).sendEvent(capture()) - assertThat(firstValue.size).isEqualTo(2) - assertThat(firstValue["type"]).isEqualTo("telemetry_event") - val apiUsageEvent = firstValue["event"] as InternalTelemetryEvent.ApiUsage + val apiUsageEvent = firstValue as InternalTelemetryEvent.ApiUsage assertThat(apiUsageEvent).isEqualTo(fakeApiUsageInternalTelemetryEvent) } } diff --git a/dd-sdk-android-internal/src/testFixtures/kotlin/com/datadog/android/internal/tests/elmyr/InternalTelemetryApiUsageForgeryFactory.kt b/dd-sdk-android-internal/src/testFixtures/kotlin/com/datadog/android/internal/tests/elmyr/InternalTelemetryApiUsageForgeryFactory.kt index c3b1db7114..346645aa0a 100644 --- a/dd-sdk-android-internal/src/testFixtures/kotlin/com/datadog/android/internal/tests/elmyr/InternalTelemetryApiUsageForgeryFactory.kt +++ b/dd-sdk-android-internal/src/testFixtures/kotlin/com/datadog/android/internal/tests/elmyr/InternalTelemetryApiUsageForgeryFactory.kt @@ -17,7 +17,7 @@ class InternalTelemetryApiUsageForgeryFactory : ForgeryFactory? = null, Telemetry? = null) - val type: kotlin.String - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): CommonTelemetryProperties - fun fromJsonObject(com.google.gson.JsonObject): CommonTelemetryProperties - class Dd - val formatVersion: kotlin.Long - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Dd - fun fromJsonObject(com.google.gson.JsonObject): Dd - data class Application - constructor(kotlin.String) - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Application - fun fromJsonObject(com.google.gson.JsonObject): Application - data class Session - constructor(kotlin.String) - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Session - fun fromJsonObject(com.google.gson.JsonObject): Session - data class View - constructor(kotlin.String) - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): View - fun fromJsonObject(com.google.gson.JsonObject): View - data class Action - constructor(kotlin.String) - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Action - fun fromJsonObject(com.google.gson.JsonObject): Action - data class Telemetry - constructor(Device? = null, Os? = null, kotlin.collections.MutableMap = mutableMapOf()) - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Telemetry - fun fromJsonObject(com.google.gson.JsonObject): Telemetry - data class Device - constructor(kotlin.String? = null, kotlin.String? = null, kotlin.String? = null) - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Device - fun fromJsonObject(com.google.gson.JsonObject): Device - data class Os - constructor(kotlin.String? = null, kotlin.String? = null, kotlin.String? = null) - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Os - fun fromJsonObject(com.google.gson.JsonObject): Os - enum Source - constructor(kotlin.String) - - ANDROID - - IOS - - BROWSER - - FLUTTER - - REACT_NATIVE - - UNITY - - KOTLIN_MULTIPLATFORM - fun toJson(): com.google.gson.JsonElement - companion object - fun fromJson(kotlin.String): Source data class com.datadog.android.telemetry.model.TelemetryConfigurationEvent constructor(Dd, kotlin.Long, kotlin.String, Source, kotlin.String, Application? = null, Session? = null, View? = null, Action? = null, kotlin.collections.List? = null, Telemetry) val type: kotlin.String diff --git a/features/dd-sdk-android-rum/api/dd-sdk-android-rum.api b/features/dd-sdk-android-rum/api/dd-sdk-android-rum.api index 8443542d0b..1942571a28 100644 --- a/features/dd-sdk-android-rum/api/dd-sdk-android-rum.api +++ b/features/dd-sdk-android-rum/api/dd-sdk-android-rum.api @@ -5150,239 +5150,6 @@ public final class com/datadog/android/sqlite/DatadogDatabaseErrorHandler : andr public fun onCorruption (Landroid/database/sqlite/SQLiteDatabase;)V } -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Companion; - public fun (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd;JLjava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source;Ljava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action;Ljava/util/List;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry;)V - public synthetic fun (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd;JLjava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source;Ljava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action;Ljava/util/List;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd; - public final fun component10 ()Ljava/util/List; - public final fun component11 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; - public final fun component2 ()J - public final fun component3 ()Ljava/lang/String; - public final fun component4 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public final fun component5 ()Ljava/lang/String; - public final fun component6 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; - public final fun component7 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; - public final fun component8 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; - public final fun component9 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; - public final fun copy (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd;JLjava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source;Ljava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action;Ljava/util/List;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd;JLjava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source;Ljava/lang/String;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action;Ljava/util/List;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties; - public final fun getAction ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; - public final fun getApplication ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; - public final fun getDate ()J - public final fun getDd ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd; - public final fun getExperimentalFeatures ()Ljava/util/List; - public final fun getService ()Ljava/lang/String; - public final fun getSession ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; - public final fun getSource ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public final fun getTelemetry ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; - public final fun getType ()Ljava/lang/String; - public final fun getVersion ()Ljava/lang/String; - public final fun getView ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Action { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action$Companion; - public fun (Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action;Ljava/lang/String;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; - public final fun getId ()Ljava/lang/String; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Action$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Action; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Application { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application$Companion; - public fun (Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application;Ljava/lang/String;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; - public final fun getId ()Ljava/lang/String; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Application$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Application; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Dd { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd$Companion; - public fun ()V - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd; - public final fun getFormatVersion ()J - public final fun toJson ()Lcom/google/gson/JsonElement; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Dd$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Dd; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Device { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device$Companion; - public fun ()V - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; - public final fun getArchitecture ()Ljava/lang/String; - public final fun getBrand ()Ljava/lang/String; - public final fun getModel ()Ljava/lang/String; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Device$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Os { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os$Companion; - public fun ()V - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V - public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; - public final fun getBuild ()Ljava/lang/String; - public final fun getName ()Ljava/lang/String; - public final fun getVersion ()Ljava/lang/String; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Os$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Session { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session$Companion; - public fun (Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session;Ljava/lang/String;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; - public final fun getId ()Ljava/lang/String; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Session$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Session; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Source : java/lang/Enum { - public static final field ANDROID Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static final field BROWSER Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source$Companion; - public static final field FLUTTER Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static final field IOS Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static final field KOTLIN_MULTIPLATFORM Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static final field REACT_NATIVE Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static final field UNITY Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public final fun toJson ()Lcom/google/gson/JsonElement; - public static fun valueOf (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; - public static fun values ()[Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Source$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Source; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry$Companion; - public fun ()V - public fun (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os;Ljava/util/Map;)V - public synthetic fun (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; - public final fun component2 ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; - public final fun component3 ()Ljava/util/Map; - public final fun copy (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os;Ljava/util/Map;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device;Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os;Ljava/util/Map;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; - public final fun getAdditionalProperties ()Ljava/util/Map; - public final fun getDevice ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Device; - public final fun getOs ()Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Os; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$Telemetry; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$View { - public static final field Companion Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View$Companion; - public fun (Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; - public static synthetic fun copy$default (Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View;Ljava/lang/String;ILjava/lang/Object;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; - public fun equals (Ljava/lang/Object;)Z - public static final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; - public static final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; - public final fun getId ()Ljava/lang/String; - public fun hashCode ()I - public final fun toJson ()Lcom/google/gson/JsonElement; - public fun toString ()Ljava/lang/String; -} - -public final class com/datadog/android/telemetry/model/CommonTelemetryProperties$View$Companion { - public final fun fromJson (Ljava/lang/String;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; - public final fun fromJsonObject (Lcom/google/gson/JsonObject;)Lcom/datadog/android/telemetry/model/CommonTelemetryProperties$View; -} - public final class com/datadog/android/telemetry/model/TelemetryConfigurationEvent { public static final field Companion Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$Companion; public fun (Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$Dd;JLjava/lang/String;Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$Source;Ljava/lang/String;Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$Application;Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$Session;Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$View;Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$Action;Ljava/util/List;Lcom/datadog/android/telemetry/model/TelemetryConfigurationEvent$Telemetry;)V diff --git a/features/dd-sdk-android-rum/generate_telemetry_models.gradle.kts b/features/dd-sdk-android-rum/generate_telemetry_models.gradle.kts index 9caaaf4c2c..db2d658af6 100644 --- a/features/dd-sdk-android-rum/generate_telemetry_models.gradle.kts +++ b/features/dd-sdk-android-rum/generate_telemetry_models.gradle.kts @@ -15,6 +15,9 @@ tasks.register( ) { inputDirPath = "src/main/json/telemetry" targetPackageName = "com.datadog.android.telemetry.model" + ignoredFiles = arrayOf( + "_common-schema.json" + ) inputNameMapping = mapOf( "debug-schema.json" to "TelemetryDebugEvent", "error-schema.json" to "TelemetryErrorEvent" diff --git a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/RumFeature.kt b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/RumFeature.kt index 827a2263f9..c23b1a0320 100644 --- a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/RumFeature.kt +++ b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/RumFeature.kt @@ -248,18 +248,25 @@ internal class RumFeature( // region FeatureEventReceiver override fun onReceive(event: Any) { - if (event is JvmCrash.Rum) { - addJvmCrash(event) - return - } else if (event !is Map<*, *>) { - sdkCore.internalLogger.log( - InternalLogger.Level.WARN, - InternalLogger.Target.USER, - { UNSUPPORTED_EVENT_TYPE.format(Locale.US, event::class.java.canonicalName) } - ) - return + when (event) { + is Map<*, *> -> handleMapLikeEvent(event) + is JvmCrash.Rum -> addJvmCrash(event) + is InternalTelemetryEvent -> handleTelemetryEvent(event) + else -> { + sdkCore.internalLogger.log( + InternalLogger.Level.WARN, + InternalLogger.Target.USER, + { UNSUPPORTED_EVENT_TYPE.format(Locale.US, event::class.java.canonicalName) } + ) + } } + } + + // endregion + // region Internal + + private fun handleMapLikeEvent(event: Map<*, *>) { when (event["type"]) { NDK_CRASH_BUS_MESSAGE_TYPE -> lateCrashEventHandler.handleNdkCrashEvent(event, dataWriter) @@ -269,6 +276,7 @@ internal class RumFeature( WEB_VIEW_INGESTED_NOTIFICATION_MESSAGE_TYPE -> { (GlobalRumMonitor.get(sdkCore) as? AdvancedRumMonitor)?.sendWebViewEvent() } + FLUSH_AND_STOP_MONITOR_MESSAGE_TYPE -> { (GlobalRumMonitor.get(sdkCore) as? DatadogRumMonitor)?.let { it.stopKeepAliveCallback() @@ -276,8 +284,6 @@ internal class RumFeature( } } - TELEMETRY_EVENT_MESSAGE_TYPE -> handleTelemetryEvent(event) - else -> { sdkCore.internalLogger.log( InternalLogger.Level.WARN, @@ -288,22 +294,9 @@ internal class RumFeature( } } - // endregion - - // region Internal - - private fun handleTelemetryEvent(event: Map<*, *>) { - val telemetryEvent = event[EVENT_MESSAGE_KEY] as? InternalTelemetryEvent + private fun handleTelemetryEvent(event: InternalTelemetryEvent) { val advancedRumMonitor = GlobalRumMonitor.get(sdkCore) as? AdvancedRumMonitor ?: return - if (telemetryEvent != null) { - advancedRumMonitor.sendTelemetryEvent(telemetryEvent) - } else { - sdkCore.internalLogger.log( - InternalLogger.Level.WARN, - InternalLogger.Target.MAINTAINER, - { TELEMETRY_MISSING_EVENT_FIELD_WARNING_MESSAGE } - ) - } + advancedRumMonitor.sendTelemetryEvent(event) } @AnyThread @@ -542,7 +535,6 @@ internal class RumFeature( internal const val LOGGER_ERROR_BUS_MESSAGE_TYPE = "logger_error" internal const val LOGGER_ERROR_WITH_STACK_TRACE_MESSAGE_TYPE = "logger_error_with_stacktrace" internal const val WEB_VIEW_INGESTED_NOTIFICATION_MESSAGE_TYPE = "web_view_ingested_notification" - internal const val MOBILE_METRIC_MESSAGE_TYPE = "mobile_metric" internal const val FLUSH_AND_STOP_MONITOR_MESSAGE_TYPE = "flush_and_stop_monitor" internal const val ALL_IN_SAMPLE_RATE: Float = 100f @@ -583,8 +575,6 @@ internal class RumFeature( internal const val EVENT_THROWABLE_PROPERTY = "throwable" internal const val EVENT_ATTRIBUTES_PROPERTY = "attributes" internal const val EVENT_STACKTRACE_PROPERTY = "stacktrace" - internal const val TELEMETRY_EVENT_MESSAGE_TYPE = "telemetry_event" - internal const val EVENT_MESSAGE_KEY = "event" internal const val UNSUPPORTED_EVENT_TYPE = "RUM feature receive an event of unsupported type=%s." @@ -600,8 +590,6 @@ internal class RumFeature( internal const val LOG_ERROR_WITH_STACKTRACE_EVENT_MISSING_MANDATORY_FIELDS = "RUM feature received a log event with stacktrace" + " where mandatory message field is either missing or has a wrong type." - internal const val TELEMETRY_MISSING_EVENT_FIELD_WARNING_MESSAGE = "RUM feature received a telemetry" + - " event, but mandatory event field is either missing or has a wrong type." internal const val DEVELOPER_MODE_SAMPLE_RATE_CHANGED_MESSAGE = "Developer mode enabled, setting RUM sample rate to 100%." internal const val RUM_FEATURE_NOT_YET_INITIALIZED = diff --git a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandler.kt b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandler.kt index 4232a45cff..10ac89f9ac 100644 --- a/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandler.kt +++ b/features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandler.kt @@ -113,8 +113,6 @@ internal class TelemetryEventHandler( trackNetworkRequests = true null } - - else -> null } if (telemetryEvent != null) { writer.write(eventBatchWriter, telemetryEvent, EventType.TELEMETRY) @@ -379,7 +377,6 @@ internal class TelemetryEventHandler( ) ) } - else -> null } } diff --git a/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/RumFeatureTest.kt b/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/RumFeatureTest.kt index 4e935756a0..9c197ec0a5 100644 --- a/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/RumFeatureTest.kt +++ b/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/RumFeatureTest.kt @@ -1202,13 +1202,9 @@ internal class RumFeatureTest { ) { // Given testedFeature.onInitialize(appContext.mockInstance) - val event = mapOf( - "type" to RumFeature.TELEMETRY_EVENT_MESSAGE_TYPE, - "event" to fakeInternalTelemetryEvent - ) // When - testedFeature.onReceive(event) + testedFeature.onReceive(fakeInternalTelemetryEvent) // Then verify(mockRumMonitor).sendTelemetryEvent(fakeInternalTelemetryEvent) @@ -1216,47 +1212,6 @@ internal class RumFeatureTest { verifyNoInteractions(mockInternalLogger) } - @Test - fun `M log warning W onReceive() { telemetry event, event is missing }`() { - // Given - val event = mapOf( - "type" to RumFeature.TELEMETRY_EVENT_MESSAGE_TYPE - ) - - // When - testedFeature.onReceive(event) - - // Then - mockInternalLogger.verifyLog( - InternalLogger.Level.WARN, - InternalLogger.Target.MAINTAINER, - RumFeature.TELEMETRY_MISSING_EVENT_FIELD_WARNING_MESSAGE - ) - - verifyNoInteractions(mockRumMonitor) - } - - @Test - fun `M log warning W onReceive() { telemetry event, event is not of type Telemetry }`() { - // Given - val event = mapOf( - "type" to RumFeature.TELEMETRY_EVENT_MESSAGE_TYPE, - "event" to Any() - ) - - // When - testedFeature.onReceive(event) - - // Then - mockInternalLogger.verifyLog( - InternalLogger.Level.WARN, - InternalLogger.Target.MAINTAINER, - RumFeature.TELEMETRY_MISSING_EVENT_FIELD_WARNING_MESSAGE - ) - - verifyNoInteractions(mockRumMonitor) - } - // endregion private fun Forge.anApplicationExitInfoList( diff --git a/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandlerTest.kt b/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandlerTest.kt index 64d33b599d..683e348edc 100644 --- a/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandlerTest.kt +++ b/features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/telemetry/internal/TelemetryEventHandlerTest.kt @@ -45,7 +45,6 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Assumptions.assumeTrue import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.RepeatedTest import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.Extensions @@ -623,7 +622,7 @@ internal class TelemetryEventHandlerTest { val internalTelemetryEvent = forge.anElementFrom( forge.getForgery(), forge.getForgery(), - forge.getForgery(), + forge.getForgery() ) val rawEvent = RumRawEvent.TelemetryEventWrapper(internalTelemetryEvent) val anotherEvent = rawEvent.copy() diff --git a/reliability/stub-core/src/main/kotlin/com/datadog/android/core/stub/StubInternalLogger.kt b/reliability/stub-core/src/main/kotlin/com/datadog/android/core/stub/StubInternalLogger.kt index b854ac6529..87737f7ea3 100644 --- a/reliability/stub-core/src/main/kotlin/com/datadog/android/core/stub/StubInternalLogger.kt +++ b/reliability/stub-core/src/main/kotlin/com/datadog/android/core/stub/StubInternalLogger.kt @@ -68,7 +68,7 @@ internal class StubInternalLogger : InternalLogger { apiUsageEvent: InternalTelemetryEvent.ApiUsage, samplingRate: Float ) { - println("AU [T]: ${apiUsageEvent::class.simpleName} | $samplingRate%") + println("${apiUsageEvent::class.simpleName} | $samplingRate%") apiUsageEvent.additionalProperties.log() }