Class: Temporal::Metrics
- Inherits:
-
Object
- Object
- Temporal::Metrics
- Defined in:
- lib/temporal/metrics.rb
Instance Method Summary collapse
- #count(key, count, tags = {}) ⇒ Object
- #decrement(key, tags = {}) ⇒ Object
- #gauge(key, value, tags = {}) ⇒ Object
- #increment(key, tags = {}) ⇒ Object
-
#initialize(adapter) ⇒ Metrics
constructor
A new instance of Metrics.
- #timing(key, time, tags = {}) ⇒ Object
Constructor Details
#initialize(adapter) ⇒ Metrics
Returns a new instance of Metrics.
3 4 5 |
# File 'lib/temporal/metrics.rb', line 3 def initialize(adapter) @adapter = adapter end |
Instance Method Details
#count(key, count, tags = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/temporal/metrics.rb', line 15 def count(key, count, = {}) adapter.count(key, count, ) rescue StandardError => error Temporal.logger.error("Adapter failed to send count metrics for #{key}: #{error.inspect}") end |
#decrement(key, tags = {}) ⇒ Object
11 12 13 |
# File 'lib/temporal/metrics.rb', line 11 def decrement(key, = {}) count(key, -1, ) end |
#gauge(key, value, tags = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/temporal/metrics.rb', line 21 def gauge(key, value, = {}) adapter.gauge(key, value, ) rescue StandardError => error Temporal.logger.error("Adapter failed to send gauge metrics for #{key}: #{error.inspect}") end |
#increment(key, tags = {}) ⇒ Object
7 8 9 |
# File 'lib/temporal/metrics.rb', line 7 def increment(key, = {}) count(key, 1, ) end |