Skip to content
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

Fix calculation of Active Record :db_runtime metric #50493

Merged
merged 1 commit into from
Dec 31, 2023

Conversation

fatkodima
Copy link
Member

When using async queries inside controllers, I noticed too large db runtime values and negative view runtime values in the logs, something like:

Completed 200 OK in 133ms (Views: -25271.4ms | ActiveRecord: 25329.3ms | Allocations: 29036)

Turned out, that the problem is in a recent change from f56b418#diff-fc921d14f4dc8556c4b8cd785f350ec728fe07c8b884fbc3a0b4cbc9ec5eafffR28
There is no need to multiply by 1000, because the values are already in milliseconds.

cc @byroot

@byroot byroot merged commit f645ff9 into rails:main Dec 31, 2023
3 of 4 checks passed
byroot added a commit that referenced this pull request Dec 31, 2023
Fix calculation of Active Record :db_runtime metric
@byroot
Copy link
Member

byroot commented Dec 31, 2023

Thank you!

Backported to 7-1-stable.

@fatkodima fatkodima deleted the fix-calculation-of-db_runtime branch December 31, 2023 08:45
@rporrasluc rporrasluc mentioned this pull request Jan 16, 2024
4 tasks
casperisfine pushed a commit to Shopify/rails that referenced this pull request Jan 17, 2024
Ref: rails#43502
Fix: rails#50767
Fix: rails#50493

When republishing a an event into a `start, finish` tuple, we need
to convert the timestamps back into seconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants