Class: ElasticAPM::Metrics::Timer Private
- Defined in:
- lib/elastic_apm/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 collapse
- #count ⇒ Object private
Attributes inherited from Metric
#initial_value, #key, #tags, #value
Instance Method Summary collapse
-
#initialize(key, **args) ⇒ Timer
constructor
private
A new instance of Timer.
- #reset! ⇒ Object private
- #update(duration, delta: 0) ⇒ Object private
Methods inherited from Metric
#collect, #reset_on_collect?, #tags?
Constructor Details
#initialize(key, **args) ⇒ Timer
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 Timer.
120 121 122 123 |
# File 'lib/elastic_apm/metrics/metric.rb', line 120 def initialize(key, **args) super(key, initial_value: 0, **args) @count = 0 end |
Instance Attribute Details
#count ⇒ 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.
125 126 127 |
# File 'lib/elastic_apm/metrics/metric.rb', line 125 def count @count end |
Instance Method Details
#reset! ⇒ 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.
134 135 136 137 138 139 |
# File 'lib/elastic_apm/metrics/metric.rb', line 134 def reset! @mutex.synchronize do @value = 0 @count = 0 end end |
#update(duration, delta: 0) ⇒ 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.
127 128 129 130 131 132 |
# File 'lib/elastic_apm/metrics/metric.rb', line 127 def update(duration, delta: 0) @mutex.synchronize do @value += duration @count += delta end end |