Sha256: a38b476f2ffd83738356dc497118e2956f854d9ab54be378c66ad68f1ab47bd7

Contents?: true

Size: 817 Bytes

Versions: 3

Compression:

Stored size: 817 Bytes

Contents

require 'frankenstein/collected_metric'

module Frankenstein
  # Allow registration of metrics for Ruby GC statistics.
  #
  module RubyGCMetrics
    # Register Ruby GC metrics.
    #
    # For every statistic provided by the Ruby VM under the module method
    # `GC.stat`, a metric is registered named `ruby_gc_<stat>`, which
    # provides a dimensionless metric with the value of the statistic.
    #
    # @param registry [Prometheus::Client::Registry] specify the metrics
    #    registry in which to register the GC-related metrics.
    #
    def self.register(registry = Prometheus::Client.registry)
      GC.stat.each do |k, v|
        Frankenstein::CollectedMetric.new(:"ruby_gc_#{k}", "Ruby GC parameter #{k}", registry: registry) do
          { {} => GC.stat[k] }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frankenstein-1.2.0 lib/frankenstein/ruby_gc_metrics.rb
frankenstein-1.1.1 lib/frankenstein/ruby_gc_metrics.rb
frankenstein-1.1.0 lib/frankenstein/ruby_gc_metrics.rb