Sha256: 207454dfc8b7202e0fcec28279199733341c2f5b07c221589c215caf697aa940

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

module Rtsd
  class Client
    attr_reader :connection

    def initialize(options = {})
      @connection = Rtsd::Connection.new(options)
    end

    def put(params)
      metric    = params.fetch(:metric)
      timestamp = params[:timestamp] || Time.now.to_i
      value     = params.fetch(:value).to_f
      tags      = params.fetch(:tags, []).map{|k,v| "#{k}=#{v}"}.join(" ")
      connection.puts "put %s %d %s %s" % [metric, timestamp, value, tags]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtsd-0.0.1 lib/rtsd/client.rb