google-cloud-monitoring 0.33.1 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/lib/google/cloud/monitoring.rb +63 -1
  4. data/lib/google/cloud/monitoring/dashboard.rb +147 -0
  5. data/lib/google/cloud/monitoring/dashboard/v1.rb +148 -0
  6. data/lib/google/cloud/monitoring/dashboard/v1/credentials.rb +46 -0
  7. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client.rb +454 -0
  8. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client_config.json +51 -0
  9. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/common.rb +394 -0
  10. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboard.rb +53 -0
  11. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboards_service.rb +82 -0
  12. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/layouts.rb +71 -0
  13. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/metrics.rb +151 -0
  14. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/scorecard.rb +102 -0
  15. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/text.rb +43 -0
  16. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/widget.rb +41 -0
  17. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/xychart.rb +141 -0
  18. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/duration.rb +91 -0
  19. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/empty.rb +29 -0
  20. data/lib/google/cloud/monitoring/v3.rb +72 -1
  21. data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +5 -5
  22. data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +29 -45
  23. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +6 -8
  24. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +8 -8
  25. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +6 -4
  26. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service.rb +341 -0
  27. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service_service.rb +187 -0
  28. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +16 -12
  29. data/lib/google/cloud/monitoring/v3/group_service_client_config.json +6 -6
  30. data/lib/google/cloud/monitoring/v3/metric_service_client.rb +6 -4
  31. data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +7 -7
  32. data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +10 -10
  33. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client.rb +775 -0
  34. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client_config.json +76 -0
  35. data/lib/google/cloud/monitoring/version.rb +1 -1
  36. data/lib/google/monitoring/dashboard/v1/common_pb.rb +95 -0
  37. data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +29 -0
  38. data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +51 -0
  39. data/lib/google/monitoring/dashboard/v1/dashboards_service_services_pb.rb +76 -0
  40. data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +17 -0
  41. data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +41 -0
  42. data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +76 -0
  43. data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +38 -0
  44. data/lib/google/monitoring/dashboard/v1/service_pb.rb +17 -0
  45. data/lib/google/monitoring/dashboard/v1/text_pb.rb +28 -0
  46. data/lib/google/monitoring/dashboard/v1/widget_pb.rb +32 -0
  47. data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +66 -0
  48. data/lib/google/monitoring/v3/metric_service_pb.rb +11 -0
  49. data/lib/google/monitoring/v3/notification_pb.rb +1 -0
  50. data/lib/google/monitoring/v3/service_pb.rb +141 -0
  51. data/lib/google/monitoring/v3/service_service_pb.rb +85 -0
  52. data/lib/google/monitoring/v3/service_service_services_pb.rb +66 -0
  53. metadata +37 -2
