datadog_dio 1.1.0 copy "datadog_dio: ^1.1.0" to clipboard
datadog_dio: ^1.1.0 copied to clipboard

Support tracking and distributed tracing of Dio network requests in Datadog.

Datadog Dio integration #

A package for use with Dio and the Datadog SDK, used to track performance of HTTP calls and enable Datadog Distributed Tracing.

Getting started #

To use the Datadog Dio Interceptor, call addDatadogInterceptor on your Dio object:

import 'package:datadog_dio/datadog_dio.dart'

Dio dio = Dio()
  // Other Dio configuration...
  ..addDatadogInterceptor(DatadogSdk.instance);

In order to enable Datadog Distributed Tracing, you also need to set the firstPartyHosts property when configuring Datadog.

import 'package:datadog_tracking_http_client/datadog_tracking_http_client.dart';

final configuration = DatadogConfiguration(
  // configuration
  firstPartyHosts: ['example.com'],
)

Use with other Dio interceptors #

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.

Contributing #

Pull requests are welcome. First, open an issue to discuss what you would like to change. For more information, read the Contributing guide in the root repository.

License #

Apache License, v2.0

0
likes
140
points
2.39k
downloads

Publisher

verified publisherdatadoghq.com

Weekly Downloads

Support tracking and distributed tracing of Dio network requests in Datadog.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

datadog_flutter_plugin, dio, flutter, uuid

More

Packages that depend on datadog_dio