Class: Hawkular::Inventory::Metric

Inherits:
BaseEntity show all
Includes:
MetricFields
Defined in:
lib/hawkular/inventory/entities.rb

Overview

Definition of a Metric inside the inventory.

Instance Attribute Summary collapse

Attributes included from MetricFields

#collection_interval, #type, #unit

Attributes inherited from BaseEntity

#env, #feed, #id, #name, #path, #properties

Instance Method Summary collapse

Methods inherited from BaseEntity

#==, #to_h

Constructor Details

#initialize(metric_hash) ⇒ Metric

Returns a new instance of Metric



108
109
110
111
112
113
114
115
116
# File 'lib/hawkular/inventory/entities.rb', line 108

def initialize(metric_hash)
  super(metric_hash)
  @type = metric_hash['type']['type']
  @type_path = metric_hash['type']['path']
  @type_id = metric_hash['type']['id']
  @unit = metric_hash['type']['unit']
  @collection_interval = metric_hash['type']['collectionInterval']
  @hawkular_metric_id = @properties.key?('hawkular-metric-id') ? @properties['hawkular-metric-id'] : @id
end

Instance Attribute Details

#hawkular_metric_idString (readonly)

Returns metric id used in Hawkular Metrics

Returns:

  • (String)

    metric id used in Hawkular Metrics



106
107
108
# File 'lib/hawkular/inventory/entities.rb', line 106

def hawkular_metric_id
  @hawkular_metric_id
end

#type_idObject (readonly)

Returns the value of attribute type_id



104
105
106
# File 'lib/hawkular/inventory/entities.rb', line 104

def type_id
  @type_id
end