@@ -0,0 +1,41 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Monitoring
18
+ module Dashboard
19
+ module V1
20
+ # Widget contains a single dashboard component and configuration of how to
21
+ # present the component in the dashboard.
22
+ # @!attribute [rw] title
23
+ # @return [String]
24
+ # Optional. The title of the widget.
25
+ # @!attribute [rw] xy_chart
26
+ # @return [Google::Monitoring::Dashboard::V1::XyChart]
27
+ # A chart of time series data.
28
+ # @!attribute [rw] scorecard
29
+ # @return [Google::Monitoring::Dashboard::V1::Scorecard]
30
+ # A scorecard summarizing time series data.
31
+ # @!attribute [rw] text
32
+ # @return [Google::Monitoring::Dashboard::V1::Text]
33
+ # A raw string or markdown displaying textual content.
34
+ # @!attribute [rw] blank
35
+ # @return [Google::Protobuf::Empty]
36
+ # A blank space.
37
+ class Widget; end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,141 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Monitoring
18
+ module Dashboard
19
+ module V1
20
+ # A chart that displays data on a 2D (X and Y axes) plane.
21
+ # @!attribute [rw] data_sets
22
+ # @return [Array<Google::Monitoring::Dashboard::V1::XyChart::DataSet>]
23
+ # The data displayed in this chart.
24
+ # @!attribute [rw] timeshift_duration
25
+ # @return [Google::Protobuf::Duration]
26
+ # The duration used to display a comparison chart. A comparison chart
27
+ # simultaneously shows values from two similar-length time periods
28
+ # (e.g., week-over-week metrics).
29
+ # The duration must be positive, and it can only be applied to charts with
30
+ # data sets of LINE plot type.
31
+ # @!attribute [rw] thresholds
32
+ # @return [Array<Google::Monitoring::Dashboard::V1::Threshold>]
33
+ # Threshold lines drawn horizontally across the chart.
34
+ # @!attribute [rw] x_axis
35
+ # @return [Google::Monitoring::Dashboard::V1::XyChart::Axis]
36
+ # The properties applied to the X axis.
37
+ # @!attribute [rw] y_axis
38
+ # @return [Google::Monitoring::Dashboard::V1::XyChart::Axis]
39
+ # The properties applied to the Y axis.
40
+ # @!attribute [rw] chart_options
41
+ # @return [Google::Monitoring::Dashboard::V1::ChartOptions]
42
+ # Display options for the chart.
43
+ class XyChart
44
+ # Groups a time series query definition with charting options.
45
+ # @!attribute [rw] time_series_query
46
+ # @return [Google::Monitoring::Dashboard::V1::TimeSeriesQuery]
47
+ # Fields for querying time series data from the
48
+ # Stackdriver metrics API.
49
+ # @!attribute [rw] plot_type
50
+ # @return [Google::Monitoring::Dashboard::V1::XyChart::DataSet::PlotType]
51
+ # How this data should be plotted on the chart.
52
+ # @!attribute [rw] legend_template
53
+ # @return [String]
54
+ # A template string for naming `TimeSeries` in the resulting data set.
55
+ # This should be a string with interpolations of the form ${label_name},
56
+ # which will resolve to the label's value.
57
+ # @!attribute [rw] min_alignment_period
58
+ # @return [Google::Protobuf::Duration]
59
+ # Optional. The lower bound on data point frequency for this data set, implemented by
60
+ # specifying the minimum alignment period to use in a time series query
61
+ # For example, if the data is published once every 10 minutes, the
62
+ # `min_alignment_period` should be at least 10 minutes. It would not
63
+ # make sense to fetch and align data at one minute intervals.
64
+ class DataSet
65
+ # The types of plotting strategies for data sets.
66
+ module PlotType
67
+ # Plot type is unspecified. The view will default to `LINE`.
68
+ PLOT_TYPE_UNSPECIFIED = 0
69
+
70
+ # The data is plotted as a set of lines (one line per series).
71
+ LINE = 1
72
+
73
+ # The data is plotted as a set of filled areas (one area per series),
74
+ # with the areas stacked vertically (the base of each area is the top of
75
+ # its predecessor, and the base of the first area is the X axis). Since
76
+ # the areas do not overlap, each is filled with a different opaque color.
77
+ STACKED_AREA = 2
78
+
79
+ # The data is plotted as a set of rectangular boxes (one box per series),
80
+ # with the boxes stacked vertically (the base of each box is the top of
81
+ # its predecessor, and the base of the first box is the X axis). Since
82
+ # the boxes do not overlap, each is filled with a different opaque color.
83
+ STACKED_BAR = 3
84
+
85
+ # The data is plotted as a heatmap. The series being plotted must have a
86
+ # `DISTRIBUTION` value type. The value of each bucket in the distribution
87
+ # is displayed as a color. This type is not currently available in the
88
+ # Stackdriver Monitoring application.
89
+ HEATMAP = 4
90
+ end
91
+ end
92
+
93
+ # A chart axis.
94
+ # @!attribute [rw] label
95
+ # @return [String]
96
+ # The label of the axis.
97
+ # @!attribute [rw] scale
98
+ # @return [Google::Monitoring::Dashboard::V1::XyChart::Axis::Scale]
99
+ # The axis scale. By default, a linear scale is used.
100
+ class Axis
101
+ # Types of scales used in axes.
102
+ module Scale
103
+ # Scale is unspecified. The view will default to `LINEAR`.
104
+ SCALE_UNSPECIFIED = 0
105
+
106
+ # Linear scale.
107
+ LINEAR = 1
108
+
109
+ # Logarithmic scale (base 10).
110
+ LOG10 = 2
111
+ end
112
+ end
113
+ end
114
+
115
+ # Options to control visual rendering of a chart.
116
+ # @!attribute [rw] mode
117
+ # @return [Google::Monitoring::Dashboard::V1::ChartOptions::Mode]
118
+ # The chart mode.
119
+ class ChartOptions
120
+ # Chart mode options.
121
+ module Mode
122
+ # Mode is unspecified. The view will default to `COLOR`.
123
+ MODE_UNSPECIFIED = 0
124
+
125
+ # The chart distinguishes data series using different color. Line
126
+ # colors may get reused when there are many lines in the chart.
127
+ COLOR = 1
128
+
129
+ # The chart uses the Stackdriver x-ray mode, in which each
130
+ # data set is plotted using the same semi-transparent color.
131
+ X_RAY = 2
132
+
133
+ # The chart displays statistics such as average, median, 95th percentile,
134
+ # and more.
135
+ STATS = 3
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,91 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Protobuf
18
+ # A Duration represents a signed, fixed-length span of time represented
19
+ # as a count of seconds and fractions of seconds at nanosecond
20
+ # resolution. It is independent of any calendar and concepts like "day"
21
+ # or "month". It is related to Timestamp in that the difference between
22
+ # two Timestamp values is a Duration and it can be added or subtracted
23
+ # from a Timestamp. Range is approximately +-10,000 years.
24
+ #
25
+ # = Examples
26
+ #
27
+ # Example 1: Compute Duration from two Timestamps in pseudo code.
28
+ #
29
+ # Timestamp start = ...;
30
+ # Timestamp end = ...;
31
+ # Duration duration = ...;
32
+ #
33
+ # duration.seconds = end.seconds - start.seconds;
34
+ # duration.nanos = end.nanos - start.nanos;
35
+ #
36
+ # if (duration.seconds < 0 && duration.nanos > 0) {
37
+ # duration.seconds += 1;
38
+ # duration.nanos -= 1000000000;
39
+ # } else if (durations.seconds > 0 && duration.nanos < 0) {
40
+ # duration.seconds -= 1;
41
+ # duration.nanos += 1000000000;
42
+ # }
43
+ #
44
+ # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
45
+ #
46
+ # Timestamp start = ...;
47
+ # Duration duration = ...;
48
+ # Timestamp end = ...;
49
+ #
50
+ # end.seconds = start.seconds + duration.seconds;
51
+ # end.nanos = start.nanos + duration.nanos;
52
+ #
53
+ # if (end.nanos < 0) {
54
+ # end.seconds -= 1;
55
+ # end.nanos += 1000000000;
56
+ # } else if (end.nanos >= 1000000000) {
57
+ # end.seconds += 1;
58
+ # end.nanos -= 1000000000;
59
+ # }
60
+ #
61
+ # Example 3: Compute Duration from datetime.timedelta in Python.
62
+ #
63
+ # td = datetime.timedelta(days=3, minutes=10)
64
+ # duration = Duration()
65
+ # duration.FromTimedelta(td)
66
+ #
67
+ # = JSON Mapping
68
+ #
69
+ # In JSON format, the Duration type is encoded as a string rather than an
70
+ # object, where the string ends in the suffix "s" (indicating seconds) and
71
+ # is preceded by the number of seconds, with nanoseconds expressed as
72
+ # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
73
+ # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
74
+ # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
75
+ # microsecond should be expressed in JSON format as "3.000001s".
76
+ # @!attribute [rw] seconds
77
+ # @return [Integer]
78
+ # Signed seconds of the span of time. Must be from -315,576,000,000
79
+ # to +315,576,000,000 inclusive. Note: these bounds are computed from:
80
+ # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
81
+ # @!attribute [rw] nanos
82
+ # @return [Integer]
83
+ # Signed fractions of a second at nanosecond resolution of the span
84
+ # of time. Durations less than one second are represented with a 0
85
+ # `seconds` field and a positive or negative `nanos` field. For durations
86
+ # of one second or more, a non-zero value for the `nanos` field must be
87
+ # of the same sign as the `seconds` field. Must be from -999,999,999
88
+ # to +999,999,999 inclusive.
89
+ class Duration; end
90
+ end
91
+ end
@@ -0,0 +1,29 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Protobuf
18
+ # A generic empty message that you can re-use to avoid defining duplicated
19
+ # empty messages in your APIs. A typical example is to use it as the request
20
+ # or the response type of an API method. For instance:
21
+ #
22
+ # service Foo {
23
+ # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
+ # }
25
+ #
26
+ # The JSON representation for `Empty` is empty JSON object `{}`.
27
+ class Empty; end
28
+ end
29
+ end
@@ -17,6 +17,7 @@ require "google/cloud/monitoring/v3/alert_policy_service_client"
17
17
  require "google/cloud/monitoring/v3/group_service_client"
