Class: Hawkular::Inventory::Metric

Inherits:
Object
  • Object
show all
Defined in:
lib/hawkular/inventory/entities.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameString (readonly)

Returns Display Name of the metric.

Returns:

  • (String)

    Display Name of the metric



7
8
9
# File 'lib/hawkular/inventory/entities.rb', line 7

def display_name
  @display_name
end

#expressionString (readonly)

Returns Promql expression for fetching the time series.

Returns:

  • (String)

    Promql expression for fetching the time series



11
12
13
# File 'lib/hawkular/inventory/entities.rb', line 11

def expression
  @expression
end

#familyString (readonly)

Returns Family of the metric (Prometheus family name).

Returns:

  • (String)

    Family of the metric (Prometheus family name)



9
10
11
# File 'lib/hawkular/inventory/entities.rb', line 9

def family
  @family
end

#labelsHash<String,String> (readonly)

Returns Labels of this metric (Prometheus labels).

Returns:

  • (Hash<String,String>)

    Labels of this metric (Prometheus labels)



15
16
17
# File 'lib/hawkular/inventory/entities.rb', line 15

def labels
  @labels
end

#nameString (readonly)

Returns Provider Name of the metric.

Returns:

  • (String)

    Provider Name of the metric



5
6
7
# File 'lib/hawkular/inventory/entities.rb', line 5

def name
  @name
end

#propertiesHash<String,String> (readonly)

Returns Properties of this metric.

Returns:

  • (Hash<String,String>)

    Properties of this metric



17
18
19
# File 'lib/hawkular/inventory/entities.rb', line 17

def properties
  @properties
end

#unitString (readonly)

Returns Unit of the metric.

Returns:

  • (String)

    Unit of the metric



13
14
15
# File 'lib/hawkular/inventory/entities.rb', line 13

def unit
  @unit
end

Instance Method Details

#to_hHash<String,Object>

Returns a hash representation of the metric type

Returns:

  • (Hash<String,Object>)

    hash of the metric type



32
33
34
# File 'lib/hawkular/inventory/entities.rb', line 32

def to_h
  @_hash.dup
end