- Notifications
You must be signed in to change notification settings - Fork87
Add a timestamp to the Rook request object.#262
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
atheriel commentedApr 6, 2020
CI failures seem unrelated. |
wch commentedApr 6, 2020
The CI failures are due toRcppCore/Rcpp#1048. |
Requests objects now have a `httpuv.timestamp` member containing atimestamp compatible with Sys.time().This timestamp is captured when the request is received at the C++ levelin the background thread, which has two advantages:1. We can much more accurately capture the total time the client actually waits for the request to get processed.2. We can instrument the time it takes before the R-level callback actually runs.More broadly, the timestamp makes it easier to log measures of requestlatency in httpuv-based applications, and reduces the overhead of commonways to do so -- e.g. using Plumber hooks.Signed-off-by: Aaron Jacobs <aaron.jacobs@crescendotechnology.com>
atheriel commentedMay 5, 2021
Tweaked slightly and rebased to fix merge conflicts. |
CLAassistant commentedNov 8, 2023
|
Uh oh!
There was an error while loading.Please reload this page.
This PR adds a
httpuv.timestampmember containing a timestamp compatible withSys.time()to the Rook request object. You can use these timestamps it to measure and report on request latency:Importantly, this timestamp is captured when the request is received at the C++ level in the background thread, which has two advantages:
We can much more accurately capture the total time the client actually waits for the request to get processed, especially if the R thread is congested or running GC.
We can instrument the time it takes before the R-level callback actually runs.
More broadly, the timestamp makes it easier to log measures of request latency in
httpuv-based applications, and reduces the overhead of common ways to do so -- e.g. using Plumber hooks.I'm unsure about whether
httpuv.timestampis a good name, and am happy to take suggestions for improvements.Also, I have little faith in my C++ (though I've made sure to use C++11-compatible interfaces here).
Finally, if you're interested in R's internal
Sys.time()implementation, the source is intime.c:currentTime().