-
-
Notifications
You must be signed in to change notification settings - Fork 67
Metrics API #88
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
Metrics API #88
Conversation
|
Currently there's a bug somewhere in here where All the other timers are returning values accurate to at least 1ms. |
|
Found the issue with timing metric accuracy, it is an upstream compilation issue. Curl is falling back to the following internal implementation of struct curltime Curl_now(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
*/
struct curltime now;
now.tv_sec = time(NULL);
now.tv_usec = 0;
return now;
}This is why the metrics are so imprecise. I will create an upstream patch to fix this build configuration issue. |
|
Upstream PR: alexcrichton/curl-rust#305 |
|
Precision down to 1ms is probably "good enough" but would it be possible to have even more precision? |
|
Technically yeah, curl 7.61.0 (relatively new) added new Unless we can do some sort of feature-detection at runtime... theoretically it would be possible. Another option would be to switch between the old and new flags at compile time based on whether Also note that the precision available is also highly dependent on what system clocks curl is compiled to use (which we also can't control when using the system-wide curl). |
|
Compile time feature/checks with a static-curl sounds preferable to avoid any runtime overhead. |
|
The |
|
There's a few things that curl actually doesn't track, like distinguishing between request upload time and response download time. Ideally we'd be able to provide a bit more info, like the fields available in the JavaScript timing API that look quite reasonable: https://developer.mozilla.org/en-US/docs/Web/API/Resource_Timing_API/Using_the_Resource_Timing_API. We should be able to augment curl's existing metrics by adding our own measurements in a few key callback functions, but I will leave this for a future PR. For now, I left the API somewhat conservative to start with so we can get it into developer's hands to experiment with. |
Initial implementation of #47. Metrics are collected at every progress callback and written to a set of shared fields that can be read back by accessing the
Metricsobject throughResponseExt.