Class: LogStash::Instrument::MetricType::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/instrument/metric_type/base.rb

Direct Known Subclasses

Counter, Gauge, Mean

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespaces, key) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/logstash/instrument/metric_type/base.rb', line 8

def initialize(namespaces, key)
  @namespaces = namespaces
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



6
7
8
# File 'lib/logstash/instrument/metric_type/base.rb', line 6

def key
  @key
end

#namespacesObject (readonly)

Returns the value of attribute namespaces.



6
7
8
# File 'lib/logstash/instrument/metric_type/base.rb', line 6

def namespaces
  @namespaces
end

Instance Method Details

#inspectObject



13
14
15
# File 'lib/logstash/instrument/metric_type/base.rb', line 13

def inspect
  "#{self.class.name} - namespaces: #{namespaces} key: #{key} value: #{value}"
end

#to_hashObject



17
18
19
20
21
# File 'lib/logstash/instrument/metric_type/base.rb', line 17

def to_hash
  {
    key => value
  }
end

#to_json_dataObject



23
24
25
# File 'lib/logstash/instrument/metric_type/base.rb', line 23

def to_json_data
  value
end

#typeObject



27
28
29
# File 'lib/logstash/instrument/metric_type/base.rb', line 27

def type
  @type ||= LogStash::Util.class_name(self).downcase
end