Module: Frankenstein::RubyVMMetrics

Defined in:
lib/frankenstein/ruby_vm_metrics.rb

Overview

Allow registration of metrics for Ruby VM statistics.

Class Method Summary collapse

Class Method Details

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

Register Ruby VM metrics.

For every statistic provided by the Ruby VM under the module method RubyVM.stat, a metric is registered named ruby_vm_<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_vm_metrics.rb', line 16

def self.register(registry = Prometheus::Client.registry)
  RubyVM.stat.each do |k, v|
    Frankenstein::CollectedMetric.new(:"ruby_vm_#{k}", docstring: "Ruby VM parameter #{k}", registry: registry) do
      { {} => RubyVM.stat[k] }
    end
  end
end