Sha256: 1cc249e918d83654155283c72fabda1f4662b6156f1305ee07df7dfcf1749839

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frankenstein-1.2.0 lib/frankenstein/ruby_vm_metrics.rb