dio icon indicating copy to clipboard operation
dio copied to clipboard

Feature Request: Support for Tracking Connection Time, Send Time, and Receive Time

Open TheWalkingDead2 opened this issue 1 year ago • 5 comments

Request Statement

Hello, Dio team!

Firstly, thanks for the incredible work on Dio—it’s been a very useful tool in our Flutter applications!

Feature Request We would like to request the ability to track detailed timing metrics for network requests. Specifically, it would be very helpful to have built-in support for recording:

  1. Connection Time: The time taken to establish a connection to the server.
  2. Send Time: The time taken to send the request data to the server.
  3. Receive Time: The time taken to receive the response data from the server.

Use Case Having access to these metrics would provide valuable insights into our app's network performance on mobile devices, allowing us to:

  1. Analyze endpoint performance across various mobile network conditions.
  2. Identify potential bottlenecks in the network request process.
  3. Collaborate with our backend team to pinpoint API endpoints that could benefit from optimization.

Solution Brainstorm

Potential Solution An option could be to expose these metrics via Dio's interceptors or add them as properties within the response metadata. This would allow developers to easily access the timings after a request completes.

Example of Desired Usage

final dio = Dio();
final response = await dio.get('https://example.com');

// Accessing timing metrics
print('Connection Time: ${response.connectionTime} ms');
print('Send Time: ${response.sendTime} ms');
print('Receive Time: ${response.receiveTime} ms');

Thanks for considering this request! Having these metrics would significantly improve our ability to monitor and optimize network performance on mobile devices.

TheWalkingDead2 avatar Nov 06 '24 01:11 TheWalkingDead2

@kuhnroyal We used to have similar discussion, right? Can't remember where it is...

AlexV525 avatar Nov 26 '24 03:11 AlexV525

@kuhnroyal We used to have similar discussion, right? Can't remember where it is...

hi,any update?

TheWalkingDead1024 avatar Dec 11 '24 06:12 TheWalkingDead1024

alternative package: dio_http2_adapter

BekNaji avatar Dec 16 '24 09:12 BekNaji

@kuhnroyal We used to have similar discussion, right? Can't remember where it is...

I think it was this one: https://github.com/cfug/dio/issues/2027

kuhnroyal avatar Feb 26 '25 16:02 kuhnroyal

hi,any update?

TheWalkingDead1024 avatar Jun 24 '25 08:06 TheWalkingDead1024