Class: Hawkular::Inventory::Metric
- Inherits:
-
Object
- Object
- Hawkular::Inventory::Metric
- Defined in:
- lib/hawkular/inventory/entities.rb
Instance Attribute Summary collapse
-
#display_name ⇒ String
readonly
Display Name of the metric.
-
#expression ⇒ String
readonly
Promql expression for fetching the time series.
-
#family ⇒ String
readonly
Family of the metric (Prometheus family name).
-
#labels ⇒ Hash<String,String>
readonly
Labels of this metric (Prometheus labels).
-
#name ⇒ String
readonly
Provider Name of the metric.
-
#properties ⇒ Hash<String,String>
readonly
Properties of this metric.
-
#unit ⇒ String
readonly
Unit of the metric.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Metric
constructor
A new instance of Metric.
-
#to_h ⇒ Hash<String,Object>
Returns a hash representation of the metric type.
Constructor Details
#initialize(hash) ⇒ Metric
Returns a new instance of Metric.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/hawkular/inventory/entities.rb', line 19 def initialize(hash) @name = hash['displayName'] @display_name = hash['displayName'] @family = hash['family'] @expression = hash['expression'] @unit = hash['unit'] @labels = hash['labels'] || {} @properties = hash['properties'] || {} @_hash = hash.dup end |
Instance Attribute Details
#display_name ⇒ String (readonly)
Returns Display Name of the metric.
7 8 9 |
# File 'lib/hawkular/inventory/entities.rb', line 7 def display_name @display_name end |
#expression ⇒ String (readonly)
Returns Promql expression for fetching the time series.
11 12 13 |
# File 'lib/hawkular/inventory/entities.rb', line 11 def expression @expression end |
#family ⇒ String (readonly)
Returns Family of the metric (Prometheus family name).
9 10 11 |
# File 'lib/hawkular/inventory/entities.rb', line 9 def family @family end |
#labels ⇒ Hash<String,String> (readonly)
Returns Labels of this metric (Prometheus labels).
15 16 17 |
# File 'lib/hawkular/inventory/entities.rb', line 15 def labels @labels end |
#name ⇒ String (readonly)
Returns Provider Name of the metric.
5 6 7 |
# File 'lib/hawkular/inventory/entities.rb', line 5 def name @name end |
#properties ⇒ Hash<String,String> (readonly)
Returns Properties of this metric.
17 18 19 |
# File 'lib/hawkular/inventory/entities.rb', line 17 def properties @properties end |
#unit ⇒ String (readonly)
Returns Unit of the metric.
13 14 15 |
# File 'lib/hawkular/inventory/entities.rb', line 13 def unit @unit end |
Instance Method Details
#to_h ⇒ Hash<String,Object>
Returns a hash representation of the metric type
32 33 34 |
# File 'lib/hawkular/inventory/entities.rb', line 32 def to_h @_hash.dup end |