Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sending CPU architecture as part of device info #1000

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dd-sdk-android/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ data class com.datadog.android.rum.model.ActionEvent
companion object
fun fromJson(kotlin.String): Os
data class Device
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): Device
Expand Down Expand Up @@ -622,7 +622,7 @@ data class com.datadog.android.rum.model.ErrorEvent
companion object
fun fromJson(kotlin.String): Os
data class Device
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): Device
Expand Down Expand Up @@ -833,7 +833,7 @@ data class com.datadog.android.rum.model.LongTaskEvent
companion object
fun fromJson(kotlin.String): Os
data class Device
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): Device
Expand Down Expand Up @@ -974,7 +974,7 @@ data class com.datadog.android.rum.model.ResourceEvent
companion object
fun fromJson(kotlin.String): Os
data class Device
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): Device
Expand Down Expand Up @@ -1196,7 +1196,7 @@ data class com.datadog.android.rum.model.ViewEvent
companion object
fun fromJson(kotlin.String): Os
data class Device
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
constructor(DeviceType, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null)
fun toJson(): com.google.gson.JsonElement
companion object
fun fromJson(kotlin.String): Device
Expand Down
5 changes: 5 additions & 0 deletions dd-sdk-android/src/main/json/rum/_common-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@
"type": "string",
"description": "Device marketing brand, e.g. Apple, OPPO, Xiaomi, etc.",
"readOnly": true
},
"architecture": {
"type": "string",
"description": "The CPU architecture of the device that is reporting the error",
"readOnly": true
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ internal interface AndroidInfoProvider {
val osMajorVersion: String

val osVersion: String

val architecture: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ internal class DefaultAndroidInfoProvider(
return osVersion.split('.').first()
}

override val architecture: String
get() {
return System.getProperty("os.arch") ?: "unknown"
}

companion object {

const val FEATURE_GOOGLE_ANDROID_TV = "com.google.android.tv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ internal class NoOpAndroidInfoProvider : AndroidInfoProvider {
override val osName: String = ""
override val osMajorVersion: String = ""
override val osVersion: String = ""
override val architecture: String = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ internal class RumActionScope(
type = androidInfoProvider.deviceType.toActionSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
context = ActionEvent.Context(additionalProperties = attributes),
dd = ActionEvent.Dd(session = ActionEvent.DdSession(plan = ActionEvent.Plan.PLAN_1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ internal class RumResourceScope(
type = androidInfoProvider.deviceType.toResourceSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
context = ResourceEvent.Context(additionalProperties = attributes),
dd = ResourceEvent.Dd(
Expand Down Expand Up @@ -308,7 +309,8 @@ internal class RumResourceScope(
type = androidInfoProvider.deviceType.toErrorSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
context = ErrorEvent.Context(additionalProperties = attributes),
dd = ErrorEvent.Dd(session = ErrorEvent.DdSession(plan = ErrorEvent.Plan.PLAN_1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ internal open class RumViewScope(
type = androidInfoProvider.deviceType.toErrorSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
context = ErrorEvent.Context(additionalProperties = updatedAttributes),
dd = ErrorEvent.Dd(session = ErrorEvent.DdSession(plan = ErrorEvent.Plan.PLAN_1))
Expand Down Expand Up @@ -607,7 +608,8 @@ internal open class RumViewScope(
type = androidInfoProvider.deviceType.toViewSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
context = ViewEvent.Context(additionalProperties = attributes),
dd = ViewEvent.Dd(
Expand Down Expand Up @@ -703,7 +705,8 @@ internal open class RumViewScope(
type = androidInfoProvider.deviceType.toActionSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
context = ActionEvent.Context(additionalProperties = GlobalRum.globalAttributes),
dd = ActionEvent.Dd(session = ActionEvent.DdSession(ActionEvent.Plan.PLAN_1))
Expand Down Expand Up @@ -763,7 +766,8 @@ internal open class RumViewScope(
type = androidInfoProvider.deviceType.toLongTaskSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
context = LongTaskEvent.Context(additionalProperties = updatedAttributes),
dd = LongTaskEvent.Dd(session = LongTaskEvent.DdSession(LongTaskEvent.Plan.PLAN_1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ internal class DatadogNdkCrashHandler(
type = androidInfoProvider.deviceType.toErrorSchemaType(),
name = androidInfoProvider.deviceName,
model = androidInfoProvider.deviceModel,
brand = androidInfoProvider.deviceBrand
brand = androidInfoProvider.deviceBrand,
architecture = androidInfoProvider.architecture
),
dd = ErrorEvent.Dd(session = ErrorEvent.DdSession(plan = ErrorEvent.Plan.PLAN_1)),
context = ErrorEvent.Context(additionalProperties = additionalProperties),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ internal class ActionEventAssert(actual: ActionEvent) :
name: String,
model: String,
brand: String,
type: ActionEvent.DeviceType
type: ActionEvent.DeviceType,
architecture: String
): ActionEventAssert {
assertThat(actual.device?.name)
.overridingErrorMessage(
Expand All @@ -314,6 +315,12 @@ internal class ActionEventAssert(actual: ActionEvent) :
"Expected event data to have device.type $type but was ${actual.device?.type}"
)
.isEqualTo(type)
assertThat(actual.device?.architecture)
.overridingErrorMessage(
"Expected event data to have device.architecture $architecture" +
" but was ${actual.device?.architecture}"
)
.isEqualTo(architecture)
return this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ internal class ErrorEventAssert(actual: ErrorEvent) :
name: String,
model: String,
brand: String,
type: ErrorEvent.DeviceType
type: ErrorEvent.DeviceType,
architecture: String
): ErrorEventAssert {
assertThat(actual.device?.name)
.overridingErrorMessage(
Expand All @@ -389,6 +390,12 @@ internal class ErrorEventAssert(actual: ErrorEvent) :
"Expected event data to have device.type $type but was ${actual.device?.type}"
)
.isEqualTo(type)
assertThat(actual.device?.architecture)
.overridingErrorMessage(
"Expected event data to have device.architecture $architecture" +
" but was ${actual.device?.architecture}"
)
.isEqualTo(architecture)
return this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ internal class LongTaskEventAssert(actual: LongTaskEvent) :
name: String,
model: String,
brand: String,
type: LongTaskEvent.DeviceType
type: LongTaskEvent.DeviceType,
architecture: String
): LongTaskEventAssert {
assertThat(actual.device?.name)
.overridingErrorMessage(
Expand All @@ -234,6 +235,12 @@ internal class LongTaskEventAssert(actual: LongTaskEvent) :
"Expected event data to have device.type $type but was ${actual.device?.type}"
)
.isEqualTo(type)
assertThat(actual.device?.architecture)
.overridingErrorMessage(
"Expected event data to have device.architecture $architecture" +
" but was ${actual.device?.architecture}"
)
.isEqualTo(architecture)
return this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ internal class ResourceEventAssert(actual: ResourceEvent) :
name: String,
model: String,
brand: String,
type: ResourceEvent.DeviceType
type: ResourceEvent.DeviceType,
architecture: String
): ResourceEventAssert {
assertThat(actual.device?.name)
.overridingErrorMessage(
Expand All @@ -487,6 +488,12 @@ internal class ResourceEventAssert(actual: ResourceEvent) :
"Expected event data to have device.type $type but was ${actual.device?.type}"
)
.isEqualTo(type)
assertThat(actual.device?.architecture)
.overridingErrorMessage(
"Expected event data to have device.architecture $architecture" +
" but was ${actual.device?.architecture}"
)
.isEqualTo(architecture)
return this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ internal class ViewEventAssert(actual: ViewEvent) :
name: String,
model: String,
brand: String,
type: ViewEvent.DeviceType
type: ViewEvent.DeviceType,
architecture: String
): ViewEventAssert {
assertThat(actual.device?.name)
.overridingErrorMessage(
Expand All @@ -434,6 +435,12 @@ internal class ViewEventAssert(actual: ViewEvent) :
"Expected event data to have device.type $type but was ${actual.device?.type}"
)
.isEqualTo(type)
assertThat(actual.device?.architecture)
.overridingErrorMessage(
"Expected event data to have device.architecture $architecture" +
" but was ${actual.device?.architecture}"
)
.isEqualTo(architecture)
return this
}

Expand Down
Loading