class Hash

Monkey patch Hash to make it Prometheus compatible

Monkey patching hash

Public Instance Methods

fetch2(key, default) click to toggle source
# File _plugins/notebook.rb, line 9
def fetch2(key, default)
  fetch(key, default) || default
end
to_prometheus() click to toggle source
# File _plugins/gtn/metrics.rb, line 8
def to_prometheus
  if keys.length.positive?
    inner = map { |k, v| "#{k}=\"#{v}\"" }.join(',')
    "{#{inner}}"
  else
    ''
  end
end