module FFWD::Plugin::Riemann::Output

Public Instance Methods

output_encode(message) click to toggle source
# File lib/ffwd/plugin/riemann/output.rb, line 75
def output_encode message
  raise "#output_encode: not implemented"
end
output_failed_event(event, error;) click to toggle source
# File lib/ffwd/plugin/riemann/output.rb, line 79
def output_failed_event event, error; end
output_failed_metric(metric, error;) click to toggle source
# File lib/ffwd/plugin/riemann/output.rb, line 80
def output_failed_metric metric, error; end
receive_data(data) click to toggle source
# File lib/ffwd/plugin/riemann/output.rb, line 69
def receive_data data
  message = read_message data
  return if message.ok
  @bad_acks = (@bad_acks || 0) + 1
end
send_all(events, metrics) click to toggle source
# File lib/ffwd/plugin/riemann/output.rb, line 20
def send_all events, metrics
  all_events = []

  events.each do |event|
    begin
      all_events << make_event(event)
    rescue => error
      output_failed_event event, error
    end
  end

  metrics.each do |metric|
    begin
      all_events << make_metric(metric)
    rescue => error
      output_failed_metric metric, error
    end
  end

  return if all_events.empty?

  m = make_message :events => all_events
  send_data output_encode(m)
end
send_event(event) click to toggle source
# File lib/ffwd/plugin/riemann/output.rb, line 45
def send_event event
  begin
    e = make_event event
  rescue => error
    output_failed_event event, error
    return
  end

  m = make_message :events => [e]
  send_data output_encode(m)
end
send_metric(metric) click to toggle source
# File lib/ffwd/plugin/riemann/output.rb, line 57
def send_metric metric
  begin
    e = make_metric metric
  rescue => error
    output_failed_metric event, error
    return
  end

  m = make_message :events => [e]
  send_data output_encode(m)
end