Module: Metrics::StatsdApi
Overview
This adds a statsd compatible api that delegates back to #instrument
Instance Method Summary collapse
- #count(stat, count, options = {}) ⇒ Object
- #decrement(stat, options = {}) ⇒ Object
- #gauge(stat, value, options = {}) ⇒ Object
- #histogram(stat, value, options = {}) ⇒ Object
- #increment(stat, options = {}) ⇒ Object
- #time(stat, options = {}) ⇒ Object
- #timing(stat, ms, options = {}) ⇒ Object
Instance Method Details
#count(stat, count, options = {}) ⇒ Object
12 13 14 |
# File 'lib/metrics/statsd_api.rb', line 12 def count(stat, count, = {}) instrument stat, count, .merge(type: 'count') end |
#decrement(stat, options = {}) ⇒ Object
8 9 10 |
# File 'lib/metrics/statsd_api.rb', line 8 def decrement(stat, = {}) instrument stat, -1, .merge(type: 'count') end |
#gauge(stat, value, options = {}) ⇒ Object
16 17 18 |
# File 'lib/metrics/statsd_api.rb', line 16 def gauge(stat, value, = {}) instrument stat, value, .merge(type: 'measure') end |
#histogram(stat, value, options = {}) ⇒ Object
20 21 22 |
# File 'lib/metrics/statsd_api.rb', line 20 def histogram(stat, value, = {}) instrument stat, value, .merge(type: 'histogram') end |
#increment(stat, options = {}) ⇒ Object
4 5 6 |
# File 'lib/metrics/statsd_api.rb', line 4 def increment(stat, = {}) instrument stat, 1, .merge(type: 'count') end |
#time(stat, options = {}) ⇒ Object
28 29 30 31 32 |
# File 'lib/metrics/statsd_api.rb', line 28 def time(stat, = {}) instrument stat, do yield end end |
#timing(stat, ms, options = {}) ⇒ Object
24 25 26 |
# File 'lib/metrics/statsd_api.rb', line 24 def timing(stat, ms, = {}) instrument stat, ms, .merge(type: 'measure', units: 'ms') end |