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: content/en/real_user_monitoring/application_monitoring/browser/data_collected.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,19 @@ Detailed network timing data for the loading of an application's resources are c
143
143
|`resource.provider.domain`| string | The resource provider domain. |
144
144
|`resource.provider.type`| string | The resource provider type (for example, `first-party`, `cdn`, `ad`, or `analytics`). |
145
145
146
+
### GraphQL attributes
147
+
148
+
For GraphQL requests configured in `allowedGraphQlUrls`, additional metadata is automatically collected. See [Track GraphQL requests][15] for configuration details.
|`resource.graphql.operation_type`| string | The GraphQL operation type: `query`, `mutation`, or `subscription`. |
153
+
|`resource.graphql.operation_name`| string | The GraphQL operation name, if provided in the request. |
154
+
|`resource.graphql.variables`| string | The GraphQL variables sent with the request. |
155
+
|`resource.graphql.payload`| string | The GraphQL query (limited to 32 KB, available only if `trackPayload` is enabled). |
156
+
|`resource.graphql.errors_count`| number | Number of errors returned in the GraphQL response (available only if `trackResponseErrors` is enabled). |
157
+
|`resource.graphql.errors`| array | Array of GraphQL errors with `message`, `code`, `locations`, and `path` (available only if `trackResponseErrors` is enabled). |
158
+
146
159
### Long task timing attributes
147
160
148
161
| Attribute | Type | Description |
@@ -222,3 +235,4 @@ Source errors include code-level information about the error. For more informati
Copy file name to clipboardExpand all lines: content/en/real_user_monitoring/application_monitoring/browser/monitoring_resource_performance.md
+49-1Lines changed: 49 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,53 @@ See [Connect RUM and Traces][2] for information about setting up this feature.
34
34
35
35
{{< img src="real_user_monitoring/browser/resource_performance_graph.png" alt="APM Trace information for a RUM Resource" >}}
36
36
37
-
## Resource attributes
37
+
## Track GraphQL requests
38
+
39
+
The Browser SDK can automatically enrich GraphQL requests with operation-specific metadata, making it easier to identify and debug individual operations in RUM.
40
+
41
+
### Setup
42
+
43
+
Configure `allowedGraphQlUrls` during SDK initialization to specify which endpoints should be treated as GraphQL:
44
+
45
+
```javascript
46
+
import { datadogRum } from'@datadog/browser-rum'
47
+
48
+
datadogRum.init({
49
+
applicationId:'<DATADOG_APPLICATION_ID>',
50
+
clientToken:'<DATADOG_CLIENT_TOKEN>',
51
+
site:'datadoghq.com',
52
+
allowedGraphQlUrls: [
53
+
// String: matches any URL starting with the value
54
+
"https://api.example.com/graphql",
55
+
// RegExp: tests against the full URL
56
+
/\/graphql$/,
57
+
// Function: evaluates with the URL as parameter, returning true for a match
58
+
(url) =>url.includes("graphql")
59
+
]
60
+
})
61
+
```
62
+
63
+
### Advanced options
64
+
65
+
To collect additional data, use the extended configuration:
66
+
67
+
```javascript
68
+
datadogRum.init({
69
+
allowedGraphQlUrls: [
70
+
{
71
+
match:"https://api.example.com/graphql",
72
+
trackPayload:true, // Include GraphQL query (limited to 32 KB)
73
+
trackResponseErrors:true// Capture GraphQL errors from responses
74
+
}
75
+
]
76
+
})
77
+
```
78
+
79
+
For matching requests, the SDK automatically extracts operation type, operation name, variables, and optionally the GraphQL query payload and response errors. See [GraphQL attributes][8] for the complete list of collected attributes.
80
+
81
+
**Note**: You can modify GraphQL variables in the [`beforeSend` callback][9] if needed (for example, to redact sensitive data).
82
+
83
+
## Resource timing attributes
38
84
39
85
Detailed network timing data for resources is collected from the Fetch and XHR native browser methods and from the [Performance Resource Timing API][3].
40
86
@@ -96,3 +142,5 @@ To collect the resource status code, add the `Access-Control-Allow-Origin` HTTP
0 commit comments