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_type) ⇒ Metric

Returns a new instance of Metric



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

def initialize(metric_hash, metric_type)
  super(metric_hash)
  @type = metric_type.type
  @type_path = metric_hash['metricTypePath']
  @type_id = metric_type.id
  @unit = metric_type.unit
  @collection_interval = metric_hash['collectionInterval'] || metric_type.collection_interval
  @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



108
109
110
# File 'lib/hawkular/inventory/entities.rb', line 108

def hawkular_metric_id
  @hawkular_metric_id
end

#type_idObject (readonly)

Returns the value of attribute type_id



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

def type_id
  @type_id
end