Class: Evil::Metrics::Counter

Inherits:
Metric
  • Object
show all
Defined in:
lib/evil/metrics/counter.rb

Overview

Growing-only counter

Instance Attribute Summary

Attributes inherited from Metric

#comment, #group, #name, #per, #unit

Instance Method Summary collapse

Methods inherited from Metric

#get, #initialize

Constructor Details

This class inherits a constructor from Evil::Metrics::Metric

Instance Method Details

#increment(tags, by: 1) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/evil/metrics/counter.rb', line 7

def increment(tags, by: 1)
  values[tags] += by
  ::Evil::Metrics.adapters.each do |_, adapter|
    adapter.perform_counter_increment!(self, tags, by)
  end
  values[tags]
end

#valuesObject



15
16
17
# File 'lib/evil/metrics/counter.rb', line 15

def values
  @values ||= Concurrent::Hash.new(0)
end