Skip to content

Commit

Permalink
Update enums to match RUM event schema
Browse files Browse the repository at this point in the history
  • Loading branch information
xgouchet committed Jan 13, 2025
1 parent 3adfe60 commit 00b9ef7
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 7 deletions.
2 changes: 2 additions & 0 deletions dd-sdk-android-core/api/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ enum com.datadog.android.api.context.DeviceType
- TABLET
- TV
- DESKTOP
- GAMING_CONSOLE
- BOT
- OTHER
data class com.datadog.android.api.context.NetworkInfo
constructor(Connectivity = Connectivity.NETWORK_NOT_CONNECTED, kotlin.String? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.String? = null)
Expand Down
2 changes: 2 additions & 0 deletions dd-sdk-android-core/api/dd-sdk-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ public final class com/datadog/android/api/context/DeviceInfo {
}

public final class com/datadog/android/api/context/DeviceType : java/lang/Enum {
public static final field BOT Lcom/datadog/android/api/context/DeviceType;
public static final field DESKTOP Lcom/datadog/android/api/context/DeviceType;
public static final field GAMING_CONSOLE Lcom/datadog/android/api/context/DeviceType;
public static final field MOBILE Lcom/datadog/android/api/context/DeviceType;
public static final field OTHER Lcom/datadog/android/api/context/DeviceType;
public static final field TABLET Lcom/datadog/android/api/context/DeviceType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ enum class DeviceType {
TABLET,
TV,
DESKTOP,
GAMING_CONSOLE,
BOT,
OTHER
}
2 changes: 2 additions & 0 deletions features/dd-sdk-android-rum/api/apiSurface
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ enum com.datadog.android.rum.RumErrorSource
- LOGGER
- AGENT
- WEBVIEW
- CUSTOM
- REPORT
interface com.datadog.android.rum.RumMonitor
fun getCurrentSessionId((String?) -> Unit)
fun startView(Any, String, Map<String, Any?> = emptyMap())
Expand Down
2 changes: 2 additions & 0 deletions features/dd-sdk-android-rum/api/dd-sdk-android-rum.api
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ public final class com/datadog/android/rum/RumConfiguration$Builder {
public final class com/datadog/android/rum/RumErrorSource : java/lang/Enum {
public static final field AGENT Lcom/datadog/android/rum/RumErrorSource;
public static final field CONSOLE Lcom/datadog/android/rum/RumErrorSource;
public static final field CUSTOM Lcom/datadog/android/rum/RumErrorSource;
public static final field LOGGER Lcom/datadog/android/rum/RumErrorSource;
public static final field NETWORK Lcom/datadog/android/rum/RumErrorSource;
public static final field REPORT Lcom/datadog/android/rum/RumErrorSource;
public static final field SOURCE Lcom/datadog/android/rum/RumErrorSource;
public static final field WEBVIEW Lcom/datadog/android/rum/RumErrorSource;
public static fun valueOf (Ljava/lang/String;)Lcom/datadog/android/rum/RumErrorSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ enum class RumErrorSource {
AGENT,

/** Error originated in a WebView. */
WEBVIEW
WEBVIEW,

/** Custom error source. */
CUSTOM,

/** Error originated in a System report. */
REPORT
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ internal fun RumErrorSource.toSchemaSource(): ErrorEvent.ErrorSource {
RumErrorSource.LOGGER -> ErrorEvent.ErrorSource.LOGGER
RumErrorSource.AGENT -> ErrorEvent.ErrorSource.AGENT
RumErrorSource.WEBVIEW -> ErrorEvent.ErrorSource.WEBVIEW
RumErrorSource.CUSTOM -> ErrorEvent.ErrorSource.CUSTOM
RumErrorSource.REPORT -> ErrorEvent.ErrorSource.REPORT
}
}

Expand Down Expand Up @@ -178,6 +180,7 @@ internal fun NetworkInfo.toResourceConnectivity(): ResourceEvent.Connectivity {
NetworkInfo.Connectivity.NETWORK_5G,
NetworkInfo.Connectivity.NETWORK_MOBILE_OTHER,
NetworkInfo.Connectivity.NETWORK_CELLULAR -> listOf(ResourceEvent.Interface.CELLULAR)

NetworkInfo.Connectivity.NETWORK_OTHER -> listOf(ResourceEvent.Interface.OTHER)
NetworkInfo.Connectivity.NETWORK_NOT_CONNECTED -> emptyList()
}
Expand Down Expand Up @@ -214,6 +217,7 @@ internal fun NetworkInfo.toErrorConnectivity(): ErrorEvent.Connectivity {
NetworkInfo.Connectivity.NETWORK_5G,
NetworkInfo.Connectivity.NETWORK_MOBILE_OTHER,
NetworkInfo.Connectivity.NETWORK_CELLULAR -> listOf(ErrorEvent.Interface.CELLULAR)

NetworkInfo.Connectivity.NETWORK_OTHER -> listOf(ErrorEvent.Interface.OTHER)
NetworkInfo.Connectivity.NETWORK_NOT_CONNECTED -> emptyList()
}
Expand Down Expand Up @@ -250,6 +254,7 @@ internal fun NetworkInfo.toLongTaskConnectivity(): LongTaskEvent.Connectivity {
NetworkInfo.Connectivity.NETWORK_5G,
NetworkInfo.Connectivity.NETWORK_MOBILE_OTHER,
NetworkInfo.Connectivity.NETWORK_CELLULAR -> listOf(LongTaskEvent.Interface.CELLULAR)

NetworkInfo.Connectivity.NETWORK_OTHER -> listOf(LongTaskEvent.Interface.OTHER)
NetworkInfo.Connectivity.NETWORK_NOT_CONNECTED -> emptyList()
}
Expand Down Expand Up @@ -286,6 +291,7 @@ internal fun NetworkInfo.toViewConnectivity(): ViewEvent.Connectivity {
NetworkInfo.Connectivity.NETWORK_5G,
NetworkInfo.Connectivity.NETWORK_MOBILE_OTHER,
NetworkInfo.Connectivity.NETWORK_CELLULAR -> listOf(ViewEvent.Interface.CELLULAR)

NetworkInfo.Connectivity.NETWORK_OTHER -> listOf(ViewEvent.Interface.OTHER)
NetworkInfo.Connectivity.NETWORK_NOT_CONNECTED -> emptyList()
}
Expand Down Expand Up @@ -322,6 +328,7 @@ internal fun NetworkInfo.toActionConnectivity(): ActionEvent.Connectivity {
NetworkInfo.Connectivity.NETWORK_5G,
NetworkInfo.Connectivity.NETWORK_MOBILE_OTHER,
NetworkInfo.Connectivity.NETWORK_CELLULAR -> listOf(ActionEvent.Interface.CELLULAR)

NetworkInfo.Connectivity.NETWORK_OTHER -> listOf(ActionEvent.Interface.OTHER)
NetworkInfo.Connectivity.NETWORK_NOT_CONNECTED -> emptyList()
}
Expand Down Expand Up @@ -355,7 +362,9 @@ internal fun DeviceType.toViewSchemaType(): ViewEvent.DeviceType {
DeviceType.TABLET -> ViewEvent.DeviceType.TABLET
DeviceType.TV -> ViewEvent.DeviceType.TV
DeviceType.DESKTOP -> ViewEvent.DeviceType.DESKTOP
else -> ViewEvent.DeviceType.OTHER
DeviceType.GAMING_CONSOLE -> ViewEvent.DeviceType.GAMING_CONSOLE
DeviceType.BOT -> ViewEvent.DeviceType.BOT
DeviceType.OTHER -> ViewEvent.DeviceType.OTHER
}
}

Expand All @@ -365,7 +374,9 @@ internal fun DeviceType.toActionSchemaType(): ActionEvent.DeviceType {
DeviceType.TABLET -> ActionEvent.DeviceType.TABLET
DeviceType.TV -> ActionEvent.DeviceType.TV
DeviceType.DESKTOP -> ActionEvent.DeviceType.DESKTOP
else -> ActionEvent.DeviceType.OTHER
DeviceType.GAMING_CONSOLE -> ActionEvent.DeviceType.GAMING_CONSOLE
DeviceType.BOT -> ActionEvent.DeviceType.BOT
DeviceType.OTHER -> ActionEvent.DeviceType.OTHER
}
}

Expand All @@ -375,7 +386,9 @@ internal fun DeviceType.toLongTaskSchemaType(): LongTaskEvent.DeviceType {
DeviceType.TABLET -> LongTaskEvent.DeviceType.TABLET
DeviceType.TV -> LongTaskEvent.DeviceType.TV
DeviceType.DESKTOP -> LongTaskEvent.DeviceType.DESKTOP
else -> LongTaskEvent.DeviceType.OTHER
DeviceType.GAMING_CONSOLE -> LongTaskEvent.DeviceType.GAMING_CONSOLE
DeviceType.BOT -> LongTaskEvent.DeviceType.BOT
DeviceType.OTHER -> LongTaskEvent.DeviceType.OTHER
}
}

