diff --git a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/IntegrationTestRuleExtensions.kt b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/IntegrationTestRuleExtensions.kt index 8bb96cd5c9..2fc236e106 100644 --- a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/IntegrationTestRuleExtensions.kt +++ b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/IntegrationTestRuleExtensions.kt @@ -211,7 +211,6 @@ internal fun verifySessionHappened(message: SessionMessage) { internal fun verifySessionMessage(sessionMessage: SessionMessage) { assertNotNull(sessionMessage.session) - assertNotNull(sessionMessage.appInfo) assertNotNull(sessionMessage.deviceInfo) if (sessionMessage.session.messageType == "en") { @@ -226,7 +225,6 @@ internal fun verifyBgActivityHappened(message: SessionMessage) { internal fun verifyBgActivityMessage(message: SessionMessage) { assertNotNull(message.session) - assertNotNull(message.appInfo) assertNotNull(message.deviceInfo) if (message.session.messageType == "en") { diff --git a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/SpanAssertions.kt b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/SpanAssertions.kt index 731119ae6e..e7347978bc 100644 --- a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/SpanAssertions.kt +++ b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/SpanAssertions.kt @@ -3,6 +3,7 @@ package io.embrace.android.embracesdk import io.embrace.android.embracesdk.arch.schema.EmbType import io.embrace.android.embracesdk.arch.schema.TelemetryType import io.embrace.android.embracesdk.internal.payload.Log +import io.embrace.android.embracesdk.internal.payload.Span import io.embrace.android.embracesdk.internal.spans.EmbraceSpanData import io.embrace.android.embracesdk.internal.spans.hasFixedAttribute import io.embrace.android.embracesdk.payload.SessionMessage @@ -33,6 +34,15 @@ internal fun EmbraceSpanData.findSpanAttribute(key: String): String = "Attribute not found: $key" } + +/** + * Finds the span attribute matching the name. + */ +internal fun Span.findSpanAttribute(key: String): String = + checkNotNull(attributes?.singleOrNull { it.key == key }?.data) { + "Attribute not found: $key" + } + /** * Finds the event attribute matching the name. */ @@ -75,6 +85,15 @@ internal fun SessionMessage.findSpansOfType(telemetryType: TelemetryType): List< "Spans of type not found: ${telemetryType.key}" } +/** + * Finds the span matching the given [TelemetryType]. + */ +internal fun SessionMessage.findSpansByName(name: String): List { + return checkNotNull(data?.spans?.filter { it.name == name }) { + "Spans not found named: $name" + } +} + internal fun SessionMessage.findSpanSnapshotsOfType(telemetryType: TelemetryType): List = checkNotNull(spanSnapshots?.filter { it.hasFixedAttribute(telemetryType) }) { "Span snapshots of type not found: ${telemetryType.key}" diff --git a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/FlutterInternalInterfaceTest.kt b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/FlutterInternalInterfaceTest.kt index 4d372bce5a..2af762f48f 100644 --- a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/FlutterInternalInterfaceTest.kt +++ b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/FlutterInternalInterfaceTest.kt @@ -7,11 +7,13 @@ import io.embrace.android.embracesdk.IntegrationTestRule import io.embrace.android.embracesdk.LogExceptionType import io.embrace.android.embracesdk.assertions.assertOtelLogReceived import io.embrace.android.embracesdk.fakes.FakeClock +import io.embrace.android.embracesdk.fakes.fakeV2OtelBehavior import io.embrace.android.embracesdk.fakes.injection.FakeInitModule import io.embrace.android.embracesdk.fakes.injection.FakeWorkerThreadModule import io.embrace.android.embracesdk.findLogAttribute import io.embrace.android.embracesdk.getLastSentLog import io.embrace.android.embracesdk.internal.ApkToolsConfig +import io.embrace.android.embracesdk.internal.payload.EnvelopeResource import io.embrace.android.embracesdk.recordSession import io.embrace.android.embracesdk.worker.WorkerName import io.opentelemetry.api.logs.Severity @@ -38,8 +40,8 @@ internal class FlutterInternalInterfaceTest { appFramework = Embrace.AppFramework.FLUTTER, overriddenClock = clock, overriddenInitModule = fakeInitModule, - overriddenWorkerThreadModule = FakeWorkerThreadModule(fakeInitModule = fakeInitModule, name = WorkerName.REMOTE_LOGGING) - ) + overriddenWorkerThreadModule = FakeWorkerThreadModule(fakeInitModule = fakeInitModule, name = WorkerName.REMOTE_LOGGING), + ).apply { overriddenConfigService.oTelBehavior = fakeV2OtelBehavior() } } @Before @@ -50,13 +52,11 @@ internal class FlutterInternalInterfaceTest { @Test fun `flutter without values should return defaults`() { with(testRule) { - val session = harness.recordSession { - - } - - assertEquals(4, session?.appInfo?.appFramework) - assertNull(session?.appInfo?.hostedSdkVersion) - assertNull(session?.appInfo?.hostedPlatformVersion) + val session = harness.recordSession() + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.FLUTTER, res.appFramework) + assertNull(res.hostedSdkVersion) + assertNull(res.hostedPlatformVersion) } } @@ -68,9 +68,10 @@ internal class FlutterInternalInterfaceTest { embrace.flutterInternalInterface?.setEmbraceFlutterSdkVersion("1.2.3") } - assertEquals(4, session?.appInfo?.appFramework) - assertEquals("28.9.1", checkNotNull(session?.appInfo?.hostedPlatformVersion)) - assertEquals("1.2.3", checkNotNull(session?.appInfo?.hostedSdkVersion)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.FLUTTER, res.appFramework) + assertEquals("28.9.1", res.hostedPlatformVersion) + assertEquals("1.2.3", res.hostedSdkVersion) } } @@ -86,9 +87,10 @@ internal class FlutterInternalInterfaceTest { } - assertEquals(4, session?.appInfo?.appFramework) - assertEquals("28.9.1", checkNotNull(session?.appInfo?.hostedPlatformVersion)) - assertEquals("1.2.3", checkNotNull(session?.appInfo?.hostedSdkVersion)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.FLUTTER, res.appFramework) + assertEquals("28.9.1", res.hostedPlatformVersion) + assertEquals("1.2.3", res.hostedSdkVersion) } } @@ -105,9 +107,10 @@ internal class FlutterInternalInterfaceTest { embrace.flutterInternalInterface?.setEmbraceFlutterSdkVersion(null) } - assertEquals(4, session?.appInfo?.appFramework) - assertEquals("28.9.1", checkNotNull(session?.appInfo?.hostedPlatformVersion)) - assertEquals("1.2.3", checkNotNull(session?.appInfo?.hostedSdkVersion)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.FLUTTER, res.appFramework) + assertEquals("28.9.1", res.hostedPlatformVersion) + assertEquals("1.2.3", res.hostedSdkVersion) } } @@ -124,9 +127,10 @@ internal class FlutterInternalInterfaceTest { embrace.flutterInternalInterface?.setEmbraceFlutterSdkVersion("1.2.4") } - assertEquals(4, session?.appInfo?.appFramework) - assertEquals("28.9.2", checkNotNull(session?.appInfo?.hostedPlatformVersion)) - assertEquals("1.2.4", checkNotNull(session?.appInfo?.hostedSdkVersion)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.FLUTTER, res.appFramework) + assertEquals("28.9.2", res.hostedPlatformVersion) + assertEquals("1.2.4", res.hostedSdkVersion) } } diff --git a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/ReactNativeInternalInterfaceTest.kt b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/ReactNativeInternalInterfaceTest.kt index 5550513d17..982e9328c0 100644 --- a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/ReactNativeInternalInterfaceTest.kt +++ b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/ReactNativeInternalInterfaceTest.kt @@ -1,5 +1,3 @@ -@file:Suppress("DEPRECATION") - package io.embrace.android.embracesdk.testcases import android.os.Build @@ -7,10 +5,13 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import io.embrace.android.embracesdk.Embrace import io.embrace.android.embracesdk.IntegrationTestRule import io.embrace.android.embracesdk.arch.schema.EmbType +import io.embrace.android.embracesdk.fakes.fakeV2OtelBehavior import io.embrace.android.embracesdk.findSpanAttribute +import io.embrace.android.embracesdk.findSpansByName import io.embrace.android.embracesdk.findSpansOfType import io.embrace.android.embracesdk.internal.ApkToolsConfig import io.embrace.android.embracesdk.internal.clock.nanosToMillis +import io.embrace.android.embracesdk.internal.payload.EnvelopeResource import io.embrace.android.embracesdk.recordSession import org.junit.Assert.assertEquals import org.junit.Assert.assertNull @@ -30,7 +31,9 @@ internal class ReactNativeInternalInterfaceTest { @JvmField val testRule: IntegrationTestRule = IntegrationTestRule( harnessSupplier = { - IntegrationTestRule.Harness(appFramework = Embrace.AppFramework.REACT_NATIVE) + IntegrationTestRule.Harness(appFramework = Embrace.AppFramework.REACT_NATIVE).apply { + overriddenConfigService.oTelBehavior = fakeV2OtelBehavior() + } } ) @@ -46,10 +49,10 @@ internal class ReactNativeInternalInterfaceTest { } - assertEquals(2, session?.appInfo?.appFramework) - assertNull(session?.appInfo?.reactNativeVersion) - assertNull(session?.appInfo?.hostedSdkVersion) - assertNull(session?.appInfo?.javaScriptPatchNumber) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.REACT_NATIVE, res.appFramework) + assertNull(res.hostedPlatformVersion) + assertNull(res.javascriptPatchNumber) } } @@ -62,10 +65,11 @@ internal class ReactNativeInternalInterfaceTest { embrace.reactNativeInternalInterface?.setJavaScriptPatchNumber("666") } - assertEquals(2, session?.appInfo?.appFramework) - assertEquals("28.9.1", checkNotNull(session?.appInfo?.reactNativeVersion)) - assertEquals("1.2.3", checkNotNull(session?.appInfo?.hostedSdkVersion)) - assertEquals("666", checkNotNull(session?.appInfo?.javaScriptPatchNumber)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.REACT_NATIVE, res.appFramework) + assertEquals("28.9.1", res.hostedPlatformVersion) + assertEquals("1.2.3", res.hostedSdkVersion) + assertEquals("666", res.javascriptPatchNumber) } } @@ -82,10 +86,11 @@ internal class ReactNativeInternalInterfaceTest { } - assertEquals(2, session?.appInfo?.appFramework) - assertEquals("28.9.1", checkNotNull(session?.appInfo?.reactNativeVersion)) - assertEquals("1.2.3", checkNotNull(session?.appInfo?.hostedSdkVersion)) - assertEquals("666", checkNotNull(session?.appInfo?.javaScriptPatchNumber)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.REACT_NATIVE, res.appFramework) + assertEquals("28.9.1", res.hostedPlatformVersion) + assertEquals("1.2.3", res.hostedSdkVersion) + assertEquals("666", res.javascriptPatchNumber) } } @@ -104,10 +109,11 @@ internal class ReactNativeInternalInterfaceTest { embrace.reactNativeInternalInterface?.setJavaScriptPatchNumber("999") } - assertEquals(2, session?.appInfo?.appFramework) - assertEquals("28.9.2", checkNotNull(session?.appInfo?.reactNativeVersion)) - assertEquals("1.2.4", checkNotNull(session?.appInfo?.hostedSdkVersion)) - assertEquals("999", checkNotNull(session?.appInfo?.javaScriptPatchNumber)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.REACT_NATIVE, res.appFramework) + assertEquals("28.9.2", res.hostedPlatformVersion) + assertEquals("1.2.4", res.hostedSdkVersion) + assertEquals("999", res.javascriptPatchNumber) } } @@ -125,21 +131,18 @@ internal class ReactNativeInternalInterfaceTest { ) }) - val spans = message.findSpansOfType(EmbType.System.ReactNativeAction) - + val spans = message.findSpansByName("emb-rn-action") assertEquals(1, spans.size) val span = spans.single() - assertEquals("emb-rn-action", span.name) assertEquals("sys.rn_action", span.findSpanAttribute("emb.type")) assertEquals("MyAction", span.findSpanAttribute("name")) assertEquals("SUCCESS", span.findSpanAttribute("outcome")) assertEquals("100", span.findSpanAttribute("payload_size")) assertEquals("value", span.findSpanAttribute("emb.properties.key")) - assertEquals(1000, span.startTimeNanos.nanosToMillis()) - assertEquals(5000, span.endTimeNanos.nanosToMillis()) - + assertEquals(1000L, span.startTimeUnixNano?.nanosToMillis()) + assertEquals(5000L, span.endTimeUnixNano?.nanosToMillis()) } } } \ No newline at end of file diff --git a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/UnityInternalInterfaceTest.kt b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/UnityInternalInterfaceTest.kt index e1b5b77d74..f620102595 100644 --- a/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/UnityInternalInterfaceTest.kt +++ b/embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testcases/UnityInternalInterfaceTest.kt @@ -1,12 +1,12 @@ -@file:Suppress("DEPRECATION") - package io.embrace.android.embracesdk.testcases import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import io.embrace.android.embracesdk.Embrace import io.embrace.android.embracesdk.IntegrationTestRule +import io.embrace.android.embracesdk.fakes.fakeV2OtelBehavior import io.embrace.android.embracesdk.internal.ApkToolsConfig +import io.embrace.android.embracesdk.internal.payload.EnvelopeResource import io.embrace.android.embracesdk.recordSession import org.junit.Assert.assertEquals import org.junit.Assert.assertNull @@ -26,7 +26,9 @@ internal class UnityInternalInterfaceTest { @JvmField val testRule: IntegrationTestRule = IntegrationTestRule( harnessSupplier = { - IntegrationTestRule.Harness(appFramework = Embrace.AppFramework.UNITY) + IntegrationTestRule.Harness(appFramework = Embrace.AppFramework.UNITY).apply { + overriddenConfigService.oTelBehavior = fakeV2OtelBehavior() + } } ) @@ -42,9 +44,10 @@ internal class UnityInternalInterfaceTest { } - assertEquals(3, session?.appInfo?.appFramework) - assertNull(session?.appInfo?.hostedSdkVersion) - assertNull(session?.appInfo?.hostedPlatformVersion) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.UNITY, res.appFramework) + assertNull(res.hostedSdkVersion) + assertNull(res.hostedPlatformVersion) } } @@ -55,10 +58,11 @@ internal class UnityInternalInterfaceTest { embrace.unityInternalInterface?.setUnityMetaData("28.9.1", "unity build id", "1.2.3") } - assertEquals(3, session?.appInfo?.appFramework) - assertEquals("28.9.1", checkNotNull(session?.appInfo?.hostedPlatformVersion)) - assertEquals("1.2.3", checkNotNull(session?.appInfo?.hostedSdkVersion)) - assertEquals("unity build id", checkNotNull(session?.appInfo?.buildGuid)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.UNITY, res.appFramework) + assertEquals("28.9.1", res.hostedPlatformVersion) + assertEquals("1.2.3", res.hostedSdkVersion) + assertEquals("unity build id", res.unityBuildId) } } @@ -73,10 +77,11 @@ internal class UnityInternalInterfaceTest { } - assertEquals(3, session?.appInfo?.appFramework) - assertEquals("28.9.1", checkNotNull(session?.appInfo?.hostedPlatformVersion)) - assertEquals("1.2.3", checkNotNull(session?.appInfo?.hostedSdkVersion)) - assertEquals("unity build id", checkNotNull(session?.appInfo?.buildGuid)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.UNITY, res.appFramework) + assertEquals("28.9.1", res.hostedPlatformVersion) + assertEquals("1.2.3", res.hostedSdkVersion) + assertEquals("unity build id", res.unityBuildId) } } @@ -91,10 +96,11 @@ internal class UnityInternalInterfaceTest { embrace.unityInternalInterface?.setUnityMetaData("28.9.2", "new unity build id", "1.2.4") } - assertEquals(3, session?.appInfo?.appFramework) - assertEquals("28.9.2", checkNotNull(session?.appInfo?.hostedPlatformVersion)) - assertEquals("1.2.4", checkNotNull(session?.appInfo?.hostedSdkVersion)) - assertEquals("new unity build id", checkNotNull(session?.appInfo?.buildGuid)) + val res = checkNotNull(session?.resource) + assertEquals(EnvelopeResource.AppFramework.UNITY, res.appFramework) + assertEquals("28.9.2", res.hostedPlatformVersion) + assertEquals("1.2.4", res.hostedSdkVersion) + assertEquals("new unity build id", res.unityBuildId) } } } \ No newline at end of file diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/SessionMessage.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/SessionMessage.kt index 2c2917ad0b..f9d640ac82 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/SessionMessage.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/payload/SessionMessage.kt @@ -20,12 +20,6 @@ internal data class SessionMessage @JvmOverloads internal constructor( @Json(name = "s") val session: Session, - /** - * The app information. - */ - @Json(name = "a") - val appInfo: AppInfo? = null, - /** * The device information. */ diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V1PayloadMessageCollator.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V1PayloadMessageCollator.kt index b425294573..9cc0e538d6 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V1PayloadMessageCollator.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V1PayloadMessageCollator.kt @@ -163,6 +163,7 @@ internal class V1PayloadMessageCollator( } spans } + else -> spanSink.completedSpans() } // add ANR spans if the payload is capturing spans. @@ -176,7 +177,6 @@ internal class V1PayloadMessageCollator( return SessionMessage( session = finalPayload, - appInfo = captureDataSafely(logger, metadataService::getAppInfo), deviceInfo = captureDataSafely(logger, metadataService::getDeviceInfo), performanceInfo = captureDataSafely(logger) { performanceInfoService.getSessionPerformanceInfo( diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollator.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollator.kt index 90e5988940..9657320cae 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollator.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollator.kt @@ -184,7 +184,6 @@ internal class V2PayloadMessageCollator( return SessionMessage( session = finalPayload, - appInfo = captureDataSafely(logger, metadataService::getAppInfo), deviceInfo = captureDataSafely(logger, metadataService::getDeviceInfo), performanceInfo = captureDataSafely(logger) { performanceInfoService.getSessionPerformanceInfo( diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/FakeBackgroundActivity.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/FakeBackgroundActivity.kt index 11e2f9c3d1..92a43ec169 100644 --- a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/FakeBackgroundActivity.kt +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/FakeBackgroundActivity.kt @@ -1,8 +1,8 @@ package io.embrace.android.embracesdk import io.embrace.android.embracesdk.internal.payload.EnvelopeMetadata +import io.embrace.android.embracesdk.internal.payload.EnvelopeResource import io.embrace.android.embracesdk.internal.spans.EmbraceSpanData -import io.embrace.android.embracesdk.payload.AppInfo import io.embrace.android.embracesdk.payload.DeviceInfo import io.embrace.android.embracesdk.payload.DiskUsage import io.embrace.android.embracesdk.payload.PerformanceInfo @@ -12,19 +12,20 @@ import io.opentelemetry.api.trace.StatusCode internal fun fakeBackgroundActivityMessage(): SessionMessage { val backgroundActivity = fakeBackgroundActivity() - val appInfo = AppInfo("fake-app-id") val deviceInfo = DeviceInfo("fake-manufacturer") val spans = listOf(EmbraceSpanData("fake-span-id", "", "", "", 0, 0, StatusCode.OK)) val perfInfo = PerformanceInfo(DiskUsage(1, 2)) return SessionMessage( backgroundActivity, - appInfo, deviceInfo, perfInfo, spans, metadata = EnvelopeMetadata( userId = "fake-user-id" + ), + resource = EnvelopeResource( + appVersion = "fake-app-id" ) ) } diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/SessionSanitizerFacadeTest.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/SessionSanitizerFacadeTest.kt index e0e88a7073..cf46539664 100644 --- a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/SessionSanitizerFacadeTest.kt +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/SessionSanitizerFacadeTest.kt @@ -5,7 +5,6 @@ import io.embrace.android.embracesdk.fakes.fakeSession import io.embrace.android.embracesdk.gating.SessionGatingKeys import io.embrace.android.embracesdk.gating.SessionSanitizerFacade import io.embrace.android.embracesdk.internal.payload.EnvelopeMetadata -import io.embrace.android.embracesdk.payload.AppInfo import io.embrace.android.embracesdk.payload.DeviceInfo import io.embrace.android.embracesdk.payload.Orientation import io.embrace.android.embracesdk.payload.SessionMessage @@ -33,7 +32,6 @@ internal class SessionSanitizerFacadeTest { private val sessionMessage = SessionMessage( session = session, - appInfo = AppInfo(), deviceInfo = DeviceInfo(), performanceInfo = sessionPerformanceInfo, metadata = EnvelopeMetadata( @@ -84,7 +82,6 @@ internal class SessionSanitizerFacadeTest { assertNotNull(sanitizedMessage.performanceInfo?.diskUsage) - assertNotNull(sanitizedMessage.appInfo) assertNotNull(sanitizedMessage.deviceInfo) } @@ -110,7 +107,6 @@ internal class SessionSanitizerFacadeTest { assertNull(sanitizedMessage.performanceInfo?.diskUsage) - assertNotNull(sanitizedMessage.appInfo) assertNotNull(sanitizedMessage.deviceInfo) } } diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/fakes/FakeV2OtelBehavior.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/fakes/FakeV2OtelBehavior.kt new file mode 100644 index 0000000000..d34164fed2 --- /dev/null +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/fakes/FakeV2OtelBehavior.kt @@ -0,0 +1,8 @@ +package io.embrace.android.embracesdk.fakes + +import io.embrace.android.embracesdk.config.remote.OTelRemoteConfig +import io.embrace.android.embracesdk.config.remote.RemoteConfig + +internal fun fakeV2OtelBehavior() = fakeOTelBehavior { + RemoteConfig(oTelConfig = OTelRemoteConfig(isDevEnabled = true)) +} diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/BackgroundActivityMessageTest.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/BackgroundActivityMessageTest.kt index e10f5aec0a..3d5f6da46e 100644 --- a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/BackgroundActivityMessageTest.kt +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/BackgroundActivityMessageTest.kt @@ -14,14 +14,12 @@ import org.junit.Test internal class BackgroundActivityMessageTest { private val backgroundActivity = fakeBackgroundActivity() - private val appInfo = AppInfo("fake-app-id") private val deviceInfo = DeviceInfo("fake-manufacturer") private val spans = listOf(EmbraceSpanData("fake-span-id", "", "", "", 0, 0, StatusCode.OK)) private val perfInfo = PerformanceInfo(DiskUsage(1, 2)) private val info = SessionMessage( backgroundActivity, - appInfo, deviceInfo, perfInfo, spans @@ -38,7 +36,6 @@ internal class BackgroundActivityMessageTest { assertNotNull(obj) assertEquals(backgroundActivity.startTime, obj.session.startTime) - assertEquals(appInfo, obj.appInfo) assertEquals(deviceInfo, obj.deviceInfo) assertEquals(perfInfo, obj.performanceInfo) assertEquals(spans, obj.spans) diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/SessionMessageTest.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/SessionMessageTest.kt index 41a542f89c..e6cca54204 100644 --- a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/SessionMessageTest.kt +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/payload/SessionMessageTest.kt @@ -19,7 +19,6 @@ import org.junit.Test internal class SessionMessageTest { private val session = fakeSession() - private val appInfo = AppInfo("fake-app-version") private val deviceInfo = DeviceInfo("fake-manufacturer") private val performanceInfo = PerformanceInfo(DiskUsage(150923409L, 509209823L)) private val spans = listOf( @@ -39,7 +38,6 @@ internal class SessionMessageTest { private val info = SessionMessage( session, - appInfo, deviceInfo, performanceInfo, spans, @@ -56,7 +54,6 @@ internal class SessionMessageTest { val obj = deserializeJsonFromResource("session_message_expected.json") assertNotNull(obj) assertEquals(session, obj.session) - assertEquals(appInfo, obj.appInfo) assertEquals(deviceInfo, obj.deviceInfo) assertEquals(performanceInfo, obj.performanceInfo) assertEquals(spans, obj.spans) diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/V1PayloadMessageCollatorTest.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/V1PayloadMessageCollatorTest.kt index 3eceff71f1..1b844fef3d 100644 --- a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/V1PayloadMessageCollatorTest.kt +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/V1PayloadMessageCollatorTest.kt @@ -203,7 +203,6 @@ internal class V1PayloadMessageCollatorTest { private fun SessionMessage.verifyFinalFieldsPopulated( payloadType: PayloadType ) { - assertNotNull(appInfo) assertNotNull(deviceInfo) assertNotNull(performanceInfo) session.verifyInitialFieldsPopulated(payloadType) diff --git a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollatorTest.kt b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollatorTest.kt index 886f46d9cc..a1aa16f9bd 100644 --- a/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollatorTest.kt +++ b/embrace-android-sdk/src/test/java/io/embrace/android/embracesdk/session/message/V2PayloadMessageCollatorTest.kt @@ -177,7 +177,6 @@ internal class V2PayloadMessageCollatorTest { payloadType: PayloadType ) { assertNull(spans) - assertNotNull(appInfo) assertNotNull(deviceInfo) assertNotNull(performanceInfo) assertNotNull(resource) diff --git a/embrace-android-sdk/src/test/resources/bg_activity_message_expected.json b/embrace-android-sdk/src/test/resources/bg_activity_message_expected.json index 8e4c557178..f75ffd245a 100644 --- a/embrace-android-sdk/src/test/resources/bg_activity_message_expected.json +++ b/embrace-android-sdk/src/test/resources/bg_activity_message_expected.json @@ -8,9 +8,6 @@ "cs": false, "sm": "s" }, - "a": { - "v": "fake-app-id" - }, "d": { "dm": "fake-manufacturer" }, diff --git a/embrace-android-sdk/src/test/resources/session_message_expected.json b/embrace-android-sdk/src/test/resources/session_message_expected.json index 1ed7546684..e12881c6d3 100644 --- a/embrace-android-sdk/src/test/resources/session_message_expected.json +++ b/embrace-android-sdk/src/test/resources/session_message_expected.json @@ -9,9 +9,6 @@ "sm": "s", "sp": {} }, - "a": { - "v": "fake-app-version" - }, "d": { "dm": "fake-manufacturer" }, diff --git a/embrace-android-sdk/src/test/resources/v1_session_expected.json b/embrace-android-sdk/src/test/resources/v1_session_expected.json index 9313fd7e67..85e308a8d5 100644 --- a/embrace-android-sdk/src/test/resources/v1_session_expected.json +++ b/embrace-android-sdk/src/test/resources/v1_session_expected.json @@ -1,19 +1,4 @@ { - "a": { - "f": 1, - "vu": false, - "vul": false, - "v": "UNKNOWN", - "fl": "delicious", - "bi": "5.22.0", - "bt": "release", - "bv": "0", - "e": "dev", - "ou": false, - "oul": false, - "sdc": "53", - "sdk": "__EMBRACE_TEST_IGNORE__" - }, "d": "__EMBRACE_TEST_IGNORE__", "p": { "ds": {