class DataDogMetricsBackend
Public Class Methods
new(host: 'localhost', port: 8125, logger: Logging.logger(STDOUT))
click to toggle source
# File lib/mm_metrics/backends/dd.rb, line 6 def initialize(host: 'localhost', port: 8125, logger: Logging.logger(STDOUT)) @statsd = get_statsd(host, port) @logger = logger end
Public Instance Methods
gauge(metric, value, tags: [])
click to toggle source
# File lib/mm_metrics/backends/dd.rb, line 21 def gauge(metric, value, tags: []) @logger.debug "gauge #{metric} to #{value}" @statsd.gauge(metric, value, tags: tags) end
get_statsd(host, port)
click to toggle source
# File lib/mm_metrics/backends/dd.rb, line 11 def get_statsd(host, port) Datadog::Statsd.new(host, port) end
histogram(metric, value, tags: [])
click to toggle source
# File lib/mm_metrics/backends/dd.rb, line 27 def histogram(metric, value, tags: []) @logger.debug "histogram #{metric} to #{value}" @statsd.histogram(metric, value, tags: tags) end
increment(metric, tags: [])
click to toggle source
# File lib/mm_metrics/backends/dd.rb, line 15 def increment(metric, tags: []) @logger.debug "increment #{metric}" @statsd.increment(metric, tags: tags) end
timed(metric, duration, tags: [])
click to toggle source
# File lib/mm_metrics/backends/dd.rb, line 33 def timed(metric, duration, tags: []) @logger.debug "time #{metric} as #{duration}" @statsd.timing(metric, duration, tags: tags) end