-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
AS::Notifications measuring with Time.now vs CPU clock #34271
Comments
I think we should backport this to 5.2 since we have identified that the current implementation is buggy. If we don't want to include any features we could consider just backporting a portion of the PR that swaps from Time to Process.clock_gettime. |
|
This will avoid issues with the machine chaging time. Closes #34271.
I backported in 7c45421 by only applying the change in the clock. |
❤️ ❤️ ❤️ |
So now how do you now get the wall clock time for when an event started to send to a system like e.g. Influx? I suppose we could just instrument everything in our subscribers using |
At Shopify, we measure and log how much time a request has spent talking to all kinds of external resources: Redis, Memcache, ActiveRecord. Most of that is implemented by wrapping the request into
AS::Notification
subscription and reporting the delta between event'sstart
andend
(which is aTime
object).At the same time we have other middlewares that report total request time, which is using a delta between CPU clock (
Process.clock_gettime(Process::CLOCK_MONOTONIC)
).We've started noticing some weird data in out logs:
How come that total request time is 30 times less than time spent within the request?
The difference comes from
total
measured using CPU clock whilememcache
anddb
measured withAS::Notification
using deltas ofTime.now
. That's what gives us such inaccurate results when comparing two things measured in different ways.I noticed this has been recently fixed by @eileencodes in #33449.
Given that the PR was targeted for 6.0, can we consider this a bug and back port it to 5.2? 🙏
The text was updated successfully, but these errors were encountered: