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.



94
95
96
# File 'lib/atatus/metrics/metric.rb', line 94

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.



104
105
106
107
108
# File 'lib/atatus/metrics/metric.rb', line 104

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.



98
99
100
101
102
# File 'lib/atatus/metrics/metric.rb', line 98

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