./lib/stackdriver.rb in stackdriver-0.2.1 vs ./lib/stackdriver.rb in stackdriver-0.2.2

- old
+ new

@@ -15,10 +15,15 @@ def self.send_metric name, value, time, instance='' msg = build_message name, value, time, instance post MultiJson.dump(msg), StackDriver::POST_URI end + def self.send_multi_metrics data + msg = build_multi_message data + post MultiJson.dump(msg), StackDriver::POST_URI + end + def self.delete_metric name, time msg = build_message name, nil, time post MultiJson.dump(msg), StackDriver::DELETE_URI end @@ -43,7 +48,16 @@ def self.build_message name, value, time, instance='' data_point = {'name' => name, 'value' => value, 'collected_at' => time} data_point.merge!('value' => value) unless value.nil? data_point.merge!('instance' => instance) unless instance.empty? {'timestamp' => Time.now.to_i, 'proto_version' => '1', 'data' => data_point} + end + + def self.build_multi_message data + data_point = data + { + 'timestamp' => Time.now.to_i, + 'proto_version' => '1', + 'data' => data_point + } end end