class Meter::Backends::Datadog
Public Class Methods
supported_metrics()
click to toggle source
# File lib/meter/backends/datadog.rb, line 7 def self.supported_metrics [:counter, :gauge, :timing, :histogram] end
Public Instance Methods
convert_to_backend_format(metric)
click to toggle source
# File lib/meter/backends/datadog.rb, line 11 def convert_to_backend_format(metric) rate = "|@#{metric.sample_rate}" unless metric.sample_rate == 1 tags = "|##{convert_tags_to_datadog_format(metric.tags)}" unless metric.tags.empty? "#{metric.name}:#{metric.value}|#{statsd_type(metric)}#{rate}#{tags}" end
statsd_type(metric)
click to toggle source
# File lib/meter/backends/datadog.rb, line 21 def statsd_type(metric) types = {counter: 'c', gauge: 'g', timing: 'ms', histogram: 'h'} types[metric.type] end