Class: PrometheusClientAddons::Prometheus::Client::MultiMetric
- Inherits:
-
Prometheus::Client::Metric
- Object
- Prometheus::Client::Metric
- PrometheusClientAddons::Prometheus::Client::MultiMetric
- Defined in:
- lib/prometheus_client_addons/prometheus/client/multi_metric.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base_labels ⇒ Object
readonly
Returns the value of attribute base_labels.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
-
#initialize(prefix: '', base_labels: {}) ⇒ MultiMetric
constructor
A new instance of MultiMetric.
- #multi_name_docstring ⇒ Object
- #multi_name_type ⇒ Object
- #multi_values ⇒ Object
Constructor Details
#initialize(prefix: '', base_labels: {}) ⇒ MultiMetric
Returns a new instance of MultiMetric.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/prometheus_client_addons/prometheus/client/multi_metric.rb', line 10 def initialize(prefix: '', base_labels: {}) prefix = "#{prefix}_" unless prefix == '' @prefix = prefix @name = prefix @base_labels = base_labels multi_name_type.keys.each { |name| validate_name("#{prefix}#{name}".to_sym) } multi_name_docstring.keys.each { |name| validate_name("#{prefix}#{name}".to_sym) } multi_name_docstring.values.each(&method(:validate_docstring)) @validator = ::Prometheus::Client::LabelSetValidator.new @validator.valid?(base_labels) end |
Instance Attribute Details
#base_labels ⇒ Object (readonly)
Returns the value of attribute base_labels.
8 9 10 |
# File 'lib/prometheus_client_addons/prometheus/client/multi_metric.rb', line 8 def base_labels @base_labels end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/prometheus_client_addons/prometheus/client/multi_metric.rb', line 8 def name @name end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
8 9 10 |
# File 'lib/prometheus_client_addons/prometheus/client/multi_metric.rb', line 8 def prefix @prefix end |
Instance Method Details
#multi_name_docstring ⇒ Object
28 29 30 |
# File 'lib/prometheus_client_addons/prometheus/client/multi_metric.rb', line 28 def multi_name_docstring fail('Should return hash {name => docstrings}') end |
#multi_name_type ⇒ Object
24 25 26 |
# File 'lib/prometheus_client_addons/prometheus/client/multi_metric.rb', line 24 def multi_name_type fail('Should return hash {name => type}') end |
#multi_values ⇒ Object
32 33 34 |
# File 'lib/prometheus_client_addons/prometheus/client/multi_metric.rb', line 32 def multi_values fail('Should return hash {name => {label_set => value, label_set => value, }}') end |