atatus_dio 1.0.4
atatus_dio: ^1.0.4 copied to clipboard
Support tracking and distributed tracing of Dio network requests in Atatus.
Atatus Dio integration #
A package for use with Dio and the Atatus SDK, used to track performance of HTTP calls and enable Atatus Distributed Tracing.
Getting started #
To use the Atatus Dio Interceptor, call addAtatusInterceptor on your Dio object:
import 'package:atatus_dio/atatus_dio.dart'
Dio dio = Dio()
// Other Dio configuration...
..addAtatusInterceptor(AtatusSdk.instance);
In order to enable Atatus Distributed Tracing, you also need to set the firstPartyHosts property when configuring Atatus.
import 'package:atatus_tracking_http_client/atatus_tracking_http_client.dart';
final configuration = AtatusConfiguration(
// configuration
firstPartyHosts: ['example.com'],
)
Use with other Dio interceptors #
addAtatusInterceptor adds the Atatus interceptor as the first interceptor in your list of interceptors, which is important to ensure that all network requests from Dio are sent to Atatus, as other interceptors may decide not to forward information down the interceptor chain. For this reason, it is important to make sure you call addAtatusInterceptor after any other configuration of Dio is complete.
Use with other Atatus Network Tracking #
Clients that want to track all network requests, including those made by dart:io and widgets like NetworkImage can continue to use atatus_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