18
18
  require "google/cloud/monitoring/v3/metric_service_client"
19
19
  require "google/cloud/monitoring/v3/notification_channel_service_client"
20
+ require "google/cloud/monitoring/v3/service_monitoring_service_client"
20
21
  require "google/cloud/monitoring/v3/uptime_check_service_client"
21
22
  require "google/monitoring/v3/span_context_pb"
22
23
  require "google/monitoring/v3/dropped_labels_pb"
@@ -32,7 +33,10 @@ module Google
32
33
  # [Stackdriver Monitoring API][Product Documentation]:
33
34
  # Manages your Stackdriver Monitoring data and configurations. Most projects
34
35
  # must be associated with a Stackdriver account, with a few exceptions as
35
- # noted on the individual method pages.
36
+ # noted on the individual method pages. The table entries below are
37
+ # presented in alphabetical order, not in order of common use. For
38
+ # explanations of the concepts found in the table entries, read the
39
+ # [Stackdriver Monitoring documentation](/monitoring/docs).
36
40
  # - [Product Documentation][]
37
41
  #
38
42
  # ## Quick Start
@@ -385,6 +389,73 @@ module Google
385
389
  end
386
390
  end
387
391
 
392
+ module ServiceMonitoring
393
+ ##
394
+ # The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for
395
+ # managing and querying aspects of a workspace's services. These include the
396
+ # `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
397
+ # of categorized Health Metrics.
398
+ #
399
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
400
+ # Provides the means for authenticating requests made by the client. This parameter can
401
+ # be many types.
402
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
403
+ # authenticating requests made by this client.
404
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
405
+ # credentials for this client.
406
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
407
+ # credentials for this client.
408
+ # A `GRPC::Core::Channel` will be used to make calls through.
409
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
410
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
411
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
412
+ # metadata for requests, generally, to give OAuth credentials.
413
+ # @param scopes [Array<String>]
414
+ # The OAuth scopes for this service. This parameter is ignored if
415
+ # an updater_proc is supplied.
416
+ # @param client_config [Hash]
417
+ # A Hash for call options for each method. See
418
+ # Google::Gax#construct_settings for the structure of
419
+ # this data. Falls back to the default config if not specified
420
+ # or the specified config is missing data points.
421
+ # @param timeout [Numeric]
422
+ # The default timeout, in seconds, for calls made through this client.
423
+ # @param metadata [Hash]
424
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
425
+ # @param service_address [String]
426
+ # Override for the service hostname, or `nil` to leave as the default.
427
+ # @param service_port [Integer]
428
+ # Override for the service port, or `nil` to leave as the default.
429
+ # @param exception_transformer [Proc]
430
+ # An optional proc that intercepts any exceptions raised during an API call to inject
431
+ # custom error handling.
432
+ def self.new \
433
+ credentials: nil,
434
+ scopes: nil,
435
+ client_config: nil,
436
+ timeout: nil,
437
+ metadata: nil,
438
+ service_address: nil,
439
+ service_port: nil,
440
+ exception_transformer: nil,
441
+ lib_name: nil,
442
+ lib_version: nil
443
+ kwargs = {
444
+ credentials: credentials,
445
+ scopes: scopes,
446
+ client_config: client_config,
447
+ timeout: timeout,
448
+ metadata: metadata,
449
+ exception_transformer: exception_transformer,
450
+ lib_name: lib_name,
451
+ service_address: service_address,
452
+ service_port: service_port,
453
+ lib_version: lib_version
454
+ }.select { |_, v| v != nil }
455
+ Google::Cloud::Monitoring::V3::ServiceMonitoringServiceClient.new(**kwargs)
456
+ end
457
+ end
458
+
388
459
  module UptimeCheck
