class PrometheusExporter::Client::RemoteMetric

Attributes

help[R]
name[R]
type[R]

Public Class Methods

new(name:, help:, type:, client:, opts: nil) click to toggle source
# File lib/prometheus_exporter/client.rb, line 12
def initialize(name:, help:, type:, client:, opts: nil)
  @name = name
  @help = help
  @client = client
  @type = type
  @opts = opts
end

Public Instance Methods

decrement(keys = nil, value = 1) click to toggle source
# File lib/prometheus_exporter/client.rb, line 41
def decrement(keys = nil, value = 1)
  @client.send_json(standard_values(value, keys, :decrement))
end
increment(keys = nil, value = 1) click to toggle source
# File lib/prometheus_exporter/client.rb, line 37
def increment(keys = nil, value = 1)
  @client.send_json(standard_values(value, keys, :increment))
end
observe(value = 1, keys = nil) click to toggle source
# File lib/prometheus_exporter/client.rb, line 33
def observe(value = 1, keys = nil)
  @client.send_json(standard_values(value, keys))
end
standard_values(value, keys, prometheus_exporter_action = nil) click to toggle source
# File lib/prometheus_exporter/client.rb, line 20
def standard_values(value, keys, prometheus_exporter_action = nil)
  values = {
    type: @type,
    help: @help,
    name: @name,
    keys: keys,
    value: value
  }
  values[:prometheus_exporter_action] = prometheus_exporter_action if prometheus_exporter_action
  values[:opts] = @opts if @opts
  values
end