Class: PrometheusExporter::Client::RemoteMetric
- Inherits:
-
Object
- Object
- PrometheusExporter::Client::RemoteMetric
- Defined in:
- lib/prometheus_exporter/client.rb
Instance Attribute Summary collapse
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #decrement(keys = nil, value = 1) ⇒ Object
- #increment(keys = nil, value = 1) ⇒ Object
-
#initialize(name:, help:, type:, client:, opts: nil) ⇒ RemoteMetric
constructor
A new instance of RemoteMetric.
- #observe(value = 1, keys = nil) ⇒ Object
- #standard_values(value, keys, prometheus_exporter_action = nil) ⇒ Object
Constructor Details
#initialize(name:, help:, type:, client:, opts: nil) ⇒ RemoteMetric
Returns a new instance of RemoteMetric.
11 12 13 14 15 16 17 |
# File 'lib/prometheus_exporter/client.rb', line 11 def initialize(name:, help:, type:, client:, opts: nil) @name = name @help = help @client = client @type = type @opts = opts end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
9 10 11 |
# File 'lib/prometheus_exporter/client.rb', line 9 def help @help end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/prometheus_exporter/client.rb', line 9 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/prometheus_exporter/client.rb', line 9 def type @type end |
Instance Method Details
#decrement(keys = nil, value = 1) ⇒ Object
42 43 44 |
# File 'lib/prometheus_exporter/client.rb', line 42 def decrement(keys = nil, value = 1) @client.send_json(standard_values(value, keys, :decrement)) end |
#increment(keys = nil, value = 1) ⇒ Object
38 39 40 |
# File 'lib/prometheus_exporter/client.rb', line 38 def increment(keys = nil, value = 1) @client.send_json(standard_values(value, keys, :increment)) end |
#observe(value = 1, keys = nil) ⇒ Object
34 35 36 |
# File 'lib/prometheus_exporter/client.rb', line 34 def observe(value = 1, keys = nil) @client.send_json(standard_values(value, keys)) end |
#standard_values(value, keys, prometheus_exporter_action = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/prometheus_exporter/client.rb', line 19 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 |