-
Notifications
You must be signed in to change notification settings - Fork 600
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
Ruby 3.2 support - Report on the new VM's :constant_cache
stat instead of the old :global_constant_state
#1059
Comments
Update - PR #1088 delivers a backwards compatibility fix to ensure that Ruby 3.2 works with the existing way of reporting a single integer value to represent all constant cache invalidations. This issue will be left open to track efforts to consider / implement support for the new fine grained metrics themselves. The new hash can get pretty big (every Ruby constant gets a key) so reporting on the entire hash as option as we report VM metrics might not be a good idea. |
Ruby PR 5715 delivered Ruby 69967ee6 and reverted the change. Then Ruby PR 5766 came along and again removed the |
* Start using Ruby 3.2.0-preview2 for CI * Support Ruby 3.2's two separate VM stats, `:constant_cache_invalidations` and `:constant_cache_misses`. Prior to Ruby 3.2, Ruby offered a `:global_constant_state` VM stat that the New Relic Ruby agent used to report on constant cache invalidations. Ruby 3.2 offers improved statistics for constants and has replaced `:global_constant_state` with 2 new attributes, `:constant_cache_invalidations` and `:constant_cache_misses`. The New Relic Ruby agent will use `:constant_cache_invalidations` for its existing reporting of invalidations and will also start to report on constant cache misses when Ruby 3.2+ is present. Resolves #1059
Work has been completed on this issue. |
3 similar comments
Work has been completed on this issue. |
Work has been completed on this issue. |
Work has been completed on this issue. |
As per Ruby PR #5433, which satisfies feature #18589, the CRuby VM now provides finer grained control over the constants cache.
For Ruby 2.1.0 through 3.1.x, the Ruby agent has been making use of
RubyVM.stat[:global_constant_state]
to tally up cache invalidations (see:lib/new_relic/agent/vm/mri_vm.rb
).For Ruby 3.2+, the
RubyVM.stat
hash no longer has a:global_constant_state
key. Instead it now has a:constant_cache
key, and a hash as the corresponding value. That inner hash keeps track of cache on a per constant basis, with the constants themselves serving as the inner hash keys.My current guess is that we need to replace the existing call to
RubyVM.stat[:global_constant_state]
with something likeRubyVM.stat[:constant_cache].values.sum
, but I have not taken the time yet to thoroughly research the RubyVM change that took place.The text was updated successfully, but these errors were encountered: