google-cloud-logging 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/lib/google-cloud-logging.rb +13 -10
  3. data/lib/google/cloud/logging.rb +41 -17
  4. data/lib/google/cloud/logging/async_writer.rb +5 -2
  5. data/lib/google/cloud/logging/credentials.rb +31 -15
  6. data/lib/google/cloud/logging/entry.rb +13 -0
  7. data/lib/google/cloud/logging/entry/http_request.rb +35 -12
  8. data/lib/google/cloud/logging/logger.rb +14 -0
  9. data/lib/google/cloud/logging/middleware.rb +1 -1
  10. data/lib/google/cloud/logging/project.rb +55 -8
  11. data/lib/google/cloud/logging/rails.rb +1 -1
  12. data/lib/google/cloud/logging/service.rb +8 -27
  13. data/lib/google/cloud/logging/v2/config_service_v2_client.rb +360 -93
  14. data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +43 -8
  15. data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +172 -0
  16. data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +187 -0
  17. data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +4 -4
  18. data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +4 -1
  19. data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +13 -6
  20. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +55 -21
  21. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +185 -23
  22. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +89 -5
  23. data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +12 -2
  24. data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +14 -1
  25. data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +223 -0
  26. data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +26 -1
  27. data/lib/google/cloud/logging/v2/doc/overview.rb +67 -0
  28. data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +116 -91
  29. data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +12 -11
  30. data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +87 -76
  31. data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +9 -8
  32. data/lib/google/cloud/logging/version.rb +1 -1
  33. metadata +11 -7
@@ -4,6 +4,7 @@
4
4
  "retry_codes": {
5
5
  "idempotent": [
6
6
  "DEADLINE_EXCEEDED",
7
+ "INTERNAL",
7
8
  "UNAVAILABLE"
8
9
  ],
9
10
  "non_idempotent": []
@@ -13,35 +14,69 @@
13
14
  "initial_retry_delay_millis": 100,
14
15
  "retry_delay_multiplier": 1.2,
15
16
  "max_retry_delay_millis": 1000,
16
- "initial_rpc_timeout_millis": 2000,
17
+ "initial_rpc_timeout_millis": 30000,
17
18
  "rpc_timeout_multiplier": 1.5,
18
- "max_rpc_timeout_millis": 30000,
19
- "total_timeout_millis": 45000
19
+ "max_rpc_timeout_millis": 60000,
20
+ "total_timeout_millis": 90000
21
+ },
22
+ "write_sink": {
23
+ "initial_retry_delay_millis": 100,
24
+ "retry_delay_multiplier": 1.2,
25
+ "max_retry_delay_millis": 1000,
26
+ "initial_rpc_timeout_millis": 30000,
27
+ "rpc_timeout_multiplier": 1.5,
28
+ "max_rpc_timeout_millis": 60000,
29
+ "total_timeout_millis": 120000
20
30
  }
21
31
  },
