lib/yodeler/metric.rb in yodeler-0.1.2 vs lib/yodeler/metric.rb in yodeler-0.1.3

- old
+ new

@@ -17,10 +17,11 @@ @prefix = opts.delete(:prefix) @sample_rate = opts.delete(:sample_rate) @timestamp = opts.delete(:timestamp) @tags = opts.delete(:tags) @hostname = opts.delete(:hostname) + @meta = opts.delete(:meta) || {} #additional meta data to send end def name @prefix ? [@prefix, @name].join('.') : @name end @@ -33,15 +34,16 @@ def to_hash hash = { uuid: uuid, name: name, type: @type, - value: @value + value: @value, + meta: @meta } - hash[:timestamp] = @timestamp if @timestamp - hash[:tags] = @tags if @tags && @tags.any? - hash[:hostname] = @hostname if @hostname + hash[:meta][:timestamp] = @timestamp if @timestamp + hash[:meta][:tags] = @tags if @tags && @tags.any? + hash[:meta][:hostname] = @hostname if @hostname hash end TYPES.each do |type_meth|