Skip to content

Commit 16d5c4e

Browse files
committed
Redo plumbing for device arch and use semconv attribute name
1 parent 3b0de9a commit 16d5c4e

13 files changed

Lines changed: 36 additions & 22 deletions

File tree

embrace-android-config/src/main/kotlin/io/embrace/android/embracesdk/internal/config/ConfigServiceImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ConfigServiceImpl(
4646
private val serializer: PlatformSerializer,
4747
store: KeyValueStore,
4848
okHttpClient: Lazy<OkHttpClient>,
49-
abis: Array<String>,
49+
architecture: String,
5050
private val sdkVersion: String,
5151
private val apiLevel: Int,
5252
private val filesDir: File,
@@ -156,7 +156,7 @@ class ConfigServiceImpl(
156156
AppFramework.fromString(it)
157157
} ?: AppFramework.NATIVE
158158

159-
override val cpuAbi: CpuAbi = CpuAbi.current(abis)
159+
override val cpuAbi: CpuAbi = CpuAbi.fromArchName(architecture)
160160

161161
override val nativeSymbolMap: Map<String, String>? by lazy {
162162
getNativeSymbols()?.let {

embrace-android-config/src/main/kotlin/io/embrace/android/embracesdk/internal/config/CpuAbi.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
package io.embrace.android.embracesdk.internal.config
22

3-
enum class CpuAbi(
4-
val archName: String,
5-
val is32BitDevice: Boolean,
6-
) {
3+
enum class CpuAbi(val archName: String) {
74

8-
ARMEABI_V7A("armeabi-v7a", true),
9-
ARM64_V8A("arm64-v8a", false),
10-
X86("x86", true),
11-
X86_64("x86_64", false),
12-
UNKNOWN("unknown", false),
5+
ARMEABI_V7A("armeabi-v7a"),
6+
ARM64_V8A("arm64-v8a"),
7+
X86("x86"),
8+
X86_64("x86_64"),
9+
UNKNOWN("unknown"),
1310
;
1411

1512
companion object {
16-
fun current(abis: Array<String>) = fromArchName(abis[0])
17-
1813
fun fromArchName(abi: String): CpuAbi {
1914
return CpuAbi.entries.find { it.archName == abi } ?: UNKNOWN
2015
}

embrace-android-config/src/test/kotlin/io/embrace/android/embracesdk/internal/config/ConfigServiceImplTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ internal class ConfigServiceImplTest {
116116
serializer = serializer,
117117
store = FakeKeyValueStore(),
118118
okHttpClient = lazyOf(okHttpClient),
119-
abis = arrayOf("arm64-v8a"),
119+
architecture = "arm64-v8a",
120120
sdkVersion = "1.2.3",
121121
apiLevel = 36,
122122
filesDir = Files.createTempDirectory("tmp").toFile(),

embrace-android-config/src/test/kotlin/io/embrace/android/embracesdk/internal/config/NativeSymbolTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class NativeSymbolTest {
8080
serializer = serializer,
8181
store = FakeKeyValueStore(),
8282
okHttpClient = lazyOf(okHttpClient),
83-
abis = arrayOf(arch),
83+
architecture = arch,
8484
sdkVersion = "1.2.3",
8585
apiLevel = 36,
8686
filesDir = Files.createTempDirectory("tmp").toFile(),

embrace-android-envelope/src/main/kotlin/io/embrace/android/embracesdk/internal/envelope/resource/EnvelopeResourceSourceImpl.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class EnvelopeResourceSourceImpl(
3939
putValue("disk_total_capacity", device.internalStorageTotalCapacity.value)
4040
putValue("screen_resolution", device.screenResolution)
4141
putValue("num_cores", device.numberOfCores)
42-
putValue("device_architecture", configService.cpuAbi.archName)
4342
putValue("environment", environment.value)
4443

4544
// attributes set by hosted SDKs or other parts of the SDK that are not always present

embrace-android-otel/src/main/kotlin/io/embrace/android/embracesdk/internal/otel/config/OtelSdkConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import io.opentelemetry.kotlin.logging.export.LogRecordExporter
1515
import io.opentelemetry.kotlin.logging.export.LogRecordProcessor
1616
import io.opentelemetry.kotlin.semconv.AndroidAttributes
1717
import io.opentelemetry.kotlin.semconv.DeviceAttributes
18+
import io.opentelemetry.kotlin.semconv.HostAttributes
1819
import io.opentelemetry.kotlin.semconv.OsAttributes
1920
import io.opentelemetry.kotlin.semconv.ServiceAttributes
2021
import io.opentelemetry.kotlin.semconv.TelemetryAttributes
@@ -80,6 +81,7 @@ class OtelSdkConfig(
8081
put(OsAttributes.OS_TYPE, systemInfo.osType)
8182
put(OsAttributes.OS_BUILD_ID, systemInfo.osBuild)
8283
put(AndroidAttributes.ANDROID_OS_API_LEVEL, systemInfo.androidOsApiLevel)
84+
put(HostAttributes.HOST_ARCH, systemInfo.architecture)
8385
put(DeviceAttributes.DEVICE_MANUFACTURER, systemInfo.deviceManufacturer)
8486
put(DeviceAttributes.DEVICE_MODEL_IDENTIFIER, systemInfo.deviceModel)
8587
put(DeviceAttributes.DEVICE_MODEL_NAME, systemInfo.deviceModel)

embrace-android-otel/src/test/kotlin/io/embrace/android/embracesdk/internal/otel/config/OtelSdkConfigTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import io.embrace.android.embracesdk.internal.otel.logs.LogSinkImpl
66
import io.embrace.android.embracesdk.internal.otel.spans.SpanRepository
77
import io.opentelemetry.kotlin.semconv.AndroidAttributes
88
import io.opentelemetry.kotlin.semconv.DeviceAttributes
9+
import io.opentelemetry.kotlin.semconv.HostAttributes
910
import io.opentelemetry.kotlin.semconv.OsAttributes
1011
import io.opentelemetry.kotlin.semconv.ServiceAttributes
1112
import io.opentelemetry.kotlin.semconv.TelemetryAttributes
@@ -25,6 +26,7 @@ internal class OtelSdkConfigTest {
2526
androidOsApiLevel = "99",
2627
deviceManufacturer = "testManufacturer",
2728
deviceModel = "testModel",
29+
architecture = "arm64-v8a",
2830
)
2931

3032
val configuration = OtelSdkConfig(
@@ -48,6 +50,7 @@ internal class OtelSdkConfigTest {
4850
OsAttributes.OS_TYPE to systemInfo.osType,
4951
OsAttributes.OS_BUILD_ID to systemInfo.osBuild,
5052
AndroidAttributes.ANDROID_OS_API_LEVEL to systemInfo.androidOsApiLevel,
53+
HostAttributes.HOST_ARCH to systemInfo.architecture,
5154
DeviceAttributes.DEVICE_MANUFACTURER to systemInfo.deviceManufacturer,
5255
DeviceAttributes.DEVICE_MODEL_IDENTIFIER to systemInfo.deviceModel,
5356
DeviceAttributes.DEVICE_MODEL_NAME to systemInfo.deviceModel,

embrace-android-payload/src/test/kotlin/io/embrace/android/embracesdk/internal/serialization/EnvelopeResourceSerializerTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal class EnvelopeResourceSerializerTest {
1717
"app_framework" to EnvelopeResourceValue.of(AppFramework.NATIVE.value.toLong()),
1818
"build_id" to EnvelopeResourceValue.of("abc123"),
1919
"emb.app.environment" to EnvelopeResourceValue.of("prod"),
20-
"device_architecture" to EnvelopeResourceValue.of("arm64-v8a"),
20+
"host.arch" to EnvelopeResourceValue.of("arm64-v8a"),
2121
"os.version" to EnvelopeResourceValue.of("13"),
2222
"jailbroken" to EnvelopeResourceValue.of(false),
2323
"disk_total_capacity" to EnvelopeResourceValue.of(64000000000L),

embrace-android-payload/src/test/resources/envelope_resource_full.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"app_framework": 1,
55
"build_id": "abc123",
66
"emb.app.environment": "prod",
7-
"device_architecture": "arm64-v8a",
7+
"host.arch": "arm64-v8a",
88
"os.version": "13",
99
"jailbroken": false,
1010
"disk_total_capacity": 64000000000,

embrace-android-sdk/src/integrationTest/kotlin/io/embrace/android/embracesdk/testframework/actions/EmbraceSetupInterface.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ internal class EmbraceSetupInterface(
125125
apiLevel = Build.VERSION.SDK_INT,
126126
filesDir = coreModule.context.filesDir,
127127
store = coreModule.store,
128-
abis = Build.SUPPORTED_ABIS,
128+
architecture = initModule.systemInfo.architecture,
129129
logger = initModule.logger,
130130
uuidSource = initModule.uuidSource,
131131
)

0 commit comments

Comments
 (0)