class FFWD::Plugin::Statsd::Connection

Public Class Methods

new(bind, core, config) click to toggle source
# File lib/ffwd/plugin/statsd/connection.rb, line 22
def initialize bind, core, config
  @bind = bind
  @core = core
  @key = config[:key]
end

Protected Instance Methods

receive_statsd_frame(data) click to toggle source
# File lib/ffwd/plugin/statsd/connection.rb, line 30
def receive_statsd_frame(data)
  frame = Parser.parse(data)
  a = {:what => frame[:key]}
  m = {:key => @key, :proc => frame[:proc], :attributes => a,
       :value => frame[:value]}
  @core.input.metric m
  @bind.increment :received_metrics
rescue ParserError => e
  log.error "Invalid frame '#{data}': #{e}"
  @bind.increment :failed_metrics
rescue => e
  log.error "Error when parsing metric '#{data}'", e
  @bind.increment :failed_metrics
end