Class: Atatus::Metrics::Counter Private

Inherits:
Metric
  • Object
show all
Defined in:
lib/atatus/metrics/metric.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Metric

#initial_value, #key, #tags, #value

Instance Method Summary collapse

Methods inherited from Metric

#collect, #reset!, #reset_on_collect?, #tags?

Constructor Details

#initialize(key, initial_value: 0, **args) ⇒ Counter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Counter.



92
93
94
# File 'lib/atatus/metrics/metric.rb', line 92

def initialize(key, initial_value: 0, **args)
  super(key, initial_value: initial_value, **args)
end

Instance Method Details

#dec!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



102
103
104
105
106
# File 'lib/atatus/metrics/metric.rb', line 102

def dec!
  @mutex.synchronize do
    @value -= 1
  end
end

#inc!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



96
97
98
99
100
# File 'lib/atatus/metrics/metric.rb', line 96

def inc!
  @mutex.synchronize do
    @value += 1
  end
end