class Yabeda::Statsd::Adapter

Adapter for statsd

Attributes

connection[R]

Public Class Methods

new(connection:) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 12
def initialize(connection:)
  @connection = connection
end

Public Instance Methods

perform_counter_increment!(counter, tags, increment) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 20
def perform_counter_increment!(counter, tags, increment)
  tags = Yabeda::Statsd::Tags.build(tags)
  connection.increment(build_name(counter), by: increment, tags: tags)
end
perform_gauge_set!(gauge, tags, value) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 29
def perform_gauge_set!(gauge, tags, value)
  tags = Yabeda::Statsd::Tags.build(tags)
  connection.gauge(build_name(gauge), value, tags: tags)
end
perform_histogram_measure!(historam, tags, value) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 38
def perform_histogram_measure!(historam, tags, value)
  tags = Yabeda::Statsd::Tags.build(tags)
  connection.histogram(build_name(historam), value, tags: tags)
end
register_counter!(_) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 16
def register_counter!(_)
  # We don't need to register metric
end
register_gauge!(_) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 25
def register_gauge!(_)
  # We don't need to register metric
end
register_histogram!(_) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 34
def register_histogram!(_)
  # We don't need to register metric
end

Private Instance Methods

build_name(metric) click to toggle source
# File lib/yabeda/statsd/adapter.rb, line 45
def build_name(metric)
  [metric.group, metric.name, metric.unit].compact.join("_").to_sym
end