Home

Awesome

Yabeda::GC

Built in metrics for monitoring the Ruby garbage collector. Part of the yabeda suite.

Installation

Add this line to your application's Gemfile:

gem 'yabeda-gc'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install yabeda-gc

Metrics

MetricDescription
countCount of all GCs
timeThe total time spent in garbage collections (ruby 3+)
minor_gc_countCount of minor GCs
major_gc_countCount of major GCs
heap_allocated_pagesTotal number of pages allocated for the heap
heap_sorted_lengthLength of the sorted heap
heap_allocatable_pagesTotal number of allocatable heap pages
heap_available_slotsTotal number of slots in heap pages
heap_live_slotsNumber of live objects slots
heap_free_slotsNumber of free object slots
heap_final_slotsNumber of object slots with finalizers attached to them
heap_marked_slotsCount of old objects which survived more than 3 GC cycles and number of write-barrier unprotected objects
heap_eden_pagesNumber of pages allocated for the eden heap
heap_tomb_pagesNumber of pages allocated for the tomb heap
total_allocated_pagesTotal number of allocated pages over the lifetime of this process
total_freed_pagesTotal number of freed pages over the lifetime of this process
total_allocated_objectsTotal number of allocated objects over the lifetime of this process
total_freed_objectsTotal number of freed objects over the lifetime of this process
malloc_increase_bytesTotal bytes allocated to objects
malloc_increase_bytes_limitBytes limit that will trigger garbage collection of objects
remembered_wb_unprotected_objectsNumber of write-barrier unprotected objects in the remembered set
remembered_wb_unprotected_objects_limitLimit on write-barrier unprotected objects allowed in the remembered set
old_objectsNumber of old objects
old_objects_limitLimit of old objects
oldmalloc_increase_bytesTotal bytes allocated to old objects
oldmalloc_increase_bytes_limitBytes limit that will trigger garbage collection of old objects
compact_countCount of all GC compactions
read_barrier_faultsThe total number of times the read barrier was triggered during compaction (ruby 3+)
total_moved_objectsThe total number of objects compaction has moved (ruby 3+)
marking_timeThe total time spent in marking phase (ruby 3.3+)
sweeping_timeThe total time spent in sweeping phase (ruby 3.3+)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Releasing

  1. Bump version number in lib/yabeda/gc/version.rb

    In case of pre-releases keep in mind rubygems/rubygems#3086 and check version with command like Gem::Version.new(Yabeda::gc::VERSION).to_s

  2. Fill CHANGELOG.md with missing changes, add header with version and date.

  3. Make a commit:

    bundle # to update Gemfile.lock
    git add lib/yabeda/gc/version.rb CHANGELOG.md Gemfile.lock
    version=$(ruby -r ./lib/yabeda/gc/version.rb -e "puts Gem::Version.new(Yabeda::GC::VERSION)")
    git commit --message="${version}: " --edit
    
  4. Create annotated tag:

    git tag v${version} --annotate --message="${version}: " --edit --sign
    
  5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically)

  6. Push it:

    git push --follow-tags
    
  7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done!

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ianks/yabeda-gc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Yabeda::GC project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.