Skip to content

Commit

Permalink
Merge pull request #1828 from DataDog/nogorodnikov/update-rum-schema-…
Browse files Browse the repository at this point in the history
…170123

Update RUM Schema
  • Loading branch information
0xnm committed Jan 17, 2024
2 parents 8c57aad + c29effe commit 3d5e3d6
Show file tree
Hide file tree
Showing 26 changed files with 896 additions and 465 deletions.
200 changes: 155 additions & 45 deletions features/dd-sdk-android-rum/api/apiSurface

Large diffs are not rendered by default.

1,034 changes: 656 additions & 378 deletions features/dd-sdk-android-rum/api/dd-sdk-android-rum.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"source": {
"type": "string",
"description": "The source of this event",
"enum": ["android", "ios", "browser", "flutter", "react-native", "roku"],
"enum": ["android", "ios", "browser", "flutter", "react-native", "roku", "unity"],
"readOnly": true
},
"view": {
Expand Down Expand Up @@ -127,7 +127,7 @@
"connectivity": {
"type": "object",
"description": "Device connectivity properties",
"required": ["status", "interfaces"],
"required": ["status"],
"properties": {
"status": {
"type": "string",
Expand All @@ -144,6 +144,12 @@
},
"readOnly": true
},
"effective_type": {
"type": "string",
"description": "Cellular connection type reflecting the measured network performance",
"enum": ["slow_2g", "2g", "3g", "4g"],
"readOnly": true
},
"cellular": {
"type": "object",
"description": "Cellular connectivity properties",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "rum/_view-container-schema.json",
"title": "ViewContainerSchema",
"type": "object",
"description": "View Container schema for views that are nested (webviews in mobile)",
"properties": {
"container": {
"type": "object",
"description": "View Container properties (view wrapping the current view)",
"required": ["view", "source"],
"properties": {
"view": {
"type": "object",
"description": "Attributes of the view's container",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"description": "ID of the parent view",
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
"readOnly": true
}
},
"readOnly": true
},
"source": {
"type": "string",
"description": "Source of the parent view",
"enum": ["android", "ios", "browser", "flutter", "react-native", "roku", "unity"],
"readOnly": true
}
},
"readOnly": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"$ref": "_common-schema.json"
},
{
"$ref": "_parent-view-schema.json"
"$ref": "_view-container-schema.json"
},
{
"required": ["type", "action"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"$ref": "_action-child-schema.json"
},
{
"$ref": "_parent-view-schema.json"
"$ref": "_view-container-schema.json"
},
{
"required": ["type", "error"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"$ref": "_action-child-schema.json"
},
{
"$ref": "_parent-view-schema.json"
"$ref": "_view-container-schema.json"
},
{
"required": ["type", "long_task"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"$ref": "_action-child-schema.json"
},
{
"$ref": "_parent-view-schema.json"
"$ref": "_view-container-schema.json"
},
{
"required": ["type", "resource"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"$ref": "_common-schema.json"
},
{
"$ref": "_parent-view-schema.json"
"$ref": "_view-container-schema.json"
},
{
"required": ["type", "view", "_dd"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ internal class RumActionScope(
null
}
),
view = ActionEvent.View(
view = ActionEvent.ActionEventView(
id = rumContext.viewId.orEmpty(),
name = rumContext.viewName,
url = rumContext.viewUrl.orEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ internal fun NetworkInfo.toResourceConnectivity(): ResourceEvent.Connectivity {
return ResourceEvent.Connectivity(
status,
interfaces,
cellular
cellular = cellular
)
}

Expand Down Expand Up @@ -227,7 +227,7 @@ internal fun NetworkInfo.toErrorConnectivity(): ErrorEvent.Connectivity {
return ErrorEvent.Connectivity(
status,
interfaces,
cellular
cellular = cellular
)
}

Expand Down Expand Up @@ -263,7 +263,7 @@ internal fun NetworkInfo.toLongTaskConnectivity(): LongTaskEvent.Connectivity {
return LongTaskEvent.Connectivity(
status,
interfaces,
cellular
cellular = cellular
)
}

Expand Down Expand Up @@ -299,7 +299,7 @@ internal fun NetworkInfo.toViewConnectivity(): ViewEvent.Connectivity {
return ViewEvent.Connectivity(
status,
interfaces,
cellular
cellular = cellular
)
}

Expand Down Expand Up @@ -335,7 +335,7 @@ internal fun NetworkInfo.toActionConnectivity(): ActionEvent.Connectivity {
return ActionEvent.Connectivity(
status,
interfaces,
cellular
cellular = cellular
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ internal class RumResourceScope(
graphql = graphql
),
action = rumContext.actionId?.let { ResourceEvent.Action(listOf(it)) },
view = ResourceEvent.View(
view = ResourceEvent.ResourceEventView(
id = rumContext.viewId.orEmpty(),
name = rumContext.viewName,
url = rumContext.viewUrl.orEmpty()
Expand Down Expand Up @@ -372,7 +372,7 @@ internal class RumResourceScope(
sourceType = ErrorEvent.SourceType.ANDROID
),
action = rumContext.actionId?.let { ErrorEvent.Action(listOf(it)) },
view = ErrorEvent.View(
view = ErrorEvent.ErrorEventView(
id = rumContext.viewId.orEmpty(),
name = rumContext.viewName,
url = rumContext.viewUrl.orEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ internal open class RumViewScope(
sourceType = event.sourceType.toSchemaSourceType()
),
action = rumContext.actionId?.let { ErrorEvent.Action(listOf(it)) },
view = ErrorEvent.View(
view = ErrorEvent.ErrorEventView(
id = rumContext.viewId.orEmpty(),
name = rumContext.viewName,
url = rumContext.viewUrl.orEmpty()
Expand Down Expand Up @@ -758,7 +758,7 @@ internal open class RumViewScope(
ViewEvent(
date = eventTimestamp,
featureFlags = ViewEvent.Context(additionalProperties = featureFlags),
view = ViewEvent.View(
view = ViewEvent.ViewEventView(
id = currentViewId,
name = rumContext.viewName,
url = rumContext.viewUrl.orEmpty(),
Expand Down Expand Up @@ -917,7 +917,7 @@ internal open class RumViewScope(
resource = ActionEvent.Resource(0),
loadingTime = event.applicationStartupNanos
),
view = ActionEvent.View(
view = ActionEvent.ActionEventView(
id = rumContext.viewId.orEmpty(),
name = rumContext.viewName,
url = rumContext.viewUrl.orEmpty()
Expand Down Expand Up @@ -1020,7 +1020,7 @@ internal open class RumViewScope(
isFrozenFrame = isFrozenFrame
),
action = rumContext.actionId?.let { LongTaskEvent.Action(listOf(it)) },
view = LongTaskEvent.View(
view = LongTaskEvent.LongTaskEventView(
id = rumContext.viewId.orEmpty(),
name = rumContext.viewName,
url = rumContext.viewUrl.orEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ internal class DatadogNdkCrashEventHandler(
val connectivity = viewEvent.connectivity?.let {
val connectivityStatus =
ErrorEvent.Status.valueOf(it.status.name)
val connectivityInterfaces = it.interfaces.map { ErrorEvent.Interface.valueOf(it.name) }
val connectivityInterfaces = it.interfaces?.map { ErrorEvent.Interface.valueOf(it.name) }
val cellular = ErrorEvent.Cellular(
it.cellular?.technology,
it.cellular?.carrierName
)
ErrorEvent.Connectivity(connectivityStatus, connectivityInterfaces, cellular)
ErrorEvent.Connectivity(connectivityStatus, connectivityInterfaces, cellular = cellular)
}
val additionalProperties = viewEvent.context?.additionalProperties ?: mutableMapOf()
val additionalUserProperties = viewEvent.usr?.additionalProperties ?: mutableMapOf()
Expand All @@ -122,7 +122,7 @@ internal class DatadogNdkCrashEventHandler(
internalLogger
)
},
view = ErrorEvent.View(
view = ErrorEvent.ErrorEventView(
id = viewEvent.view.id,
name = viewEvent.view.name,
referrer = viewEvent.view.referrer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal class RumEventSerializerTest {
hasNullableField("status", connectivity.status.name.lowercase(Locale.US))
hasNullableField(
"interfaces",
connectivity.interfaces.map { it.name.lowercase(Locale.US) }
connectivity.interfaces?.map { it.name.lowercase(Locale.US) }
)
connectivity.cellular?.let { cellular ->
hasField("cellular") {
Expand Down Expand Up @@ -195,7 +195,7 @@ internal class RumEventSerializerTest {
hasNullableField("status", connectivity.status.name.lowercase(Locale.US))
hasNullableField(
"interfaces",
connectivity.interfaces.map { it.name.lowercase(Locale.US) }
connectivity.interfaces?.map { it.name.lowercase(Locale.US) }
)
connectivity.cellular?.let { cellular ->
hasField("cellular") {
Expand Down Expand Up @@ -263,7 +263,7 @@ internal class RumEventSerializerTest {
hasNullableField("status", connectivity.status.name.lowercase(Locale.US))
hasNullableField(
"interfaces",
connectivity.interfaces.map { it.name.lowercase(Locale.US) }
connectivity.interfaces?.map { it.name.lowercase(Locale.US) }
)
connectivity.cellular?.let { cellular ->
hasField("cellular") {
Expand Down Expand Up @@ -327,7 +327,7 @@ internal class RumEventSerializerTest {
hasNullableField("status", connectivity.status.name.lowercase(Locale.US))
hasNullableField(
"interfaces",
connectivity.interfaces.map { it.name.lowercase(Locale.US) }
connectivity.interfaces?.map { it.name.lowercase(Locale.US) }
)
connectivity.cellular?.let { cellular ->
hasField("cellular") {
Expand Down Expand Up @@ -385,7 +385,7 @@ internal class RumEventSerializerTest {
hasNullableField("status", connectivity.status.name.lowercase(Locale.US))
hasNullableField(
"interfaces",
connectivity.interfaces.map { it.name.lowercase(Locale.US) }
connectivity.interfaces?.map { it.name.lowercase(Locale.US) }
)
connectivity.cellular?.let { cellular ->
hasField("cellular") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ internal class RumEventExtTest {
ResourceEvent.Connectivity(
ResourceEvent.Status.CONNECTED,
listOf(ResourceEvent.Interface.CELLULAR),
ResourceEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
cellular = ResourceEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
)
)
}
Expand Down Expand Up @@ -454,7 +454,7 @@ internal class RumEventExtTest {
ErrorEvent.Connectivity(
ErrorEvent.Status.CONNECTED,
listOf(ErrorEvent.Interface.CELLULAR),
ErrorEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
cellular = ErrorEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
)
)
}
Expand Down Expand Up @@ -639,7 +639,7 @@ internal class RumEventExtTest {
LongTaskEvent.Connectivity(
LongTaskEvent.Status.CONNECTED,
listOf(LongTaskEvent.Interface.CELLULAR),
LongTaskEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
cellular = LongTaskEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
)
)
}
Expand Down Expand Up @@ -824,7 +824,7 @@ internal class RumEventExtTest {
ActionEvent.Connectivity(
ActionEvent.Status.CONNECTED,
listOf(ActionEvent.Interface.CELLULAR),
ActionEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
cellular = ActionEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
)
)
}
Expand Down Expand Up @@ -1009,7 +1009,7 @@ internal class RumEventExtTest {
ViewEvent.Connectivity(
ViewEvent.Status.CONNECTED,
listOf(ViewEvent.Interface.CELLULAR),
ViewEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
cellular = ViewEvent.Cellular(networkInfo.cellularTechnology, networkInfo.carrierName)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class ActionEventForgeryFactory :
)
}
),
view = ActionEvent.View(
view = ActionEvent.ActionEventView(
id = forge.getForgery<UUID>().toString(),
url = forge.aStringMatching("https://[a-z]+.[a-z]{3}/[a-z0-9_/]+"),
referrer = forge.aNullable { getForgery<URL>().toString() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class ErrorEventForgeryFactory : ForgeryFactory<ErrorEvent> {
handling = forge.aNullable { getForgery() },
handlingStack = forge.aNullable { aThrowable().loggableStackTrace() }
),
view = ErrorEvent.View(
view = ErrorEvent.ErrorEventView(
id = forge.getForgery<UUID>().toString(),
url = forge.aStringMatching("https://[a-z]+.[a-z]{3}/[a-z0-9_/]+"),
referrer = forge.aNullable { getForgery<URL>().toString() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class LongTaskEventForgeryFactory :
duration = forge.aPositiveLong(),
isFrozenFrame = forge.aNullable { aBool() }
),
view = LongTaskEvent.View(
view = LongTaskEvent.LongTaskEventView(
id = forge.getForgery<UUID>().toString(),
referrer = forge.aNullable { getForgery<URL>().toString() },
url = forge.aStringMatching("https://[a-z]+.[a-z]{3}/[a-z0-9_/]+"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal class ResourceEventForgeryFactory :
)
}
),
view = ResourceEvent.View(
view = ResourceEvent.ResourceEventView(
id = forge.getForgery<UUID>().toString(),
url = forge.aStringMatching("https://[a-z]+.[a-z]{3}/[a-z0-9_/]+"),
referrer = forge.aNullable { getForgery<URL>().toString() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class ViewEventForgeryFactory : ForgeryFactory<ViewEvent> {
override fun getForgery(forge: Forge): ViewEvent {
return ViewEvent(
date = forge.aTimestamp(),
view = ViewEvent.View(
view = ViewEvent.ViewEventView(
id = forge.getForgery<UUID>().toString(),
url = forge.aStringMatching("https://[a-z]+.[a-z]{3}/[a-z0-9_/]+"),
referrer = forge.aNullable { getForgery<URL>().toString() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class ActionEventForgeryFactory :
)
}
),
view = ActionEvent.View(
view = ActionEvent.ActionEventView(
id = forge.getForgery<UUID>().toString(),
url = forge.aStringMatching("https://[a-z]+.[a-z]{3}/[a-z0-9_/]+"),
referrer = forge.aNullable { getForgery<URL>().toString() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class ErrorEventForgeryFactory : ForgeryFactory<ErrorEvent> {
handling = forge.aNullable { getForgery() },
handlingStack = forge.aNullable { aThrowable().loggableStackTrace() }
),
view = ErrorEvent.View(
view = ErrorEvent.ErrorEventView(
id = forge.getForgery<UUID>().toString(),
url = forge.aStringMatching("https://[a-z]+.[a-z]{3}/[a-z0-9_/]+"),
referrer = forge.aNullable { getForgery<URL>().toString() },
Expand Down

0 comments on commit 3d5e3d6

Please sign in to comment.