lib/rtsd/client.rb in rtsd-0.0.1 vs lib/rtsd/client.rb in rtsd-0.0.2
- old
+ new
@@ -8,10 +8,12 @@
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(" ")
+ tags = params.fetch(:tags).map{|k,v| "#{k}=#{v}"}.join(" ")
connection.puts "put %s %d %s %s" % [metric, timestamp, value, tags]
+ rescue KeyError => e
+ raise ArgumentError, e.message
end
end
end