You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/dd-sdk-android-rum/src/main/kotlin/com/datadog/android/rum/internal/domain/scope/RumResourceScope.kt
+69-3Lines changed: 69 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -250,6 +250,7 @@ internal class RumResourceScope(
250
250
val graphqlOperationName = resourceAttributes.remove(RumAttributes.GRAPHQL_OPERATION_NAME) as?String
251
251
val graphqlOperationType = resourceAttributes.remove(RumAttributes.GRAPHQL_OPERATION_TYPE) as?String
252
252
val graphqlVariables = resourceAttributes.remove(RumAttributes.GRAPHQL_VARIABLES) as?String
253
+
val graphqlErrors = resourceAttributes.remove(RumAttributes.GRAPHQL_ERRORS) as?String
253
254
254
255
// The decision whether to send payloads is determined by a DatadogApolloInterceptor parameter
255
256
val rawPayload = resourceAttributes.remove(RumAttributes.GRAPHQL_PAYLOAD) as?String
@@ -259,7 +260,8 @@ internal class RumResourceScope(
Copy file name to clipboardExpand all lines: features/dd-sdk-android-rum/src/test/kotlin/com/datadog/android/rum/internal/domain/scope/RumResourceScopeTest.kt
+206Lines changed: 206 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3631,6 +3631,212 @@ internal class RumResourceScopeTest {
3631
3631
}
3632
3632
}
3633
3633
3634
+
@Test
3635
+
fun`M parse GraphQL errors W handleEvent { wrapped errors format }`(
3636
+
@Forgery kind:RumResourceKind,
3637
+
@LongForgery(200, 600) statusCode:Long,
3638
+
@LongForgery(0, 1024) size:Long,
3639
+
forge:Forge
3640
+
) {
3641
+
// Given
3642
+
val operationType = forge.aValueFrom(ResourceEvent.OperationType::class.java)
3643
+
val operationName = forge.aNullable { aString() }
3644
+
val variables = forge.aNullable { aString() }
3645
+
3646
+
// Errors wrapped in an object
3647
+
val errorsJson ="""
3648
+
{
3649
+
"errors": [
3650
+
{
3651
+
"message": "User not found",
3652
+
"code": "NOT_FOUND",
3653
+
"locations": [{"line": 3, "column": 5}],
3654
+
"path": ["user", "profile"]
3655
+
},
3656
+
{
3657
+
"message": "Validation failed"
3658
+
}
3659
+
]
3660
+
}
3661
+
""".trimIndent()
3662
+
3663
+
val attributes = forge.exhaustiveAttributes(excludedKeys = fakeResourceAttributes.keys) +
3664
+
mapOf(
3665
+
RumAttributes.GRAPHQL_OPERATION_TYPE to operationType.toString(),
3666
+
RumAttributes.GRAPHQL_OPERATION_NAME to operationName,
0 commit comments