Class: NewRelic::Agent::Utilization::GCP

Inherits:
Vendor
  • Object
show all
Defined in:
lib/new_relic/agent/utilization/gcp.rb

Constant Summary collapse

MACH_TYPE =
'machineType'.freeze
ZONE =
'zone'.freeze

Constants inherited from Vendor

Vendor::SUCCESS

Instance Attribute Summary

Attributes inherited from Vendor

#metadata

Instance Method Summary collapse

Methods inherited from Vendor

#detect, endpoint, headers, #initialize, key_transforms, keys, processed_headers, vendor_name

Constructor Details

This class inherits a constructor from NewRelic::Agent::Utilization::Vendor

Instance Method Details

#prepare_response(response) ⇒ Object



20
21
22
23
24
25
# File 'lib/new_relic/agent/utilization/gcp.rb', line 20

def prepare_response(response)
  body = JSON.parse(response.body)
  body[MACH_TYPE] = trim_leading(body[MACH_TYPE])
  body[ZONE] = trim_leading(body[ZONE])
  body
end

#trim_leading(value) ⇒ Object



27
28
29
# File 'lib/new_relic/agent/utilization/gcp.rb', line 27

def trim_leading(value)
  value.split(NewRelic::SLASH).last
end