class Meter::Backends::Statsd

Public Class Methods

supported_metrics() click to toggle source
# File lib/meter/backends/statsd.rb, line 7
def self.supported_metrics
  [:counter, :gauge, :timing]
end

Public Instance Methods

convert_to_backend_format(metric) click to toggle source
# File lib/meter/backends/statsd.rb, line 11
def convert_to_backend_format(metric)
  rate = "|@#{metric.sample_rate}" unless metric.sample_rate == 1
  "#{metric.name}:#{metric.value}|#{statsd_type(metric)}#{rate}"
end
statsd_type(metric) click to toggle source
# File lib/meter/backends/statsd.rb, line 16
def statsd_type(metric)
  types = {counter: 'c', gauge: 'g', timing: 'ms'}
  types[metric.type]
end