-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Recording accurate job durations #1053
Comments
This is really interesting! And totally makes sense that we should try to be as accurate as possible for calculating those durations) Some thoughts:
If that all makes sense, I would accept a PR if you wanted to calculate the duration of a job using the monotonic clock and use that to calculate the finished_at/errored_at (and anywhere else you find; like batches too I think) |
For latency, the problem is essentially not solvable; postgres lacks a "monotonic timestamp" function, and multi-machine clock consistency should be out of scope. If all clock calls use |
That's a bummer, but also makes sense that would likely be very difficult to implement for a cluster.
I'm generally reluctant to make schema changes. I think we should make best effort to be accurate, but I imagine storing the host alongside timestamps would have very niche usage. |
Currently, good_job records the start and end time of a job.
That seems like it should be enough to calculate the job runtime, except... during NTP adjustments it can result in a negative duration.
Using
Process.clock_gettime(Process::CLOCK_MONOTONIC)
to calculate start/end times would also be sufficient if you didn't want the extra overhead of storing duration.The text was updated successfully, but these errors were encountered: