Class: LogStash::Instrument::MetricType::Gauge
- Defined in:
- lib/logstash/instrument/metric_type/gauge.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #execute(action, value = nil) ⇒ Object
-
#initialize(namespaces, key) ⇒ Gauge
constructor
A new instance of Gauge.
- #value ⇒ Object
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 |
#value ⇒ Object
18 19 20 |
# File 'lib/logstash/instrument/metric_type/gauge.rb', line 18 def value @gauge.get end |