389
460
  ##
390
461
  # The UptimeCheckService API is used to manage (list, create, delete, edit)
@@ -21,27 +21,27 @@
21
21
  },
22
22
  "methods": {
23
23
  "ListAlertPolicies": {
24
- "timeout_millis": 30000,
24
+ "timeout_millis": 60000,
25
25
  "retry_codes_name": "idempotent",
26
26
  "retry_params_name": "default"
27
27
  },
28
28
  "GetAlertPolicy": {
29
- "timeout_millis": 30000,
29
+ "timeout_millis": 60000,
30
30
  "retry_codes_name": "idempotent",
31
31
  "retry_params_name": "default"
32
32
  },
33
33
  "CreateAlertPolicy": {
34
- "timeout_millis": 30000,
34
+ "timeout_millis": 60000,
35
35
  "retry_codes_name": "non_idempotent",
36
36
  "retry_params_name": "default"
37
37
  },
38
38
  "DeleteAlertPolicy": {
39
- "timeout_millis": 30000,
39
+ "timeout_millis": 60000,
40
40
  "retry_codes_name": "idempotent",
41
41
  "retry_params_name": "default"
42
42
  },
43
43
  "UpdateAlertPolicy": {
44
- "timeout_millis": 30000,
44
+ "timeout_millis": 60000,
45
45
  "retry_codes_name": "non_idempotent",
46
46
  "retry_params_name": "default"
47
47
  }
@@ -49,49 +49,22 @@ module Google
49
49
  # Some combinations of `metric_kind` and `value_type` might not be supported.
50
50
  # @!attribute [rw] unit
51
51
  # @return [String]
52
- # The unit in which the metric value is reported. It is only applicable
53
- # if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The
54
- # supported units are a subset of [The Unified Code for Units of
55
- # Measure](http://unitsofmeasure.org/ucum.html) standard:
56
- #
57
- # **Basic units (UNIT)**
58
- #
59
- # * `bit` bit
60
- # * `By` byte
61
- # * `s` second
62
- # * `min` minute
63
- # * `h` hour
64
- # * `d` day
65
- #
66
- # **Prefixes (PREFIX)**
67
- #
68
- # * `k` kilo (10**3)
69
- # * `M` mega (10**6)
70
- # * `G` giga (10**9)
71
- # * `T` tera (10**12)
72
- # * `P` peta (10**15)
73
- # * `E` exa (10**18)
74
- # * `Z` zetta (10**21)
75
- # * `Y` yotta (10**24)
76
- # * `m` milli (10**-3)
77
- # * `u` micro (10**-6)
78
- # * `n` nano (10**-9)
79
- # * `p` pico (10**-12)
80
- # * `f` femto (10**-15)
81
- # * `a` atto (10**-18)
82
- # * `z` zepto (10**-21)
83
- # * `y` yocto (10**-24)
84
- # * `Ki` kibi (2**10)
85
- # * `Mi` mebi (2**20)
86
- # * `Gi` gibi (2**30)
87
- # * `Ti` tebi (2**40)
52
+ # * `Ki` kibi (2^10)
53
+ # * `Mi` mebi (2^20)
54
+ # * `Gi` gibi (2^30)
55
+ # * `Ti` tebi (2^40)
56
+ # * `Pi` pebi (2^50)
88
57
  #
89
58
  # **Grammar**
90
59
  #
91
60
  # The grammar also includes these connectors:
92
61
  #
93
- # * `/` division (as an infix operator, e.g. `1/s`).
94
- # * `.` multiplication (as an infix operator, e.g. `GBy.d`)
62
+ # * `/` division or ratio (as an infix operator). For examples,
63
+ # `kBy/{email}` or `MiBy/10ms` (although you should almost never
64
+ # have `/s` in a metric `unit`; rates should always be computed at
65
+ # query time from the underlying cumulative or delta value).
66
+ # * `.` multiplication or composition (as an infix operator). For
67
+ # examples, `GBy.d` or `k{watt}.h`.
95
68
  #
96
69
  # The grammar for a unit is as follows:
97
70
  #
@@ -106,14 +79,25 @@ module Google
106
79
  #
107
80
  # Notes:
108
81
  #
109
- # * `Annotation` is just a comment if it follows a `UNIT` and is
110
- # equivalent to `1` if it is used alone. For examples,
111
- # `{requests}/s == 1/s`, `By{transmitted}/s == By/s`.
82
+ # * `Annotation` is just a comment if it follows a `UNIT`. If the annotation
83
+ # is used alone, then the unit is equivalent to `1`. For examples,
84
+ # `{request}/s == 1/s`, `By{transmitted}/s == By/s`.
112
85
  # * `NAME` is a sequence of non-blank printable ASCII characters not
113
- # containing '{' or '}'.
114
- # * `1` represents dimensionless value 1, such as in `1/s`.
115
- # * `%` represents dimensionless value 1/100, and annotates values giving
116
- # a percentage.
86
+ # containing `{` or `}`.
87
+ # * `1` represents a unitary [dimensionless
88
+ # unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such
89
+ # as in `1/s`. It is typically used when none of the basic units are
90
+ # appropriate. For example, "new users per day" can be represented as
91
+ # `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new
92
+ # users). Alternatively, "thousands of page views per day" would be
93
+ # represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric
94
+ # value of `5.3` would mean "5300 page views per day").
95
+ # * `%` represents dimensionless value of 1/100, and annotates values giving
96
+ # a percentage (so the metric values are typically in the range of 0..100,
97
+ # and a metric value `3` means "3 percent").
98
+ # * `10^2.%` indicates a metric contains a ratio, typically in the range
99
+ # 0..1, that will be multiplied by 100 and displayed as a percentage
100
+ # (so a metric value `0.03` means "3 percent").
117
101
  # @!attribute [rw] description
118
102
  # @return [String]
119
103
  # A detailed description of the metric, which can be used in documentation.