-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track request duration #2027
Comments
I should note that we are using the http2 adapter by the way |
As far as I know, ngrok is a backend service, correct? What makes you think that clients request duration should equal to server's? |
You can look at how Sentry traces the time here: https://github.com/getsentry/sentry-dart/blob/main/dio/lib/src/breadcrumb_client_adapter.dart |
They report the response time it takes from sending the request to receiving the answer. Same as I would expect this interceptor to do. I also tried verifying by proxying through Charles; same incorrect results for some reason. And it's not just a few ms. It's a request taking 100ms is sometimes tracked as 600ms with stopwatch; so I am simply trying to understand what layers might be in between the interceptors and what can be done to get more accurate reports |
Nice! Will check it out |
Seems like this answers my question: https://github.com/getsentry/sentry-dart/blob/main/dio/lib/src/breadcrumb_client_adapter.dart#L12 |
@kuhnroyal Did we match the circumstance to close the issue? Could we implement a duration interceptor or a general adapter on our own? |
I don't know, we could add the timing to the |
I am trying to accomplish something similar and have a custom RequestTimeInterceptor working. The time I calculate using a stopwatch between onRequest and onResponse in the interceptor matches roughly what the DevTools Network page shows. What is strange though is there is a ~200 ms delay before onRequest is called. Some sample code:
The interceptor is just printing times in onRequest and onResponse and I see the following in the debug console:
Does anyone with more understanding of Dio know what happens between the call to .get() and the interceptor calling onRequest()? Edit: I think this may be the time that it takes to setup the socket? I don't think I should consider that part of the request time for telemetry reporting. |
Request Statement
I'd like a way to track request durations. Initially I thought I could simply create an interceptor that would keep track of each request and then using
StopWatch
. However, it's been proven to log much longer duration than ngrok is reporting.This is the code that reports invalid request duration (e.g. code reports 600ms, but ngrok reports 53ms).
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: