fog-google 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/examples/monitoring/metric_descriptors.rb +1 -1
  4. data/examples/monitoring/monitored_resource_descriptors.rb +24 -0
  5. data/examples/monitoring/timeseries_collection.rb +13 -8
  6. data/lib/fog/google/models/monitoring/metric_descriptor.rb +7 -4
  7. data/lib/fog/google/models/monitoring/metric_descriptors.rb +4 -6
  8. data/lib/fog/google/models/monitoring/monitored_resource_descriptor.rb +20 -0
  9. data/lib/fog/google/models/monitoring/monitored_resource_descriptors.rb +26 -0
  10. data/lib/fog/google/models/monitoring/timeseries.rb +5 -3
  11. data/lib/fog/google/models/monitoring/timeseries_collection.rb +19 -12
  12. data/lib/fog/google/monitoring.rb +10 -10
  13. data/lib/fog/google/monitoring/mock.rb +1 -1
  14. data/lib/fog/google/monitoring/real.rb +1 -1
  15. data/lib/fog/google/requests/monitoring/list_metric_descriptors.rb +181 -124
  16. data/lib/fog/google/requests/monitoring/list_monitored_resource_descriptors.rb +63 -0
  17. data/lib/fog/google/requests/monitoring/list_timeseries.rb +50 -31
  18. data/lib/fog/google/version.rb +1 -1
  19. metadata +7 -13
  20. data/examples/monitoring/timeseries_descriptors.rb +0 -27
  21. data/lib/fog/google/models/monitoring/timeseries_descriptor.rb +0 -20
  22. data/lib/fog/google/models/monitoring/timeseries_descriptors.rb +0 -31
  23. data/lib/fog/google/requests/monitoring/list_timeseries_descriptors.rb +0 -87
  24. data/tests/models/monitoring/metric_descriptors_tests.rb +0 -9
  25. data/tests/models/monitoring/timeseries_collection_tests.rb +0 -9
  26. data/tests/models/monitoring/timeseries_descriptors_tests.rb +0 -10
  27. data/tests/requests/monitoring/metric_descriptor_tests.rb +0 -22
  28. data/tests/requests/monitoring/timeseries_collection_tests.rb +0 -22
  29. data/tests/requests/monitoring/timeseries_descriptor_tests.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 700ff2a01dca32bc1c4508a52cc1b579f1bb42ca
4
- data.tar.gz: 4c469d31400a3a9fb0787de5fe25cd4ccda3db03
3
+ metadata.gz: 9f523ba80fe04d0964f24b91dd5972d5a1761171
4
+ data.tar.gz: 0ec90da4720232b7cecec4262c4f2f93798b0366
5
5
  SHA512:
