Class: Puma::Kubernetes::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/puma/kubernetes/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(clustered: false) ⇒ Parser

Returns a new instance of Parser.



6
7
8
9
# File 'lib/puma/kubernetes/parser.rb', line 6

def initialize(clustered: false)
  register_default_metrics
  register_clustered_metrics if clustered
end

Instance Method Details

#parse(symbol_keyed_stats, labels = {}) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/puma/kubernetes/parser.rb', line 11

def parse(symbol_keyed_stats, labels = {})
  symbol_keyed_stats.each do |key, value|
    value.each { |s| parse(s, labels.merge(index: s[:index])) } if key == :worker_status
    parse(value, labels) if key == :last_status
    update_metric(key, value, labels)
  end
end