Class: PrometheusClientAddons::Prometheus::Client::GC

Inherits:
MultiMetric
  • Object
show all
Defined in:
lib/prometheus_client_addons/prometheus/client/gc.rb

Constant Summary collapse

KEYS =
[
  :count,
  :heap_allocated_pages,
  :heap_sorted_length,
  :heap_allocatable_pages,
  :heap_available_slots,
  :heap_live_slots,
  :heap_free_slots,
  :heap_final_slots,
  :heap_marked_slots,
  :heap_eden_pages,
  :heap_tomb_pages,
  :total_allocated_pages,
  :total_freed_pages,
  :total_allocated_objects,
  :total_freed_objects,
  :malloc_increase_bytes,
  :malloc_increase_bytes_limit,
  :minor_gc_count,
  :major_gc_count,
  :remembered_wb_unprotected_objects,
  :remembered_wb_unprotected_objects_limit,
  :old_objects,
  :old_objects_limit,
  :oldmalloc_increase_bytes,
  :oldmalloc_increase_bytes_limit
].freeze
HANDLES =
Hash[KEYS.zip(KEYS)].freeze

Instance Attribute Summary

Attributes inherited from MultiMetric

#base_labels, #name, #prefix

Instance Method Summary collapse

Methods inherited from MultiMetric

#initialize

Constructor Details

This class inherits a constructor from PrometheusClientAddons::Prometheus::Client::MultiMetric

Instance Method Details

#multi_name_docstringObject



43
44
45
# File 'lib/prometheus_client_addons/prometheus/client/gc.rb', line 43

def multi_name_docstring
  Hash[HANDLES.map { |key, value| ["#{prefix}#{key}".to_sym, value] }]
end

#multi_name_typeObject



38
39
40
41
# File 'lib/prometheus_client_addons/prometheus/client/gc.rb', line 38

def multi_name_type
  full_handles = HANDLES.keys.map { |key| "#{prefix}#{key}" }.map(&:to_sym)
  Hash[full_handles.zip([:gauge] * HANDLES.size)]
end

#multi_valuesObject



47
48
49
50
# File 'lib/prometheus_client_addons/prometheus/client/gc.rb', line 47

def multi_values
  stat = ::GC.stat
  Hash[stat.map { |key, value| ["#{prefix}#{key}".to_sym, { {} => value }] }]
end