Expand All @@ -385,7 +398,9 @@ internal fun DeviceType.toResourceSchemaType(): ResourceEvent.DeviceType {
DeviceType.TABLET -> ResourceEvent.DeviceType.TABLET
DeviceType.TV -> ResourceEvent.DeviceType.TV
DeviceType.DESKTOP -> ResourceEvent.DeviceType.DESKTOP
else -> ResourceEvent.DeviceType.OTHER
DeviceType.GAMING_CONSOLE -> ResourceEvent.DeviceType.GAMING_CONSOLE
DeviceType.BOT -> ResourceEvent.DeviceType.BOT
DeviceType.OTHER -> ResourceEvent.DeviceType.OTHER
}
}

Expand All @@ -395,7 +410,9 @@ internal fun DeviceType.toErrorSchemaType(): ErrorEvent.DeviceType {
DeviceType.TABLET -> ErrorEvent.DeviceType.TABLET
DeviceType.TV -> ErrorEvent.DeviceType.TV
DeviceType.DESKTOP -> ErrorEvent.DeviceType.DESKTOP
else -> ErrorEvent.DeviceType.OTHER
DeviceType.GAMING_CONSOLE -> ErrorEvent.DeviceType.GAMING_CONSOLE
DeviceType.BOT -> ErrorEvent.DeviceType.BOT
DeviceType.OTHER -> ErrorEvent.DeviceType.OTHER
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ internal abstract class BaseSpanEventMapper<T> : ContextAwareMapper<T, SpanEvent
DeviceType.TABLET -> SpanEvent.Type.TABLET
DeviceType.TV -> SpanEvent.Type.TV
DeviceType.DESKTOP -> SpanEvent.Type.DESKTOP
else -> SpanEvent.Type.OTHER
DeviceType.GAMING_CONSOLE -> SpanEvent.Type.GAMING_CONSOLE
DeviceType.BOT -> SpanEvent.Type.BOT
DeviceType.OTHER -> SpanEvent.Type.OTHER
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ internal class SpanEventAssert(actual: SpanEvent) :
DeviceType.DESKTOP -> SpanEvent.Type.DESKTOP
DeviceType.TV -> SpanEvent.Type.TV
DeviceType.OTHER -> SpanEvent.Type.OTHER
DeviceType.GAMING_CONSOLE -> SpanEvent.Type.GAMING_CONSOLE
DeviceType.BOT -> SpanEvent.Type.BOT
}
assertThat(actual.meta.device.type)
.overridingErrorMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ internal fun RumErrorSource.toSchemaSource(): ErrorEvent.ErrorSource {
RumErrorSource.LOGGER -> ErrorEvent.ErrorSource.LOGGER
RumErrorSource.AGENT -> ErrorEvent.ErrorSource.AGENT
RumErrorSource.WEBVIEW -> ErrorEvent.ErrorSource.WEBVIEW
RumErrorSource.CUSTOM -> ErrorEvent.ErrorSource.CUSTOM
RumErrorSource.REPORT -> ErrorEvent.ErrorSource.REPORT
}
}

Expand Down

0 comments on commit 00b9ef7

Please sign in to comment.