Class: LogStash::Instrument::MetricType::Gauge

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

Instance Attribute Summary

Attributes inherited from Base

#key, #namespaces

Instance Method Summary collapse

Methods inherited from Base

#inspect, #to_hash, #to_json_data, #type

Constructor Details

#initialize(namespaces, key) ⇒ Gauge

Returns a new instance of Gauge.



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

def initialize(namespaces, key)
  super(namespaces, key)

  @gauge = Concurrent::MutexAtomicReference.new()
end

Instance Method Details

#execute(action, value = nil) ⇒ Object



14
15
16
# File 'lib/logstash/instrument/metric_type/gauge.rb', line 14

def execute(action, value = nil)
  @gauge.set(value)
end

#valueObject



18
19
20
# File 'lib/logstash/instrument/metric_type/gauge.rb', line 18

def value
  @gauge.get
end