Module: StackDriver

Defined in:
lib/stackdriver.rb

Constant Summary collapse

POST_URI =
"https://custom-gateway.stackdriver.com/v1/custom"
DELETE_URI =
"https://custom-gateway.stackdriver.com/v1/delete_custom"

Class Method Summary collapse

Class Method Details

.delete_metric(name, time) ⇒ Object



25
26
27
28
# File 'lib/stackdriver.rb', line 25

def self.delete_metric name, time
  msg = build_message name, nil, time
  post MultiJson.dump(msg), StackDriver::DELETE_URI
end

.init(*args) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/stackdriver.rb', line 7

def self.init *args  
  if args.count > 1
    puts "Customer ID is no longer needed, and will be deprecated"
    args.shift
  end
  @api_key = args[0]
end

.send_metric(name, value, time, instance = '') ⇒ Object



15
16
17
18
# File 'lib/stackdriver.rb', line 15

def self.send_metric name, value, time, instance=''
  msg = build_message name, value, time, instance
  post MultiJson.dump(msg), StackDriver::POST_URI
end

.send_multi_metrics(data) ⇒ Object



20
21
22
23
# File 'lib/stackdriver.rb', line 20

def self.send_multi_metrics data
  msg = build_multi_message data
  post MultiJson.dump(msg), StackDriver::POST_URI
end