./lib/stackdriver.rb in stackdriver-0.1.1 vs ./lib/stackdriver.rb in stackdriver-0.2.0

- old
+ new

@@ -6,12 +6,12 @@ def self.init customer_id, api_key @customer_id = customer_id @api_key = api_key end - def self.send_metric name, value, time - msg = build_message name, value, time + def self.send_metric name, value, time, instance='' + msg = build_message name, value, time, instance post MultiJson.dump(msg) end private @@ -29,12 +29,12 @@ raise RuntimeError, "#{response.code} - #{response.body}" end end end - def self.build_message name, value, time + def self.build_message name, value, time, instance='' data_point = {'name' => name, 'value' => value, 'collected_at' => time} - + data_point.merge!('instance' => instance) unless instance.empty? {'timestamp' => Time.now.to_i, 'customer_id' => @customer_id, 'proto_version' => '1', 'data' => data_point} end end