From 5eedd854dd6d2b1ba9fd0239da9c481358383b0b Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Thu, 30 Oct 2025 14:33:41 -0400 Subject: [PATCH 1/3] Add documentation for new datadog_dio Flutter package. --- .../flutter/advanced_configuration.md | 9 +++- .../flutter/integrated_libraries.md | 43 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md b/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md index 418c2f03996eb..a8de8b70d55df 100644 --- a/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md +++ b/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md @@ -201,6 +201,10 @@ In order to enable Datadog [Distributed Tracing][13], you must set the `DatadogC - `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`. +### Track resources from other packages + +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. More information about these libraries is documented under [Integrated Libraries][22]. + ## Enrich user sessions 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 ## OpenTelemetry setup -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. +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. ### Datadog header generation @@ -484,3 +488,6 @@ if (DatadogSdk.instance.isFirstPartyHost(host)){ [17]: https://pub.dev/documentation/datadog_flutter_plugin/latest/datadog_flutter_plugin/ [18]: /real_user_monitoring/application_monitoring/mobile_vitals/?tab=flutter [19]: https://pub.dev/packages/datadog_grpc_interceptor +[20]: https://pub.dev/packages/datadog_gql_link +[21]: https://pub.dev/packages/datadog_dio +[22]: /real_user_monitoring/application_monitoring/flutter/integrated_libraries diff --git a/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md b/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md index 69f3a669b73da..73e7cd13cf6b7 100644 --- a/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md +++ b/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md @@ -216,7 +216,49 @@ final datadogConfig = DatadogConfiguration( ); ``` +## Dio +{% alert level="info" %} +Most common setups using Dio can use Datadog Tracking Http Client instead of the specialized Dio inteceptor. Only use the Dio interceptor if you are using a non-standard Dio `HttpClientAdapter` that cannot be tracked by Datadog Tracking Http Client. +{% /alert %} + +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. + +### Setup + +Add `datadog_dio` to your `pubspec.yaml` or by running `flutter pub add datadog_dio` from your terminal: + +```yaml +dependencies: + # Other dependencies + datadog_dio: ^1.0.0 +``` + +To use this plugin, call `addDatadogInterceptor` at the end of your Dio initialization: + +```dart +import 'package:datadog_dio/datadog_dio.dart' + +// Initialize Datadog - be sure to set the [DatadogConfiguration.firstPartyHosts] member +// Enable Datadog Distributed Tracing +final config = DatadogConfiguration( + // ... + firstPartyHosts = ['localhost'] +) + +// Create our Dio client +final dio = Dio() + // Dio configuration... + ..addDatadogInterceptor(DatadogSdk.instance); +``` + +Calling `addDatadogInterceptor` adds the Datadog interceptor as the first interceptor in your list of interceptors, which is important to ensure that all network requests from Dio are sent to Datadog, as other interceptors may decide not to forward information down the interceptor chain. For this reason, it is important to make sure you call addDatadogInterceptor after any other configuration of Dio is complete. + +### Use with other Datadog Network Tracking + +Clients that want to track all network requests, including those made by `dart:io` and widgets like `NetworkImage` can continue to use `datadog_tracking_http_client` to capture these requests. However, depending on your setup, the global overide method used in `enableHttpTracking` may cause resources to be double reported (once by the global override and once by the Dio interceptor). + +To avoid this, we recommend using ignoreUrlPatterns parameter when calling `enableHttpTracking` to ignore requests made by your Dio client. ## Further Reading @@ -232,3 +274,4 @@ final datadogConfig = DatadogConfiguration( [8]: https://pub.dev/packages/webview_flutter [9]: https://pub.dev/packages/flutter_inappwebview [10]: /real_user_monitoring/application_monitoring/web_view_tracking?tab=flutter +[11]: https://pub.dev/packages/datadog_dio From e02edebff02c3b5149049287be2ecf461c80dfbe Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Wed, 5 Nov 2025 10:11:15 -0500 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Rosa Trieu <107086888+rtrieu@users.noreply.github.com> --- .../flutter/advanced_configuration.md | 2 +- .../flutter/integrated_libraries.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md b/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md index a8de8b70d55df..5199bc579f1cf 100644 --- a/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md +++ b/content/en/real_user_monitoring/application_monitoring/flutter/advanced_configuration.md @@ -203,7 +203,7 @@ In order to enable Datadog [Distributed Tracing][13], you must set the `DatadogC ### Track resources from other packages -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. More information about these libraries is documented under [Integrated Libraries][22]. +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]. ## Enrich user sessions diff --git a/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md b/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md index 73e7cd13cf6b7..f6c84e6289db5 100644 --- a/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md +++ b/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md @@ -218,9 +218,9 @@ final datadogConfig = DatadogConfiguration( ## Dio -{% alert level="info" %} -Most common setups using Dio can use Datadog Tracking Http Client instead of the specialized Dio inteceptor. Only use the Dio interceptor if you are using a non-standard Dio `HttpClientAdapter` that cannot be tracked by Datadog Tracking Http Client. -{% /alert %} +
+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 `HttpClientAdapter` that cannot be tracked by Datadog Tracking Http Client. +
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. @@ -252,13 +252,13 @@ final dio = Dio() ..addDatadogInterceptor(DatadogSdk.instance); ``` -Calling `addDatadogInterceptor` adds the Datadog interceptor as the first interceptor in your list of interceptors, which is important to ensure that all network requests from Dio are sent to Datadog, as other interceptors may decide not to forward information down the interceptor chain. For this reason, it is important to make sure you call addDatadogInterceptor after any other configuration of Dio is complete. +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. ### Use with other Datadog Network Tracking -Clients that want to track all network requests, including those made by `dart:io` and widgets like `NetworkImage` can continue to use `datadog_tracking_http_client` to capture these requests. However, depending on your setup, the global overide method used in `enableHttpTracking` may cause resources to be double reported (once by the global override and once by the Dio interceptor). +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) -To avoid this, we recommend using ignoreUrlPatterns parameter when calling `enableHttpTracking` to ignore requests made by your Dio client. +To avoid this, use the `ignoreUrlPatterns` parameter when calling `enableHttpTracking` to ignore requests made by your Dio client. ## Further Reading From ef6257ab8a21e1382584b9bb6486509d983368b3 Mon Sep 17 00:00:00 2001 From: Rosa Trieu <107086888+rtrieu@users.noreply.github.com> Date: Wed, 5 Nov 2025 09:39:58 -0800 Subject: [PATCH 3/3] Update content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md --- .../application_monitoring/flutter/integrated_libraries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md b/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md index f6c84e6289db5..0cd8944635be9 100644 --- a/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md +++ b/content/en/real_user_monitoring/application_monitoring/flutter/integrated_libraries.md @@ -219,7 +219,7 @@ final datadogConfig = DatadogConfiguration( ## Dio
-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 `HttpClientAdapter` that cannot be tracked by Datadog Tracking Http Client. +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 HttpClientAdapter that cannot be tracked by Datadog Tracking Http Client.
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.