Class: PrometheusExporter::Client::RemoteMetric

Inherits:
Object
  • Object
show all
Defined in:
lib/prometheus_exporter/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, help:, type:, client:) ⇒ RemoteMetric

Returns a new instance of RemoteMetric.



9
10
11
12
13
14
# File 'lib/prometheus_exporter/client.rb', line 9

def initialize(name:, help:, type:, client:)
  @name = name
  @help = help
  @client = client
  @type = type
end

Instance Method Details

#observe(value = 1, keys = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/prometheus_exporter/client.rb', line 16

def observe(value = 1, keys = nil)
  @client.send_json(
    type: @type,
    help: @help,
    name: @name,
    keys: keys,
    value: value
  )
end