Sha256: 566e02e69810d03f8df1b01368ca1cb1b4aff584f5b08d0ad739b8f46beac752

Contents?: true

Size: 433 Bytes

Versions: 15

Compression:

Stored size: 433 Bytes

Contents

class FnordMetric::UDPClient

  def initialize(host, port)
    @sock = UDPSocket.new
    @sock.connect(host, port)
  end

  def event(event_data)
    begin
      if event_data.is_a?(Hash)
        event_data = event_data.to_json
      else
        JSON.parse(event_data) # void ;)
      end
    rescue JSON::ParserError
      FnordMetric.log("event_lost: can't parse json")
    else
      @sock.send(event_data, 0)
    end
  end

end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
johnf-fnordmetric-1.2.10 lib/fnordmetric/udp_client.rb
fnordmetric-1.2.9 lib/fnordmetric/udp_client.rb
johnf-fnordmetric-1.2.7 lib/fnordmetric/udp_client.rb
bp-fnordmetric-1.2.7 lib/fnordmetric/udp_client.rb
fnordmetric-1.2.7 lib/fnordmetric/udp_client.rb
fnordmetric-1.2.6 lib/fnordmetric/udp_client.rb
fnordmetric-1.2.4 lib/fnordmetric/udp_client.rb
fnordmetric-1.2.1 lib/fnordmetric/udp_client.rb
fnordmetric-1.2.0 lib/fnordmetric/udp_client.rb
fnordmetric-1.0.1 lib/fnordmetric/udp_client.rb
fnordmetric-1.0.0 lib/fnordmetric/udp_client.rb
fnordmetric-0.9.7 lib/fnordmetric/udp_client.rb
fnordmetric-0.7.5 lib/fnordmetric/udp_client.rb
fnordmetric-0.7.4 lib/fnordmetric/udp_client.rb
fnordmetric-0.7.3 lib/fnordmetric/udp_client.rb