Module: Frankenstein::RubyGCMetrics

Defined in:
lib/frankenstein/ruby_gc_metrics.rb

Overview

Allow registration of metrics for Ruby GC statistics.

Class Method Summary collapse

Class Method Details

.register(registry = Prometheus::Client.registry) ⇒ Object

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.

Parameters:

  • registry (Prometheus::Client::Registry) (defaults to: Prometheus::Client.registry)

    specify the metrics registry in which to register the GC-related metrics.



16
17
18
19
20
21
22
# File 'lib/frankenstein/ruby_gc_metrics.rb', line 16

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