module Metrics::StatsdApi

This adds a statsd compatible api that delegates back to instrument

Public Instance Methods

count(stat, count, options = {}) click to toggle source
# File lib/metrics/statsd_api.rb, line 12
def count(stat, count, options = {})
  instrument stat, count, options.merge(type: 'count')
end
decrement(stat, options = {}) click to toggle source
# File lib/metrics/statsd_api.rb, line 8
def decrement(stat, options = {})
  instrument stat, -1, options.merge(type: 'count')
end
gauge(stat, value, options = {}) click to toggle source
# File lib/metrics/statsd_api.rb, line 16
def gauge(stat, value, options = {})
  instrument stat, value, options.merge(type: 'measure')
end
histogram(stat, value, options = {}) click to toggle source
# File lib/metrics/statsd_api.rb, line 20
def histogram(stat, value, options = {})
  instrument stat, value, options.merge(type: 'histogram')
end
increment(stat, options = {}) click to toggle source
# File lib/metrics/statsd_api.rb, line 4
def increment(stat, options = {})
  instrument stat, 1, options.merge(type: 'count')
end
time(stat, options = {}) { || ... } click to toggle source
# File lib/metrics/statsd_api.rb, line 28
def time(stat, options = {})
  instrument stat, options do
    yield
  end
end
timing(stat, ms, options = {}) click to toggle source
# File lib/metrics/statsd_api.rb, line 24
def timing(stat, ms, options = {})
  instrument stat, ms, options.merge(type: 'measure', units: 'ms')
end