lib/ganymed/client.rb in ganymed-0.1.1 vs lib/ganymed/client.rb in ganymed-0.1.2

- old
+ new

@@ -63,11 +63,11 @@ # @param [String, Symbol] ds Sample data source. # @param [String] ns {Event} namespace. # @param [Fixnum, Float] value Sample value. # @param [Time] now Sample timestamp. def emit(ds, ns, value, now=Time.now.utc) - data = [ds.to_s, ns, @origin, now.to_i + (now.usec * 1e-6), value.to_f] + data = [ds.to_s, ns, @origin, now.to_f, value.to_f] send(data.pack("Z*Z*Z*GG")) end end ## @@ -80,26 +80,26 @@ # @param [String] ns {Event} namespace. # @param [Object] value {Event} value. # @param [Hash] opts Options # @option opts [String] cf Consolidation function used in this event. # @option opts [Time] now {Event} timestamp. + # @option opts [Fixnum] resolution {Event} resolution. # @option opts [String] origin {Event} origin. - # @option opts [Array] modifiers Event modifiers. def event(ns, value, opts={}) opts = { :cf => nil, :now => Time.now.utc, + :resolution => 0, :origin => @origin, - :modifiers => [], }.merge(opts) { :_type => :event, :n => ns, - :m => opts[:modifiers], :c => opts[:cf], :o => opts[:origin], :t => opts[:now].to_i, + :r => opts[:resolution].to_i, :v => value }.tap do |data| send(data.to_msgpack) end end