22
32
  "methods": {
23
33
  "ListSinks": {
24
- "timeout_millis": 30000,
34
+ "timeout_millis": 60000,
25
35
  "retry_codes_name": "idempotent",
26
36
  "retry_params_name": "default"
27
37
  },
28
38
  "GetSink": {
29
- "timeout_millis": 30000,
39
+ "timeout_millis": 60000,
30
40
  "retry_codes_name": "idempotent",
31
41
  "retry_params_name": "default"
32
42
  },
33
43
  "CreateSink": {
34
- "timeout_millis": 30000,
44
+ "timeout_millis": 120000,
35
45
  "retry_codes_name": "non_idempotent",
36
46
  "retry_params_name": "default"
37
47
  },
38
48
  "UpdateSink": {
39
- "timeout_millis": 30000,
49
+ "timeout_millis": 120000,
40
50
  "retry_codes_name": "non_idempotent",
41
51
  "retry_params_name": "default"
42
52
  },
43
53
  "DeleteSink": {
44
- "timeout_millis": 30000,
54
+ "timeout_millis": 60000,
55
+ "retry_codes_name": "idempotent",
56
+ "retry_params_name": "default"
57
+ },
58
+ "ListExclusions": {
59
+ "timeout_millis": 60000,
60
+ "retry_codes_name": "idempotent",
61
+ "retry_params_name": "default"
62
+ },
63
+ "GetExclusion": {
64
+ "timeout_millis": 60000,
65
+ "retry_codes_name": "idempotent",
66
+ "retry_params_name": "default"
67
+ },
68
+ "CreateExclusion": {
69
+ "timeout_millis": 60000,
70
+ "retry_codes_name": "non_idempotent",
71
+ "retry_params_name": "default"
72
+ },
73
+ "UpdateExclusion": {
74
+ "timeout_millis": 60000,
75
+ "retry_codes_name": "non_idempotent",
76
+ "retry_params_name": "default"
77
+ },
78
+ "DeleteExclusion": {
79
+ "timeout_millis": 60000,
45
80
  "retry_codes_name": "idempotent",
46
81
  "retry_params_name": "default"
47
82
  }
@@ -0,0 +1,172 @@
1
+ # Copyright 2017, Google Inc. All rights reserved.
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
+ # http://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
+ module Google
16
+ module Api
17
+ # Distribution contains summary statistics for a population of values and,
18
+ # optionally, a histogram representing the distribution of those values across
19
+ # a specified set of histogram buckets.
20
+ #
21
+ # The summary statistics are the count, mean, sum of the squared deviation from
22
+ # the mean, the minimum, and the maximum of the set of population of values.
23
+ #
24
+ # The histogram is based on a sequence of buckets and gives a count of values
25
+ # that fall into each bucket. The boundaries of the buckets are given either
26
+ # explicitly or by specifying parameters for a method of computing them
27
+ # (buckets of fixed width or buckets of exponentially increasing width).
28
+ #
29
+ # Although it is not forbidden, it is generally a bad idea to include
30
+ # non-finite values (infinities or NaNs) in the population of values, as this
31
+ # will render the +mean+ and +sum_of_squared_deviation+ fields meaningless.
32
+ # @!attribute [rw] count
33
+ # @return [Integer]
34
+ # The number of values in the population. Must be non-negative.
35
+ # @!attribute [rw] mean
36
+ # @return [Float]
37
+ # The arithmetic mean of the values in the population. If +count+ is zero
38
+ # then this field must be zero.
39
+ # @!attribute [rw] sum_of_squared_deviation
40
+ # @return [Float]
41
+ # The sum of squared deviations from the mean of the values in the
42
+ # population. For values x_i this is:
43
+ #
44
+ # Sum[i=1..n](https://cloud.google.com(x_i - mean)^2)
45
+ #
46
+ # Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition
47
+ # describes Welford's method for accumulating this sum in one pass.
48
+ #
49
+ # If +count+ is zero then this field must be zero.
50
+ # @!attribute [rw] range
51
+ # @return [Google::Api::Distribution::Range]
52
+ # If specified, contains the range of the population values. The field
53
+ # must not be present if the +count+ is zero.
54
+ # @!attribute [rw] bucket_options
55
+ # @return [Google::Api::Distribution::BucketOptions]
56
+ # Defines the histogram bucket boundaries.
57
+ # @!attribute [rw] bucket_counts
58
+ # @return [Array<Integer>]
59
+ # If +bucket_options+ is given, then the sum of the values in +bucket_counts+
60
+ # must equal the value in +count+. If +bucket_options+ is not given, no
61
+ # +bucket_counts+ fields may be given.
62
+ #
63
+ # Bucket counts are given in order under the numbering scheme described
64
+ # above (the underflow bucket has number 0; the finite buckets, if any,
65
+ # have numbers 1 through N-2; the overflow bucket has number N-1).
66
+ #
67
+ # The size of +bucket_counts+ must be no greater than N as defined in
68
+ # +bucket_options+.
69
+ #
70
+ # Any suffix of trailing zero bucket_count fields may be omitted.
71
+ class Distribution
72
+ # The range of the population values.
73
+ # @!attribute [rw] min
74
+ # @return [Float]
75
+ # The minimum of the population values.
76
+ # @!attribute [rw] max
77
+ # @return [Float]
78
+ # The maximum of the population values.
79
+ class Range; end
80
+
81
+ # A Distribution may optionally contain a histogram of the values in the
82
+ # population. The histogram is given in +bucket_counts+ as counts of values
83
+ # that fall into one of a sequence of non-overlapping buckets. The sequence
84
+ # of buckets is described by +bucket_options+.
85
+ #
86
+ # A bucket specifies an inclusive lower bound and exclusive upper bound for
87
+ # the values that are counted for that bucket. The upper bound of a bucket
88
+ # is strictly greater than the lower bound.
89
+ #
90
+ # The sequence of N buckets for a Distribution consists of an underflow
91
+ # bucket (number 0), zero or more finite buckets (number 1 through N - 2) and
92
+ # an overflow bucket (number N - 1). The buckets are contiguous: the lower
93
+ # bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1.
94
+ # The buckets span the whole range of finite values: lower bound of the
95
+ # underflow bucket is -infinity and the upper bound of the overflow bucket is
96
+ # +infinity. The finite buckets are so-called because both bounds are
97
+ # finite.
98
+ #
99
+ # +BucketOptions+ describes bucket boundaries in one of three ways. Two
100
+ # describe the boundaries by giving parameters for a formula to generate
101
+ # boundaries and one gives the bucket boundaries explicitly.
102
+ #
103
+ # If +bucket_boundaries+ is not given, then no +bucket_counts+ may be given.
104
+ # @!attribute [rw] linear_buckets
105
+ # @return [Google::Api::Distribution::BucketOptions::Linear]
106
+ # The linear bucket.
107
+ # @!attribute [rw] exponential_buckets
108
+ # @return [Google::Api::Distribution::BucketOptions::Exponential]
109
+ # The exponential buckets.
110
+ # @!attribute [rw] explicit_buckets
111
+ # @return [Google::Api::Distribution::BucketOptions::Explicit]
112
+ # The explicit buckets.
113
+ class BucketOptions
114
+ # Specify a sequence of buckets that all have the same width (except
115
+ # overflow and underflow). Each bucket represents a constant absolute
116
+ # uncertainty on the specific value in the bucket.
117
+ #
118
+ # Defines +num_finite_buckets + 2+ (= N) buckets with these boundaries for
119
+ # bucket +i+:
120
+ #
121
+ # Upper bound (0 <= i < N-1): offset + (width * i).
122
+ # Lower bound (1 <= i < N): offset + (width * (i - 1)).
123
+ # @!attribute [rw] num_finite_buckets
124
+ # @return [Integer]
125
+ # Must be greater than 0.
126
+ # @!attribute [rw] width
127
+ # @return [Float]
128
+ # Must be greater than 0.
129
+ # @!attribute [rw] offset
130
+ # @return [Float]
131
+ # Lower bound of the first bucket.
132
+ class Linear; end
133
+
134
+ # Specify a sequence of buckets that have a width that is proportional to
135
+ # the value of the lower bound. Each bucket represents a constant relative
136
+ # uncertainty on a specific value in the bucket.
137
+ #
138
+ # Defines +num_finite_buckets + 2+ (= N) buckets with these boundaries for
139
+ # bucket i:
140
+ #
141
+ # Upper bound (0 <= i < N-1): scale * (growth_factor ^ i).
142
+ # Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)).
143
+ # @!attribute [rw] num_finite_buckets
144
+ # @return [Integer]
145
+ # Must be greater than 0.
146
+ # @!attribute [rw] growth_factor
147
+ # @return [Float]
148
+ # Must be greater than 1.
149
+ # @!attribute [rw] scale
150
+ # @return [Float]
151
+ # Must be greater than 0.
152
+ class Exponential; end
153
+
154
+ # A set of buckets with arbitrary widths.
155
+ #
156
+ # Defines +size(bounds) + 1+ (= N) buckets with these boundaries for
157
+ # bucket i:
158
+ #
159
+ # Upper bound (0 <= i < N-1): bounds[i]
160
+ # Lower bound (1 <= i < N); bounds[i - 1]
161
+ #
162
+ # There must be at least one element in +bounds+. If +bounds+ has only one
163
+ # element, there are no finite buckets, and that single element is the
164
+ # common boundary of the overflow and underflow buckets.
165
+ # @!attribute [rw] bounds
166
+ # @return [Array<Float>]
167
+ # The values must be monotonically increasing.
168
+ class Explicit; end
169
+ end
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,187 @@
1
+ # Copyright 2017, Google Inc. All rights reserved.
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
+ # http://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
+ module Google
16
+ module Api
17
+ # Defines a metric type and its schema. Once a metric descriptor is created,
18
+ # deleting or altering it stops data collection and makes the metric type's
19
+ # existing data unusable.
20
+ # @!attribute [rw] name
21
+ # @return [String]
22
+ # The resource name of the metric descriptor. Depending on the
23
+ # implementation, the name typically includes: (1) the parent resource name
24
+ # that defines the scope of the metric type or of its data; and (2) the
25
+ # metric's URL-encoded type, which also appears in the +type+ field of this
26
+ # descriptor. For example, following is the resource name of a custom
27
+ # metric within the GCP project +my-project+:
28
+ #
29
+ # "projects/my-project/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount"
30
+ # @!attribute [rw] type
31
+ # @return [String]
32
+ # The metric type, including its DNS name prefix. The type is not
33
+ # URL-encoded. All user-defined custom metric types have the DNS name
34
+ # +custom.googleapis.com+. Metric types should use a natural hierarchical
35
+ # grouping. For example:
36
+ #
37
+ # "custom.googleapis.com/invoice/paid/amount"
38
+ # "appengine.googleapis.com/http/server/response_latencies"
39
+ # @!attribute [rw] labels
40
+ # @return [Array<Google::Api::LabelDescriptor>]
41
+ # The set of labels that can be used to describe a specific
42
+ # instance of this metric type. For example, the
43
+ # +appengine.googleapis.com/http/server/response_latencies+ metric
44
+ # type has a label for the HTTP response code, +response_code+, so
45
+ # you can look at latencies for successful responses or just
46
+ # for responses that failed.
47
+ # @!attribute [rw] metric_kind
48
+ # @return [Google::Api::MetricDescriptor::MetricKind]
49
+ # Whether the metric records instantaneous values, changes to a value, etc.
50
+ # Some combinations of +metric_kind+ and +value_type+ might not be supported.
51
+ # @!attribute [rw] value_type
52
+ # @return [Google::Api::MetricDescriptor::ValueType]
53
+ # Whether the measurement is an integer, a floating-point number, etc.
54
+ # Some combinations of +metric_kind+ and +value_type+ might not be supported.
55
+ # @!attribute [rw] unit
56
+ # @return [String]
57
+ # The unit in which the metric value is reported. It is only applicable
58
+ # if the +value_type+ is +INT64+, +DOUBLE+, or +DISTRIBUTION+. The
59
+ # supported units are a subset of [The Unified Code for Units of
60
+ # Measure](http://unitsofmeasure.org/ucum.html) standard:
61
+ #
62
+ # **Basic units (UNIT)**
63
+ #
64
+ # * +bit+ bit
65
+ # * +By+ byte
66
+ # * +s+ second
67
+ # * +min+ minute
68
+ # * +h+ hour
69
+ # * +d+ day
70
+ #
71
+ # **Prefixes (PREFIX)**
72
+ #
73
+ # * +k+ kilo (10**3)
74
+ # * +M+ mega (10**6)
75
+ # * +G+ giga (10**9)
76
+ # * +T+ tera (10**12)
77
+ # * +P+ peta (10**15)
78
+ # * +E+ exa (10**18)
79
+ # * +Z+ zetta (10**21)
80
+ # * +Y+ yotta (10**24)
81
+ # * +m+ milli (10**-3)
82
+ # * +u+ micro (10**-6)
83
+ # * +n+ nano (10**-9)
84
+ # * +p+ pico (10**-12)
85
+ # * +f+ femto (10**-15)
86
+ # * +a+ atto (10**-18)
87
+ # * +z+ zepto (10**-21)
88
+ # * +y+ yocto (10**-24)
89
+ # * +Ki+ kibi (2**10)
90
+ # * +Mi+ mebi (2**20)
91
+ # * +Gi+ gibi (2**30)
92
+ # * +Ti+ tebi (2**40)
93
+ #
94
+ # **Grammar**
95
+ #
96
+ # The grammar includes the dimensionless unit +1+, such as +1/s+.
97
+ #
98
+ # The grammar also includes these connectors:
99
+ #
100
+ # * +/+ division (as an infix operator, e.g. +1/s+).
101
+ # * +.+ multiplication (as an infix operator, e.g. +GBy.d+)
102
+ #
103
+ # The grammar for a unit is as follows:
104
+ #
105
+ # Expression = Component { "." Component } { "/" Component } ;
106
+ #
107
+ # Component = [ PREFIX ] UNIT [ Annotation ]
108
+ # | Annotation
109
+ # | "1"
110
+ # ;
111
+ #
112
+ # Annotation = "{" NAME "}" ;
113
+ #
114
+ # Notes:
115
+ #
116
+ # * +Annotation+ is just a comment if it follows a +UNIT+ and is
117
+ # equivalent to +1+ if it is used alone. For examples,
118
+ # +{requests}/s == 1/s+, +By{transmitted}/s == By/s+.
119
+ # * +NAME+ is a sequence of non-blank printable ASCII characters not
120
+ # containing '{' or '}'.
121
+ # @!attribute [rw] description
122
+ # @return [String]
123
+ # A detailed description of the metric, which can be used in documentation.
124
+ # @!attribute [rw] display_name
125
+ # @return [String]
126
+ # A concise name for the metric, which can be displayed in user interfaces.
127
+ # Use sentence case without an ending period, for example "Request count".
128
+ class MetricDescriptor
129
+ # The kind of measurement. It describes how the data is reported.
130
+ module MetricKind
131
+ # Do not use this default value.
132
+ METRIC_KIND_UNSPECIFIED = 0
133
+
134
+ # An instantaneous measurement of a value.
135
+ GAUGE = 1
136
+
137
+ # The change in a value during a time interval.
138
+ DELTA = 2
139
+
140
+ # A value accumulated over a time interval. Cumulative
141
+ # measurements in a time series should have the same start time
142
+ # and increasing end times, until an event resets the cumulative
143
+ # value to zero and sets a new start time for the following
144
+ # points.
145
+ CUMULATIVE = 3
146
+ end
147
+
148
+ # The value type of a metric.
149
+ module ValueType
150
+ # Do not use this default value.
151
+ VALUE_TYPE_UNSPECIFIED = 0
152
+
153
+ # The value is a boolean.
154
+ # This value type can be used only if the metric kind is +GAUGE+.
155
+ BOOL = 1
156
+
157
+ # The value is a signed 64-bit integer.
158
+ INT64 = 2
159
+
160
+ # The value is a double precision floating point number.
161
+ DOUBLE = 3
162
+
163
+ # The value is a text string.
164
+ # This value type can be used only if the metric kind is +GAUGE+.
165
+ STRING = 4
166
+
167
+ # The value is a {Google::Api::Distribution +Distribution+}.
168
+ DISTRIBUTION = 5
169
+
170
+ # The value is money.
171
+ MONEY = 6
172
+ end
173
+ end
174
+
175
+ # A specific metric, identified by specifying values for all of the
176
+ # labels of a {Google::Api::MetricDescriptor +MetricDescriptor+}.
177
+ # @!attribute [rw] type
178
+ # @return [String]
179
+ # An existing metric type, see {Google::Api::MetricDescriptor}.
180
+ # For example, +custom.googleapis.com/invoice/paid/amount+.
181
+ # @!attribute [rw] labels
182
+ # @return [Hash{String => String}]
183
+ # The set of label values that uniquely identify this metric. All
184
+ # labels listed in the +MetricDescriptor+ must be assigned values.
185
+ class Metric; end
186
+ end
187
+ end
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Google
16
16
  module Api
17
- # An object that describes the schema of a MonitoredResource object using a
17
+ # An object that describes the schema of a {Google::Api::MonitoredResource MonitoredResource} object using a
18
18
  # type name and a set of labels. For example, the monitored resource
19
19
  # descriptor for Google Compute Engine VM instances has a type of
20
20
  # +"gce_instance"+ and specifies the use of the labels +"instance_id"+ and
@@ -56,11 +56,11 @@ module Google
56
56
  # An object representing a resource that can be used for monitoring, logging,
57
57
  # billing, or other purposes. Examples include virtual machine instances,
58
58
  # databases, and storage devices such as disks. The +type+ field identifies a
59
- # MonitoredResourceDescriptor object that describes the resource's
59
+ # {Google::Api::MonitoredResourceDescriptor MonitoredResourceDescriptor} object that describes the resource's
60
60
  # schema. Information in the +labels+ field identifies the actual resource and
61
61
  # its attributes according to the schema. For example, a particular Compute
62
62
  # Engine VM instance could be represented by the following object, because the
63
- # MonitoredResourceDescriptor for +"gce_instance"+ has labels
63
+ # {Google::Api::MonitoredResourceDescriptor MonitoredResourceDescriptor} for +"gce_instance"+ has labels
64
64
  # +"instance_id"+ and +"zone"+:
65
65
  #
66
66
  # { "type": "gce_instance",
@@ -69,7 +69,7 @@ module Google
69
69
  # @!attribute [rw] type
70
70
  # @return [String]
71
71
  # Required. The monitored resource type. This field must match
72
- # the +type+ field of a MonitoredResourceDescriptor object. For
72
+ # the +type+ field of a {Google::Api::MonitoredResourceDescriptor MonitoredResourceDescriptor} object. For
73
73
  # example, the type of a Cloud SQL database is +"cloudsql_database"+.
74
74
  # @!attribute [rw] labels
75
75
  # @return [Hash{String => String}]