-
Notifications
You must be signed in to change notification settings - Fork 181
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
Change in behavior in activerecord from 6.1 to 7.0+ #1183
Comments
In case it's helpful, what I've seen:
|
I wanted to report this difference in behavior in case it's of interest and if we want to recover this behavior or we're okay. We have found it a bit confusing to have these spans sometimes and sometimes not. We actually found a few performance problems from N+1 type of queries that didn't actually fire queries because of the ActiveRecord Query Cache, but were a performance problem when running thousands of times in the same request. Is there any intention of switching the activerecord instrumentation to be based on activesupport notifiactions? Thank you! |
@mrsimo thank you for sharing these findings. We could use your help making the active record instrumentation better. Would you be interested in helping us by contributing compatibility changes? |
I recall there were gaps between the notification approach and monkey patching from our last discussion. Are these issues still persistent? The payload name is too general (see discussion), but it might help reduce span name cardinality. Also, there are discussion about the timing issue from callback. |
👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the |
Yes the limitations remain with using notifications. |
I believe this was fixed in #1184, with recent versions of the activerecord instrumentation library again producing the same amount of spans. I'm going to close this issue! |
Description of the bug
In Rails 6.1 (and 6.0) there used to be an ActiveRecord span for each read query in the form of
Model.find_by_sql
. We found a few uses for this span, even if the underlaying query was also reported by the lower level library instrumentation as well.With Rails 7.0 this has changed and only a few queries have this. For instance,
Post.first
doesn't create aPost.find_by_sql
span, but apost.comments
does create aComment.find_by_sql
. In Rails 6.1 there'd both of them.Share details about your runtime
My reproduction steps were run with
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin23]
, latest opentelemetry gems and various Rails versions (as seen in the script).Share a simplified reproduction if possible
Here's a gist with a script to reproduce this. The output:
The text was updated successfully, but these errors were encountered: