Exception: SplitIoClient::Metrics
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::Metrics
- Defined in:
- lib/splitclient-rb/engine/metrics/metrics.rb
Overview
class to handle cached metrics
Instance Attribute Summary collapse
-
#counts ⇒ object
cached counts.
-
#gauges ⇒ object
cached gauges.
-
#latencies ⇒ object
cached latencies.
-
#queue_size ⇒ int
quese size for cached arrays.
Instance Method Summary collapse
-
#count(counter, delta) ⇒ Object
creates a new entry in the array for cached counts.
-
#gauge(gauge, value) ⇒ Object
creates a new entry in the array for cached gauges.
-
#initialize(queue_size, repository) ⇒ Metrics
constructor
A new instance of Metrics.
-
#time(operation, time_in_ms) ⇒ Object
creates a new entry in the array for cached time metrics.
Constructor Details
#initialize(queue_size, repository) ⇒ Metrics
Returns a new instance of Metrics.
35 36 37 38 39 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 35 def initialize(queue_size, repository) @queue_size = queue_size @binary_search = SplitIoClient::BinarySearchLatencyTracker.new @repository = repository end |
Instance Attribute Details
#counts ⇒ object
cached counts
21 22 23 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 21 def counts @counts end |
#gauges ⇒ object
cached gauges
27 28 29 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 27 def gauges @gauges end |
#latencies ⇒ object
cached latencies
15 16 17 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 15 def latencies @latencies end |
#queue_size ⇒ int
quese size for cached arrays
33 34 35 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 33 def queue_size @queue_size end |
Instance Method Details
#count(counter, delta) ⇒ Object
creates a new entry in the array for cached counts
48 49 50 51 52 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 48 def count(counter, delta) return if (delta <= 0) || counter.nil? || counter.strip.empty? @repository.add_count(counter, delta) end |
#gauge(gauge, value) ⇒ Object
creates a new entry in the array for cached gauges
74 75 76 77 78 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 74 def gauge(gauge, value) return if gauge.nil? || gauge.empty? @repository.add_gauge(gauge, value) end |
#time(operation, time_in_ms) ⇒ Object
creates a new entry in the array for cached time metrics
61 62 63 64 65 |
# File 'lib/splitclient-rb/engine/metrics/metrics.rb', line 61 def time(operation, time_in_ms) return if operation.nil? || operation.empty? || time_in_ms < 0 @repository.add_latency(operation, time_in_ms, @binary_search) end |