Sha256: c05649a73c58ab3458eac27ace13da58134a6c85857e2a3e3376f813b3dee047

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

require 'frankenstein/collected_metric'

module Frankenstein
  # Allow registration of metrics for Ruby VM statistics.
  #
  module RubyVMMetrics
    # 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.
    #
    # @param registry [Prometheus::Client::Registry] specify the metrics
    #    registry in which to register the GC-related metrics.
    #
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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