6
- metadata.gz: 9669170e0b975040b8c44bd054fe51b30408c0fef952431635bd051fe63dc4f4916dc7d186fa4811c0f31b6d06dec2cf6e37e5e3dd6f1f30af87d1d361425a5f
7
- data.tar.gz: efba4ba3ddffa5346f4d18eae18bcd491d69788dcc0cbd870d128e4e92132659d49e0845fc4735f922ca44ebfa97be25c3d40c123ccf42c707b3039130d6c901
6
+ metadata.gz: 5188db685057edfdd2d96e0a754a66aedb81ef62e416086f9888ca4dc851d1338bac5e46c4ae0d21e83fbbee73518474d9ef96a6868df2510b2dae06ee18abb8
7
+ data.tar.gz: b6620918dd17cb4e759e1cde19b90e322039b00779f78a0c4ef70539d47b3fd881fafa7df1a9ed3faba162a51c70a10204a4bc3c8a18e350a59e87b4c279f746
data/README.md CHANGED
@@ -34,7 +34,12 @@ Fog implements [v1](https://cloud.google.com/dns/api/v1/) of the Google Cloud DN
34
34
 
35
35
  ## Monitoring
36
36
 
37
- Fog implements [v2beta2](https://cloud.google.com/monitoring/v2beta2/) of the Google Cloud Monitoring API. As of 2016-03-15, we believe Fog for Google Cloud Monitoring is feature complete. We are always looking for people to improve our code and test coverage, so please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.
37
+ Fog mostly implements [v3](https://cloud.google.com/monitoring/api/ref_v3/rest/) of the Google Cloud Monitoring API.
38
+
39
+ As of 2017-09-26, some less common API methods are missing and may be added as requested. Feature requests or pull requests for
40
+ additions are welcome.
41
+
42
+ We are always looking for people to improve our code and test coverage, so please [file issues](https://github.com/fog/fog-google/issues) for any anomalies you see or features you would like.
38
43
 
39
44
  ## Pubsub
40
45
 
@@ -17,7 +17,7 @@ def test
17
17
 
18
18
  puts "\nListing all MetricDescriptors related to Google Compute Engine..."
19
19
  puts "-----------------------------------------------------------------"
20
- md = connection.metric_descriptors.all(:query => "compute")
20
+ md = connection.metric_descriptors.all(:filter => 'metric.type = starts_with("compute.googleapis.com")')
21
21
  puts "Number of compute metric descriptors: #{md.length}"
22
22
  end
23
23
 
@@ -0,0 +1,24 @@
1
+ # All examples presume that you have a ~/.fog credentials file set up.
2
+ # # More info on it can be found here: http://fog.io/about/getting_started.html
3
+ #
4
+ require "bundler"
5
+ Bundler.require(:default, :development)
6
+ # Uncomment this if you want to make real requests to GCE (you _will_ be billed!)
7
+ # WebMock.disable!
8
+ #
9
+
10
+ def test
11
+ connection = Fog::Google::Monitoring.new
12
+
13
+ puts "Listing all MonitoredResourceDescriptors..."
14
+ puts "--------------------------------"
15
+ md = connection.monitored_resource_descriptors
16
+ puts "Number of all monitored resource descriptors: #{md.length}"
17
+
18
+ puts "\nListing MonitoredResourceDescriptors related to Google Compute Engine..."
19
+ puts "-----------------------------------------------------------------"
20
+ md = connection.monitored_resource_descriptors.all(:filter => 'resource.type = starts_with("gce_")')
21
+ puts "Number of compute monitored resource : #{md.length}"
22
+ end
23
+
24
+ test
@@ -8,19 +8,24 @@ Bundler.require(:default, :development)
8
8
 
9
9
  def test
10
10
  connection = Fog::Google::Monitoring.new
11
-
12
- puts "Listing all Timeseries for the metric compute.googleapis.com/instance/uptime..."
11
+ interval = {
12
+ :start_time => (DateTime.now - 1).rfc3339,
13
+ :end_time => DateTime.now.rfc3339
14
+ }
15
+ puts "Listing Timeseries from the last hour for metric compute.googleapis.com/instance/uptime..."
13
16
  puts "-------------------------------------------------------------------------------"
14
- tc = connection.timeseries_collection.all("compute.googleapis.com/instance/uptime",
15
- DateTime.now.rfc3339)
17
+ tc = connection.timeseries_collection.all(:filter => 'metric.type = "compute.googleapis.com/instance/uptime"',
18
+ :interval => interval)
16
19
  puts "Number of matches: #{tc.length}"
17
20
 
18
- puts "\nListing all Timeseries for the metric compute.googleapis.com/instance/uptime &"
21
+ puts "\nListing all Timeseries for metric compute.googleapis.com/instance/uptime &"
19
22
  puts "the region us-central1..."
20
23
  puts "------------------------------------------------------------------------------"
21
- tc = connection.timeseries_collection.all("compute.googleapis.com/instance/uptime",
22
- DateTime.now.rfc3339,
23
- :labels => "cloud.googleapis.com/location=~us-central1.*")
24
+ filter = [
25
+ 'metric.type = "compute.googleapis.com/instance/uptime"',
26
+ 'resource.label.zone = "us-central1-c"'
27
+ ].join(" AND ")
28
+ tc = connection.timeseries_collection.all(:filter => filter, :interval => interval)
24
29
  puts "Number of matches: #{tc.length}"
25
30
  end
26
31
 
@@ -4,16 +4,19 @@ module Fog
4
4
  module Google
5
5
  class Monitoring
6
6
  ##
7
- # A metricDescriptor defines the name, label keys, and data type of a particular metric.
7
+ # A metricDescriptor defines a metric type and its schema.
8
8
  #
9
- # @see https://cloud.google.com/monitoring/v2beta2/metricDescriptors#resource
9
+ # @see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricDescriptor
10
10
  class MetricDescriptor < Fog::Model
11
11
  identity :name
12
12
 
13
13
  attribute :description
14
+ attribute :display_name, :aliases => "displayName"
14
15
  attribute :labels
15
- attribute :project
16
- attribute :type_descriptor, :aliases => "typeDescriptor"
16
+ attribute :metric_kind, :aliases => "metricKind"
17
+ attribute :type
18
+ attribute :value_type, :aliases => "valueType"
19
+ attribute :unit
17
20
  end
18
21
  end
19
22
  end
@@ -11,15 +11,13 @@ module Fog
11
11
  # Lists all Metric Descriptors.
12
12
  #
13
13
  # @param [Hash] options Optional query parameters.
14
- # @option options [String] count Maximum number of time series descriptors per page. Used for pagination.
14
+ # @option options [String] page_size Maximum number of metric descriptors per page. Used for pagination.
15
15
  # @option options [String] page_token The pagination token, which is used to page through large result sets.
16
- # @option options [String] query The query used to search against existing metrics. Separate keywords with a space;
17
- # the service joins all keywords with AND, meaning that all keywords must match for a metric to be returned.
18
- # If this field is omitted, all metrics are returned. If an empty string is passed with this field,
19
- # no metrics are returned.
16
+ # @option options [String] filter Monitoring filter specifying which metric descriptors are to be returned.
17
+ # @see https://cloud.google.com/monitoring/api/v3/filters filter documentation
20
18
  # @return [Array<Fog::Google::Monitoring::MetricDescriptor>] List of Metric Descriptors.
21
19
  def all(options = {})
22
- data = service.list_metric_descriptors(options).body["metrics"] || []
20
+ data = service.list_metric_descriptors(options).body["metricDescriptors"] || []
23
21
  load(data)
24
22
  end
25
23
  end
@@ -0,0 +1,20 @@
1
+ require "fog/core/model"
2
+
3
+ module Fog
4
+ module Google
5
+ class Monitoring
6
+ ##
7
+ # A monitoredResourceDescriptor defines a metric type and its schema.
8
+ #
9
+ # @see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.monitoredResourceDescriptors#MonitoredResourceDescriptor
10
+ class MonitoredResourceDescriptor < Fog::Model
11
+ identity :name
12
+
13
+ attribute :description
14
+ attribute :display_name, :aliases => "displayName"
15
+ attribute :type
16
+ attribute :labels
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ require "fog/core/collection"
2
+ require "fog/google/models/monitoring/monitored_resource_descriptor"
3
+
4
+ module Fog
5
+ module Google
6
+ class Monitoring
7
+ class MonitoredResourceDescriptors < Fog::Collection
8
+ model Fog::Google::Monitoring::MonitoredResourceDescriptor
9
+
10
+ ##
11
+ # Lists all Monitored Resource Descriptors.
12
+ #
13
+ # @param [Hash] options Optional query parameters.
14
+ # @option options [String] page_size Maximum number of metric descriptors per page. Used for pagination.
15
+ # @option options [String] page_token The pagination token, which is used to page through large result sets.
16
+ # @option options [String] filter The monitoring filter used to search against existing descriptors.
17
+ # See
18
+ # @return [Array<Fog::Google::Monitoring::MetricDescriptor>] List of Monitored Resource Descriptors.
19
+ def all(options = {})
20
+ data = service.list_monitored_resource_descriptors(options).body["resourceDescriptors"] || []
21
+ load(data)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -6,10 +6,12 @@ module Fog
6
6
  ##
7
7
  # A time series is a collection of data points that represents the value of a metric of a project over time.
8
8
  #
9
- # @see https://developers.google.com/cloud-monitoring/v2beta1/timeseries
9
+ # https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list
10
10
  class Timeseries < Fog::Model
11
- identity :time_series_desc, :aliases => "timeseriesDesc"
12
-
11
+ attribute :metric
12
+ attribute :resource
13
+ attribute :metric_kind, :aliases => "metricKind"
14
+ attribute :value_type, :aliases => "valueType"
13
15
  attribute :points
14
16
  end
15
17
  end
@@ -10,19 +10,26 @@ module Fog
10
10
  ##
11
11
  # Lists all Timeseries.
12
12
  #
13
- # @param [String] metric The name of the metric (Metric names are protocol-free URLs).
14
- # @param [String] youngest End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.
15
- # @param [Hash] options Optional query parameters.
16
- # @option options [String] count Maximum number of time series descriptors per page. Used for pagination.
17
- # @option options [String] labels A collection of labels for the matching time series.
18
- # @option options [String] oldest Start of the time interval (exclusive), which is expressed as an RFC 3339
19
- # timestamp.
20
- # @options options [String] page_token The pagination token, which is used to page through large result sets.
21
- # @options options [String] timespan Length of the time interval to query, which is an alternative way to
22
- # declare the interval.
13
+ # @param [Hash] options Query parameters.
14
+ # @option [String] filter A monitoring filter that specifies which time series should be returned.
15
+ # The filter must specify a single metric type, and can additionally specify metric labels and other
16
+ # information.
17
+ # @option options [Hash] interval Required. The time interval for which results should be returned.
18
+ # @option interval [String] end_time Required RFC3339 timestamp marking the end of interval
19
+ # @option interval [String] start_time Optional RFC3339 timestamp marking start of interval.
20
+ # @option options [Hash] aggregation
21
+ # @option aggregation [String] alignment_period
22
+ # @option aggregation [String] cross_series_reducer
23
+ # @option aggregation [String] group_by_fields
24
+ # @option aggregation [String] per_series_aligner
25
+ # @option options [String] order_by
26
+ # @option options [String] page_size
27
+ # @option options [String] page_token
28
+ # @option options [String] view
29
+ #
23
30
  # @return [Array<Fog::Google::Monitoring::Timeseries>] List of Timeseries.
24
- def all(metric, youngest, options = {})
25
- data = service.list_timeseries(metric, youngest, options).body["timeseries"] || []
31
+ def all(options = {})
32
+ data = service.list_timeseries(options).body["timeSeries"] || []
26
33
  load(data)
27
34
  end
28
35
  end
@@ -17,9 +17,9 @@ module Fog
17
17
  :google_json_key_string
18
18
  )
19
19
 
20
- GOOGLE_MONITORING_API_VERSION = "v2beta2".freeze
21
- GOOGLE_MONITORING_BASE_URL = "https://www.googleapis.com/cloudmonitoring/"
22
- GOOGLE_MONITORING_API_SCOPE_URLS = %w(https://www.googleapis.com/auth/monitoring)
20
+ GOOGLE_MONITORING_API_VERSION = "v3".freeze
21
+ GOOGLE_MONITORING_BASE_URL = "https://monitoring.googleapis.com/".freeze
22
+ GOOGLE_MONITORING_API_SCOPE_URLS = %w(https://www.googleapis.com/auth/monitoring).freeze
23
23
 
24
24
  ##
25
25
  # MODELS
@@ -29,14 +29,14 @@ module Fog
29
29
  model :timeseries
30
30
  collection :timeseries_collection
31
31
 
32
- # TimeseriesDescriptors
33
- model :timeseries_descriptor
34
- collection :timeseries_descriptors
35
-
36
32
  # MetricDescriptors
37
33
  model :metric_descriptor
38
34
  collection :metric_descriptors
39
35
 
36
+ # MonitoredResourceDescriptors
37
+ model :monitored_resource_descriptor
38
+ collection :monitored_resource_descriptors
39
+
40
40
  ##
41
41
  # REQUESTS
42
42
  request_path "fog/google/requests/monitoring"
@@ -44,11 +44,11 @@ module Fog
44
44
  # Timeseries
45
45
  request :list_timeseries
46
46
 
47
- # TimeseriesDescriptors
48
- request :list_timeseries_descriptors
49
-
50
47
  # MetricDescriptors
51
48
  request :list_metric_descriptors
49
+
50
+ # MonitoredResourceDescriptors
51
+ request :list_monitored_resource_descriptors
52
52
  end
53
53
  end
54
54
  end
@@ -12,7 +12,7 @@ module Fog
12
12
  @data ||= Hash.new do |hash, key|
13
13
  hash[key] = {
14
14
  :timeseries => {},
15
- :timeseries_descriptors => {},
15
+ :monitored_resource_descriptor => {},
16
16
  :metric_descriptors => {}
17
17
  }
18
18
  end
@@ -12,7 +12,7 @@ module Fog
12
12
  options[:google_api_scope_url] = GOOGLE_MONITORING_API_SCOPE_URLS.join(" ")
13
13
 
14
14
  @client = initialize_google_client(options)
15
- @monitoring = @client.discovered_api("cloudmonitoring", api_version)
15
+ @monitoring = @client.discovered_api("monitoring", api_version)
16
16
  end
17
17
  end
18
18
  end
@@ -2,21 +2,20 @@ module Fog
2
2
  module Google
3
3
  class Monitoring
4
4
  ##
5
- # List metric descriptors that match the query. If the query is not set, then all of the metric descriptors
6
- # will be returned.
5
+ # Lists metric descriptors that match a filter.
7
6
  #
8
- # @see https://cloud.google.com/monitoring/v2beta2/metricDescriptors/list
7
+ # @see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors/list
9
8
  class Real
10
9
  def list_metric_descriptors(options = {})
11
- api_method = @monitoring.metric_descriptors.list
10
+ api_method = @monitoring.projects.metric_descriptors.list
12
11
  parameters = {
13
- "project" => @project
12
+ "name" => "projects/#{@project}"
14
13
  }
15
-
16
- parameters["count"] = options[:count] if options.key?(:count)
14
+ parameters["filter"] = options[:filter] if options.key?(:filter)
15
+ parameters["pageSize"] = options[:page_size] if options.key?(:page_size)
17
16
  parameters["pageToken"] = options[:page_token] if options.key?(:page_token)
18
- parameters["query"] = options[:query] if options.key?(:query)
19
17
 
18
+ puts parameters
20
19
  request(api_method, parameters)
21
20
  end
22
21
  end
@@ -24,161 +23,219 @@ module Fog
24
23
  class Mock
25
24
  def list_metric_descriptors(_options = {})
26
25
  body = {
27
- "kind" => 'cloudmonitoring#listMetricDescriptorsResponse',
28
- "metrics" => [
29
- { "name" => "compute.googleapis.com/instance/cpu/reserved_cores",
30
- "project" => @project,
31
- "labels" => [
32
- { "key" => "compute.googleapis.com/instance_name" },
33
- { "key" => "cloud.googleapis.com/location" },
34
- { "key" => "compute.googleapis.com/resource_id" },
35
- { "key" => "compute.googleapis.com/resource_type" },
36
- { "key" => "cloud.googleapis.com/service" }
37
- ],
38
- "typeDescriptor" => { "metricType" => "gauge", "valueType" => "double" },
39
- "description" => "Number of cores reserved on the host of the instance."
40
- },
26
+ "metricDescriptors" => [
41
27
  {
42
- "name" => "compute.googleapis.com/instance/cpu/usage_time",
43
- "project" => @project,
28
+ "type" => "compute.googleapis.com/instance/cpu/reserved_cores",
29
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/cpu/reserved_cores",
44
30
  "labels" => [
45
- { "key" => "compute.googleapis.com/instance_name" },
46
- { "key" => "cloud.googleapis.com/location" },
47
- { "key" => "compute.googleapis.com/resource_id" },
48
- { "key" => "compute.googleapis.com/resource_type" },
49
- { "key" => "cloud.googleapis.com/service" }
31
+ {
32
+ "key" => "instance_name",
33
+ "description" => "The name of the VM instance."
34
+ }
50
35
  ],
51
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "double" },
52
- "description" => "Delta CPU usage time. Units are seconds. You can get the per-core CPU utilization ratio by performing a rate operation on a point: doubleValue/(end-start), then divide by compute.googleapis.com/instance/cpu/reserved_cores at the corresponding end timestamp."
36
+ "metricKind" => "GAUGE",
37
+ "valueType" => "DOUBLE",
38
+ "unit" => "1",
39
+ "description" => "Number of cores reserved on the host of the instance.",
40
+ "displayName" => "Reserved cores"
53
41
  },
54
42
  {
55
- "name" => "compute.googleapis.com/instance/disk/read_bytes_count",
56
- "project" => @project,
43
+ "type" => "compute.googleapis.com/instance/cpu/usage_time",
44
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/cpu/usage_time",
57
45
  "labels" => [
58
- { "key" => "compute.googleapis.com/instance_name" },
59
- { "key" => "compute.googleapis.com/device_name" },
60
- { "key" => "compute.googleapis.com/device_type" },
61
- { "key" => "cloud.googleapis.com/location" },
62
- { "key" => "compute.googleapis.com/resource_id" },
63
- { "key" => "compute.googleapis.com/resource_type" },
64
- { "key" => "cloud.googleapis.com/service" }
46
+ {
47
+ "key" => "instance_name",
48
+ "description" => "The name of the VM instance."
49
+ }
65
50
  ],
66
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
67
- "description" => "Delta count of bytes read from disk."
51
+ "metricKind" => "DELTA",
52
+ "valueType" => "DOUBLE",
53
+ "unit" => "s",
54
+ "description" => "Delta CPU usage for all cores, in seconds. To compute the per-core CPU utilization fraction, divide this value by (end-start)*N, where end and start define this value's time interval and N is `compute.googleapis.com/instance/cpu/reserved_cores` at the end of the interval.",
55
+ "displayName" => "CPU usage"
68
56
  },
69
57
  {
70
- "name" => "compute.googleapis.com/instance/disk/read_ops_count",
71
- "project" => @project,
58
+ "type" => "compute.googleapis.com/instance/disk/read_bytes_count",
59
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/disk/read_bytes_count",
72
60
  "labels" => [
73
- { "key" => "compute.googleapis.com/instance_name" },
74
- { "key" => "compute.googleapis.com/device_name" },
75
- { "key" => "compute.googleapis.com/device_type" },
76
- { "key" => "cloud.googleapis.com/location" },
77
- { "key" => "compute.googleapis.com/resource_id" },
78
- { "key" => "compute.googleapis.com/resource_type" },
79
- { "key" => "cloud.googleapis.com/service" }
61
+ {
62
+ "key" => "instance_name",
63
+ "description" => "The name of the VM instance."
64
+ },
65
+ {
66
+ "key" => "device_name",
67
+ "description" => "The name of the disk device."
68
+ },
69
+ {
70
+ "key" => "storage_type",
71
+ "description" => "The storage type => `pd-standard` or `pd-ssd`."
72
+ },
73
+ {
74
+ "key" => "device_type",
75
+ "description" => "The disk type => `ephemeral` or `permanent`."
76
+ }
80
77
  ],
81
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
82
- "description" => "Delta count of disk read IO operations."
78
+ "metricKind" => "DELTA",
79
+ "valueType" => "INT64",
80
+ "unit" => "By",
81
+ "description" => "Delta count of bytes read from disk.",
82
+ "displayName" => "Disk read bytes"
83
83
  },
84
84
  {
85
- "name" => "compute.googleapis.com/instance/disk/write_bytes_count",
86
- "project" => @project,
85
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/disk/read_ops_count",
87
86
  "labels" => [
88
- { "key" => "compute.googleapis.com/instance_name" },
89
- { "key" => "compute.googleapis.com/device_name" },
90
- { "key" => "compute.googleapis.com/device_type" },
91
- { "key" => "cloud.googleapis.com/location" },
92
- { "key" => '"compute.googleapis.com/resource_id' },
93
- { "key" => "compute.googleapis.com/resource_type" },
94
- { "key" => "cloud.googleapis.com/service" }
87
+ {
88
+ "key" => "instance_name",
89
+ "description" => "The name of the VM instance."
90
+ },
91
+ {
92
+ "key" => "device_name",
93
+ "description" => "The name of the disk device."
94
+ },
95
+ {
96
+ "key" => "storage_type",
97
+ "description" => "The storage type => `pd-standard` or `pd-ssd`."
98
+ },
99
+ {
100
+ "key" => "device_type",
101
+ "description" => "The disk type => `ephemeral` or `permanent`."
102
+ }
95
103
  ],
96
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
97
- "description" => "Delta count of bytes written to disk."
104
+ "metricKind" => "DELTA",
105
+ "valueType" => "INT64",
106
+ "unit" => "1",
107
+ "description" => "Delta count of disk read IO operations.",
108
+ "displayName" => "Disk read operations",
109
+ "type" => "compute.googleapis.com/instance/disk/read_ops_count"
98
110
  },
99
111
  {
100
- "name" => "compute.googleapis.com/instance/disk/write_ops_count",
101
- "project" => @project,
112
+ "type" => "compute.googleapis.com/instance/disk/write_bytes_count",
113
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/disk/write_bytes_count",
102
114
  "labels" => [
103
- { "key" => "compute.googleapis.com/instance_name" },
104
- { "key" => "compute.googleapis.com/device_name" },
105
- { "key" => '"compute.googleapis.com/device_type' },
106
- { "key" => "cloud.googleapis.com/location" },
107
- { "key" => "compute.googleapis.com/resource_id" },
108
- { "key" => "compute.googleapis.com/resource_type" },
109
- { "key" => "cloud.googleapis.com/service" }
115
+ {
116
+ "key" => "instance_name",
117
+ "description" => "The name of the VM instance."
118
+ },
119
+ {
120
+ "key" => "device_name",
121
+ "description" => "The name of the disk device."
122
+ },
123
+ {
124
+ "key" => "storage_type",
125
+ "description" => "The storage type => `pd-standard` or `pd-ssd`."
126
+ },
127
+ {
128
+ "key" => "device_type",
129
+ "description" => "The disk type => `ephemeral` or `permanent`."
130
+ }
110
131
  ],
111
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
112
- "description" => "Delta count of disk write IO operations."
132
+ "metricKind" => "DELTA",
133
+ "valueType" => "INT64",
134
+ "unit" => "By",
135
+ "description" => "Delta count of bytes written to disk.",
136
+ "displayName" => "Disk write bytes"
113
137
  },
114
138
  {
115
- "name" => "compute.googleapis.com/instance/network/received_bytes_count",
116
- "project" => @project,
139
+ "type" => "compute.googleapis.com/instance/disk/write_ops_count",
140
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/disk/write_ops_count",
117
141
  "labels" => [
118
- { "key" => "compute.googleapis.com/instance_name" },
119
- { "key" => "compute.googleapis.com/loadbalanced" },
120
- { "key" => "cloud.googleapis.com/location" },
121
- { "key" => "compute.googleapis.com/resource_id" },
122
- { "key" => "compute.googleapis.com/resource_type" },
123
- { "key" => "cloud.googleapis.com/service" }
142
+ {
143
+ "key" => "instance_name",
144
+ "description" => "The name of the VM instance."
145
+ },
146
+ {
147
+ "key" => "device_name",
148
+ "description" => "The name of the disk device."
149
+ },
150
+ {
151
+ "key" => "storage_type",
152
+ "description" => "The storage type => `pd-standard` or `pd-ssd`."
153
+ },
154
+ {
155
+ "key" => "device_type",
156
+ "description" => "The disk type => `ephemeral` or `permanent`."
157
+ }
124
158
  ],
125
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
126
- "description" => "Delta count of bytes received from network."
159
+ "metricKind" => "DELTA",
160
+ "valueType" => "INT64",
161
+ "unit" => "1",
162
+ "description" => "Delta count of disk write IO operations.",
163
+ "displayName" => "Disk write operations"
127
164
  },
128
165
  {
129
- "name" => "compute.googleapis.com/instance/network/received_packets_count",
130
- "project" => @project,
166
+ "type" => "compute.googleapis.com/instance/network/received_packets_count",
167
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/network/received_packets_count",
131
168
  "labels" => [
132
- { "key" => "compute.googleapis.com/instance_name" },
133
- { "key" => "compute.googleapis.com/loadbalanced" },
134
- { "key" => "cloud.googleapis.com/location" },
135
- { "key" => "compute.googleapis.com/resource_id" },
136
- { "key" => "compute.googleapis.com/resource_type" },
137
- { "key" => "cloud.googleapis.com/service" }
169
+ {
170
+ "key" => "instance_name",
171
+ "description" => "The name of the VM instance."
172
+ },
173
+ {
174
+ "key" => "loadbalanced",
175
+ "valueType" => "BOOL",
176
+ "description" => "Whether traffic was received by an L3 loadbalanced IP address assigned to the VM. Traffic that is externally routed to the VM's standard internal or external IP address, such as L7 loadbalanced traffic, is not considered to be loadbalanced in this metric."
177
+ }
138
178
  ],
139
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
140
- "description" => "Delta count of packets received from network."
179
+ "metricKind" => "DELTA",
180
+ "valueType" => "INT64",
181
+ "unit" => "1",
182
+ "description" => "Delta count of packets received from the network.",
183
+ "displayName" => "Received packets"
141
184
  },
142
185
  {
143
- "name" => "compute.googleapis.com/instance/network/sent_bytes_count",
144
- "project" => @project,
186
+ "type" => "compute.googleapis.com/instance/network/sent_bytes_count",
187
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/network/sent_bytes_count",
145
188
  "labels" => [
146
- { "key" => "compute.googleapis.com/instance_name" },
147
- { "key" => "compute.googleapis.com/loadbalanced" },
148
- { "key" => "cloud.googleapis.com/location" },
149
- { "key" => "compute.googleapis.com/resource_id" },
150
- { "key" => "compute.googleapis.com/resource_type" },
151
- { "key" => "cloud.googleapis.com/service" }
189
+ {
190
+ "key" => "instance_name",
191
+ "description" => "The name of the VM instance."
192
+ },
193
+ {
194
+ "key" => "loadbalanced",
195
+ "valueType" => "BOOL",
196
+ "description" => "Whether traffic was sent from an L3 loadbalanced IP address assigned to the VM. Traffic that is externally routed from the VM's standard internal or external IP address, such as L7 loadbalanced traffic, is not considered to be loadbalanced in this metric."
197
+ }
152
198
  ],
153
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
154
- "description" => "Delta count of bytes sent over network."
199
+ "metricKind" => "DELTA",
200
+ "valueType" => "INT64",
201
+ "unit" => "By",
202
+ "description" => "Delta count of bytes sent over the network.",
203
+ "displayName" => "Sent bytes"
155
204
  },
156
205
  {
157
- "name" => "compute.googleapis.com/instance/network/sent_packets_count",
158
- "project" => @project,
206
+ "type" => "compute.googleapis.com/instance/network/sent_packets_count",
207
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/network/sent_packets_count",
159
208
  "labels" => [
160
- { "key" => "compute.googleapis.com/instance_name" },
161
- { "key" => "compute.googleapis.com/loadbalanced" },
162
- { "key" => "cloud.googleapis.com/location" },
163
- { "key" => "compute.googleapis.com/resource_id" },
164
- { "key" => "compute.googleapis.com/resource_type" },
165
- { "key" => "cloud.googleapis.com/service" }
209
+ {
210
+ "key" => "instance_name",
211
+ "description" => "The name of the VM instance."
212
+ },
213
+ {
214
+ "key" => "loadbalanced",
215
+ "valueType" => "BOOL",
216
+ "description" => "Whether traffic was sent from an L3 loadbalanced IP address assigned to the VM. Traffic that is externally routed from the VM's standard internal or external IP address, such as L7 loadbalanced traffic, is not considered to be loadbalanced in this metric."
217
+ }
166
218
  ],
167
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "int64" },
168
- "description" => "Delta count of packets sent over network."
219
+ "metricKind" => "DELTA",
220
+ "valueType" => "INT64",
221
+ "unit" => "1",
222
+ "description" => "Delta count of packets sent over the network.",
223
+ "displayName" => "Sent packets"
169
224
  },
170
225
  {
171
- "name" => "compute.googleapis.com/instance/uptime",
172
- "project" => @project,
226
+ "type" => "compute.googleapis.com/instance/uptime",
227
+ "name" => "projects/#{@project}/metricDescriptors/compute.googleapis.com/instance/uptime",
173
228
  "labels" => [
174
- { "key" => "compute.googleapis.com/instance_name" },
175
- { "key" => "cloud.googleapis.com/location" },
176
- { "key" => "compute.googleapis.com/resource_id" },
177
- { "key" => "compute.googleapis.com/resource_type" },
178
- { "key" => "cloud.googleapis.com/service" }
229
+ {
230
+ "key" => "instance_name",
231
+ "description" => "The name of the VM instance."
232
+ }
179
233
  ],
180
- "typeDescriptor" => { "metricType" => "delta", "valueType" => "double" },
181
- "description" => "Indicates the VM running time in seconds."
234
+ "metricKind" => "DELTA",
235
+ "valueType" => "DOUBLE",
236
+ "unit" => "s",
237
+ "description" => "How long the VM has been running, in seconds.",
238
+ "displayName" => "Uptime"
182
239
  }
183
240
  ]
184
241
  }