Class: PrometheusClientAddons::Prometheus::Client::CustomCollector
- Inherits:
-
Prometheus::Client::Metric
- Object
- Prometheus::Client::Metric
- PrometheusClientAddons::Prometheus::Client::CustomCollector
- Defined in:
- lib/prometheus_client_addons/prometheus/client/custom_collector.rb
Instance Method Summary collapse
- #get(labels = {}) ⇒ Object
-
#initialize(name:, docstring:, base_labels: {}, &block) ⇒ CustomCollector
constructor
A new instance of CustomCollector.
- #type ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(name:, docstring:, base_labels: {}, &block) ⇒ CustomCollector
Returns a new instance of CustomCollector.
7 8 9 10 |
# File 'lib/prometheus_client_addons/prometheus/client/custom_collector.rb', line 7 def initialize(name:, docstring:, base_labels: {}, &block) @custom_collector = block super(name.to_sym, docstring, base_labels) end |
Instance Method Details
#get(labels = {}) ⇒ Object
12 13 14 |
# File 'lib/prometheus_client_addons/prometheus/client/custom_collector.rb', line 12 def get(labels = {}) @custom_collector.call end |
#type ⇒ Object
20 21 22 |
# File 'lib/prometheus_client_addons/prometheus/client/custom_collector.rb', line 20 def type :gauge end |
#values ⇒ Object
16 17 18 |
# File 'lib/prometheus_client_addons/prometheus/client/custom_collector.rb', line 16 def values { {} => @custom_collector.call } end |