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
Add documentation for new datadog_dio Flutter package. (#32509)
* Add documentation for new datadog_dio Flutter package.
* Apply suggestions from code review
Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>
* Update content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md
---------
Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com>
Co-authored-by: Rosa Trieu <rosa.trieu@datadoghq.com>
Copy file name to clipboardExpand all lines: content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,6 +201,10 @@ In order to enable Datadog [Distributed Tracing][13], you must set the `DatadogC
201
201
202
202
-`DatadogRumConfiguration.traceSampleRate` sets a default sampling rate of 20%. If you want all resources requests to generate a full distributed trace, set this value to `100.0`.
203
203
204
+
### Track resources from other packages
205
+
206
+
While `Datadog Tracking HTTP Client` can track most common network calls in Flutter, Datadog supplies packages for integration into specific networking libraries, including gRPC, GraphQL and Dio. For more information about these libraries, see [Integrated Libraries][22].
207
+
204
208
## Enrich user sessions
205
209
206
210
Flutter RUM automatically tracks attributes such as user activity, views (using the `DatadogNavigationObserver`), errors, native crashes, and network requests (using the Datadog Tracking HTTP Client). See the [RUM Data Collection documentation][14] to learn about the RUM events and default attributes. You can further enrich user session information and gain finer control over the attributes collected by tracking custom events.
@@ -422,7 +426,7 @@ To enable the collection of Flutter-specific performance metrics, set `reportFlu
422
426
423
427
## OpenTelemetry setup
424
428
425
-
The [Datadog Tracking HTTP Client][10] package and [gRPC Interceptor][19] package both support distributed traces through both automatic header generation and header ingestion. This section describes how to use OpenTelemetry with RUM Flutter.
429
+
All of Datadog's automatic network tracking packages ([Datadog Tracking HTTP Client][10], [gRPC Interceptor][19], [GQL Link][20], and [Dio Interceptor][21]) support distributed traces through both automatic header generation and header ingestion. This section describes how to use OpenTelemetry with RUM Flutter.
426
430
427
431
### Datadog header generation
428
432
@@ -484,3 +488,6 @@ if (DatadogSdk.instance.isFirstPartyHost(host)){
Copy file name to clipboardExpand all lines: content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,7 +216,49 @@ final datadogConfig = DatadogConfiguration(
216
216
);
217
217
```
218
218
219
+
## Dio
219
220
221
+
<div class="alert alert-info">
222
+
For most Dio setups, use Datadog Tracking Http Client instead of the specialized Dio interceptor. Only use the Dio interceptor if you're using a non-standard Dio <code>HttpClientAdapter</code> that cannot be tracked by Datadog Tracking Http Client.
223
+
</div>
224
+
225
+
Datadog provides [`datadog_dio`][6] for use with the [Dio Flutter package][7]. The Dio interceptor automatically tracks requests from a given Dio client as RUM Resources and enables distributed tracing with APM.
226
+
227
+
### Setup
228
+
229
+
Add `datadog_dio` to your `pubspec.yaml` or by running `flutter pub add datadog_dio` from your terminal:
230
+
231
+
```yaml
232
+
dependencies:
233
+
# Other dependencies
234
+
datadog_dio: ^1.0.0
235
+
```
236
+
237
+
To use this plugin, call `addDatadogInterceptor` at the end of your Dio initialization:
238
+
239
+
```dart
240
+
import 'package:datadog_dio/datadog_dio.dart'
241
+
242
+
// Initialize Datadog - be sure to set the [DatadogConfiguration.firstPartyHosts] member
243
+
// Enable Datadog Distributed Tracing
244
+
final config = DatadogConfiguration(
245
+
// ...
246
+
firstPartyHosts = ['localhost']
247
+
)
248
+
249
+
// Create our Dio client
250
+
final dio = Dio()
251
+
// Dio configuration...
252
+
..addDatadogInterceptor(DatadogSdk.instance);
253
+
```
254
+
255
+
Calling `addDatadogInterceptor` adds the Datadog interceptor as the first interceptor in your list. This ensures all network requests from Dio are sent to Datadog, since other interceptors may not forward information down the chain. Call `addDatadogInterceptor` after completing all other Dio configuration.
256
+
257
+
### Use with other Datadog Network Tracking
258
+
259
+
To track all network requests, including those made by `dart:io` and widgets like `NetworkImage`, use `datadog_tracking_http_client` to capture these requests. However, depending on your setup, the global override method used in `enableHttpTracking` may cause resources to be double reported (once by the global override and once by the Dio interceptor)
260
+
261
+
To avoid this, use the `ignoreUrlPatterns` parameter when calling `enableHttpTracking` to ignore requests made by your Dio client.
220
262
221
263
## Further Reading
222
264
@@ -232,3 +274,4 @@ final datadogConfig = DatadogConfiguration(
0 commit comments