Sha256: c1a80548069487b80c9a7fad3848df72ae1d5698e0dde9855ee40a83b9e55772

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 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}", docstring: "Ruby GC parameter #{k}", registry: registry) do
          { {} => GC.stat[k] }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frankenstein-2.1.0 lib/frankenstein/ruby_gc_metrics.rb
frankenstein-2.0.0 lib/frankenstein/ruby_gc_metrics.rb