google-cloud-logging 1.10.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +47 -0
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google-cloud-logging.rb +14 -15
- data/lib/google/cloud/logging.rb +12 -13
- data/lib/google/cloud/logging/credentials.rb +2 -2
- data/lib/google/cloud/logging/entry.rb +5 -5
- data/lib/google/cloud/logging/entry/http_request.rb +3 -3
- data/lib/google/cloud/logging/entry/list.rb +1 -1
- data/lib/google/cloud/logging/entry/operation.rb +3 -3
- data/lib/google/cloud/logging/entry/source_location.rb +3 -3
- data/lib/google/cloud/logging/log/list.rb +1 -1
- data/lib/google/cloud/logging/metric.rb +2 -2
- data/lib/google/cloud/logging/metric/list.rb +1 -1
- data/lib/google/cloud/logging/resource_descriptor/list.rb +1 -1
- data/lib/google/cloud/logging/service.rb +70 -173
- data/lib/google/cloud/logging/sink.rb +2 -2
- data/lib/google/cloud/logging/sink/list.rb +1 -1
- data/lib/google/cloud/logging/version.rb +1 -1
- metadata +11 -81
- data/lib/google/cloud/logging/v2.rb +0 -18
- data/lib/google/cloud/logging/v2/config_service_v2_client.rb +0 -1368
- data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +0 -101
- data/lib/google/cloud/logging/v2/credentials.rb +0 -39
- data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +0 -164
- data/lib/google/cloud/logging/v2/doc/google/api/label.rb +0 -42
- data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +0 -233
- data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +0 -85
- data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +0 -86
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +0 -179
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +0 -238
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +0 -660
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +0 -220
- data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +0 -680
- data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +0 -56
- data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +0 -475
- data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +0 -51
- data/lib/google/logging/v2/log_entry_pb.rb +0 -59
- data/lib/google/logging/v2/logging_config_pb.rb +0 -173
- data/lib/google/logging/v2/logging_config_services_pb.rb +0 -112
- data/lib/google/logging/v2/logging_metrics_pb.rb +0 -72
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +0 -52
- data/lib/google/logging/v2/logging_pb.rb +0 -80
- data/lib/google/logging/v2/logging_services_pb.rb +0 -64
@@ -1,56 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"interfaces": {
|
3
|
-
"google.logging.v2.LoggingServiceV2": {
|
4
|
-
"retry_codes": {
|
5
|
-
"idempotent": [
|
6
|
-
"DEADLINE_EXCEEDED",
|
7
|
-
"UNAVAILABLE"
|
8
|
-
],
|
9
|
-
"non_idempotent": []
|
10
|
-
},
|
11
|
-
"retry_params": {
|
12
|
-
"default": {
|
13
|
-
"initial_retry_delay_millis": 100,
|
14
|
-
"retry_delay_multiplier": 1.3,
|
15
|
-
"max_retry_delay_millis": 60000,
|
16
|
-
"initial_rpc_timeout_millis": 20000,
|
17
|
-
"rpc_timeout_multiplier": 1.0,
|
18
|
-
"max_rpc_timeout_millis": 20000,
|
19
|
-
"total_timeout_millis": 600000
|
20
|
-
}
|
21
|
-
},
|
22
|
-
"methods": {
|
23
|
-
"WriteLogEntries": {
|
24
|
-
"timeout_millis": 60000,
|
25
|
-
"retry_codes_name": "non_idempotent",
|
26
|
-
"retry_params_name": "default",
|
27
|
-
"bundling": {
|
28
|
-
"element_count_threshold": 1000,
|
29
|
-
"request_byte_threshold": 1048576,
|
30
|
-
"delay_threshold_millis": 50
|
31
|
-
}
|
32
|
-
},
|
33
|
-
"DeleteLog": {
|
34
|
-
"timeout_millis": 60000,
|
35
|
-
"retry_codes_name": "non_idempotent",
|
36
|
-
"retry_params_name": "default"
|
37
|
-
},
|
38
|
-
"ListLogEntries": {
|
39
|
-
"timeout_millis": 10000,
|
40
|
-
"retry_codes_name": "non_idempotent",
|
41
|
-
"retry_params_name": "default"
|
42
|
-
},
|
43
|
-
"ListMonitoredResourceDescriptors": {
|
44
|
-
"timeout_millis": 60000,
|
45
|
-
"retry_codes_name": "idempotent",
|
46
|
-
"retry_params_name": "default"
|
47
|
-
},
|
48
|
-
"ListLogs": {
|
49
|
-
"timeout_millis": 60000,
|
50
|
-
"retry_codes_name": "idempotent",
|
51
|
-
"retry_params_name": "default"
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
@@ -1,475 +0,0 @@
|
|
1
|
-
# Copyright 2020 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
|
-
# EDITING INSTRUCTIONS
|
16
|
-
# This file was generated from the file
|
17
|
-
# https://github.com/googleapis/googleapis/blob/master/google/logging/v2/logging_metrics.proto,
|
18
|
-
# and updates to that file get reflected here through a refresh process.
|
19
|
-
# For the short term, the refresh process will only be runnable by Google
|
20
|
-
# engineers.
|
21
|
-
|
22
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
|
28
|
-
require "google/logging/v2/logging_metrics_pb"
|
29
|
-
require "google/cloud/logging/v2/credentials"
|
30
|
-
require "google/cloud/logging/version"
|
31
|
-
|
32
|
-
module Google
|
33
|
-
module Cloud
|
34
|
-
module Logging
|
35
|
-
module V2
|
36
|
-
# Service for configuring logs-based metrics.
|
37
|
-
#
|
38
|
-
# @!attribute [r] metrics_service_v2_stub
|
39
|
-
# @return [Google::Logging::V2::MetricsServiceV2::Stub]
|
40
|
-
class MetricsServiceV2Client
|
41
|
-
# @private
|
42
|
-
attr_reader :metrics_service_v2_stub
|
43
|
-
|
44
|
-
# The default address of the service.
|
45
|
-
SERVICE_ADDRESS = "logging.googleapis.com".freeze
|
46
|
-
|
47
|
-
# The default port of the service.
|
48
|
-
DEFAULT_SERVICE_PORT = 443
|
49
|
-
|
50
|
-
# The default set of gRPC interceptors.
|
51
|
-
GRPC_INTERCEPTORS = []
|
52
|
-
|
53
|
-
DEFAULT_TIMEOUT = 30
|
54
|
-
|
55
|
-
PAGE_DESCRIPTORS = {
|
56
|
-
"list_log_metrics" => Google::Gax::PageDescriptor.new(
|
57
|
-
"page_token",
|
58
|
-
"next_page_token",
|
59
|
-
"metrics")
|
60
|
-
}.freeze
|
61
|
-
|
62
|
-
private_constant :PAGE_DESCRIPTORS
|
63
|
-
|
64
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
65
|
-
# this service.
|
66
|
-
ALL_SCOPES = [
|
67
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
68
|
-
"https://www.googleapis.com/auth/cloud-platform.read-only",
|
69
|
-
"https://www.googleapis.com/auth/logging.admin",
|
70
|
-
"https://www.googleapis.com/auth/logging.read",
|
71
|
-
"https://www.googleapis.com/auth/logging.write"
|
72
|
-
].freeze
|
73
|
-
|
74
|
-
|
75
|
-
LOG_METRIC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
76
|
-
"projects/{project}/metrics/{metric}"
|
77
|
-
)
|
78
|
-
|
79
|
-
private_constant :LOG_METRIC_PATH_TEMPLATE
|
80
|
-
|
81
|
-
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
82
|
-
"projects/{project}"
|
83
|
-
)
|
84
|
-
|
85
|
-
private_constant :PROJECT_PATH_TEMPLATE
|
86
|
-
|
87
|
-
# Returns a fully-qualified log_metric resource name string.
|
88
|
-
# @param project [String]
|
89
|
-
# @param metric [String]
|
90
|
-
# @return [String]
|
91
|
-
def self.log_metric_path project, metric
|
92
|
-
LOG_METRIC_PATH_TEMPLATE.render(
|
93
|
-
:"project" => project,
|
94
|
-
:"metric" => metric
|
95
|
-
)
|
96
|
-
end
|
97
|
-
|
98
|
-
# Returns a fully-qualified project resource name string.
|
99
|
-
# @param project [String]
|
100
|
-
# @return [String]
|
101
|
-
def self.project_path project
|
102
|
-
PROJECT_PATH_TEMPLATE.render(
|
103
|
-
:"project" => project
|
104
|
-
)
|
105
|
-
end
|
106
|
-
|
107
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
108
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
109
|
-
# be many types.
|
110
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
111
|
-
# authenticating requests made by this client.
|
112
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
113
|
-
# credentials for this client.
|
114
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
115
|
-
# credentials for this client.
|
116
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
117
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
118
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
119
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
120
|
-
# metadata for requests, generally, to give OAuth credentials.
|
121
|
-
# @param scopes [Array<String>]
|
122
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
123
|
-
# an updater_proc is supplied.
|
124
|
-
# @param client_config [Hash]
|
125
|
-
# A Hash for call options for each method. See
|
126
|
-
# Google::Gax#construct_settings for the structure of
|
127
|
-
# this data. Falls back to the default config if not specified
|
128
|
-
# or the specified config is missing data points.
|
129
|
-
# @param timeout [Numeric]
|
130
|
-
# The default timeout, in seconds, for calls made through this client.
|
131
|
-
# @param metadata [Hash]
|
132
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
133
|
-
# @param service_address [String]
|
134
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
135
|
-
# @param service_port [Integer]
|
136
|
-
# Override for the service port, or `nil` to leave as the default.
|
137
|
-
# @param exception_transformer [Proc]
|
138
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
139
|
-
# custom error handling.
|
140
|
-
def initialize \
|
141
|
-
credentials: nil,
|
142
|
-
scopes: ALL_SCOPES,
|
143
|
-
client_config: {},
|
144
|
-
timeout: DEFAULT_TIMEOUT,
|
145
|
-
metadata: nil,
|
146
|
-
service_address: nil,
|
147
|
-
service_port: nil,
|
148
|
-
exception_transformer: nil,
|
149
|
-
lib_name: nil,
|
150
|
-
lib_version: ""
|
151
|
-
# These require statements are intentionally placed here to initialize
|
152
|
-
# the gRPC module only when it's required.
|
153
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
154
|
-
require "google/gax/grpc"
|
155
|
-
require "google/logging/v2/logging_metrics_services_pb"
|
156
|
-
|
157
|
-
credentials ||= Google::Cloud::Logging::V2::Credentials.default
|
158
|
-
|
159
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
160
|
-
updater_proc = Google::Cloud::Logging::V2::Credentials.new(credentials).updater_proc
|
161
|
-
end
|
162
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
163
|
-
channel = credentials
|
164
|
-
end
|
165
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
166
|
-
chan_creds = credentials
|
167
|
-
end
|
168
|
-
if credentials.is_a?(Proc)
|
169
|
-
updater_proc = credentials
|
170
|
-
end
|
171
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
172
|
-
updater_proc = credentials.updater_proc
|
173
|
-
end
|
174
|
-
|
175
|
-
package_version = Google::Cloud::Logging::VERSION
|
176
|
-
|
177
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
178
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
179
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
180
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
181
|
-
google_api_client.freeze
|
182
|
-
|
183
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
184
|
-
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
185
|
-
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
186
|
-
end
|
187
|
-
headers.merge!(metadata) unless metadata.nil?
|
188
|
-
client_config_file = Pathname.new(__dir__).join(
|
189
|
-
"metrics_service_v2_client_config.json"
|
190
|
-
)
|
191
|
-
defaults = client_config_file.open do |f|
|
192
|
-
Google::Gax.construct_settings(
|
193
|
-
"google.logging.v2.MetricsServiceV2",
|
194
|
-
JSON.parse(f.read),
|
195
|
-
client_config,
|
196
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
197
|
-
timeout,
|
198
|
-
page_descriptors: PAGE_DESCRIPTORS,
|
199
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
200
|
-
metadata: headers
|
201
|
-
)
|
202
|
-
end
|
203
|
-
|
204
|
-
# Allow overriding the service path/port in subclasses.
|
205
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
206
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
207
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
208
|
-
@metrics_service_v2_stub = Google::Gax::Grpc.create_stub(
|
209
|
-
service_path,
|
210
|
-
port,
|
211
|
-
chan_creds: chan_creds,
|
212
|
-
channel: channel,
|
213
|
-
updater_proc: updater_proc,
|
214
|
-
scopes: scopes,
|
215
|
-
interceptors: interceptors,
|
216
|
-
&Google::Logging::V2::MetricsServiceV2::Stub.method(:new)
|
217
|
-
)
|
218
|
-
|
219
|
-
@list_log_metrics = Google::Gax.create_api_call(
|
220
|
-
@metrics_service_v2_stub.method(:list_log_metrics),
|
221
|
-
defaults["list_log_metrics"],
|
222
|
-
exception_transformer: exception_transformer,
|
223
|
-
params_extractor: proc do |request|
|
224
|
-
{'parent' => request.parent}
|
225
|
-
end
|
226
|
-
)
|
227
|
-
@get_log_metric = Google::Gax.create_api_call(
|
228
|
-
@metrics_service_v2_stub.method(:get_log_metric),
|
229
|
-
defaults["get_log_metric"],
|
230
|
-
exception_transformer: exception_transformer,
|
231
|
-
params_extractor: proc do |request|
|
232
|
-
{'metric_name' => request.metric_name}
|
233
|
-
end
|
234
|
-
)
|
235
|
-
@create_log_metric = Google::Gax.create_api_call(
|
236
|
-
@metrics_service_v2_stub.method(:create_log_metric),
|
237
|
-
defaults["create_log_metric"],
|
238
|
-
exception_transformer: exception_transformer,
|
239
|
-
params_extractor: proc do |request|
|
240
|
-
{'parent' => request.parent}
|
241
|
-
end
|
242
|
-
)
|
243
|
-
@update_log_metric = Google::Gax.create_api_call(
|
244
|
-
@metrics_service_v2_stub.method(:update_log_metric),
|
245
|
-
defaults["update_log_metric"],
|
246
|
-
exception_transformer: exception_transformer,
|
247
|
-
params_extractor: proc do |request|
|
248
|
-
{'metric_name' => request.metric_name}
|
249
|
-
end
|
250
|
-
)
|
251
|
-
@delete_log_metric = Google::Gax.create_api_call(
|
252
|
-
@metrics_service_v2_stub.method(:delete_log_metric),
|
253
|
-
defaults["delete_log_metric"],
|
254
|
-
exception_transformer: exception_transformer,
|
255
|
-
params_extractor: proc do |request|
|
256
|
-
{'metric_name' => request.metric_name}
|
257
|
-
end
|
258
|
-
)
|
259
|
-
end
|
260
|
-
|
261
|
-
# Service calls
|
262
|
-
|
263
|
-
# Lists logs-based metrics.
|
264
|
-
#
|
265
|
-
# @param parent [String]
|
266
|
-
# Required. The name of the project containing the metrics:
|
267
|
-
#
|
268
|
-
# "projects/[PROJECT_ID]"
|
269
|
-
# @param page_size [Integer]
|
270
|
-
# The maximum number of resources contained in the underlying API
|
271
|
-
# response. If page streaming is performed per-resource, this
|
272
|
-
# parameter does not affect the return value. If page streaming is
|
273
|
-
# performed per-page, this determines the maximum number of
|
274
|
-
# resources in a page.
|
275
|
-
# @param options [Google::Gax::CallOptions]
|
276
|
-
# Overrides the default settings for this call, e.g, timeout,
|
277
|
-
# retries, etc.
|
278
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
279
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogMetric>]
|
280
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
281
|
-
# @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogMetric>]
|
282
|
-
# An enumerable of Google::Logging::V2::LogMetric instances.
|
283
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
284
|
-
# operations such as per-page iteration or access to the response
|
285
|
-
# object.
|
286
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
287
|
-
# @example
|
288
|
-
# require "google/cloud/logging/v2"
|
289
|
-
#
|
290
|
-
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
291
|
-
# formatted_parent = Google::Cloud::Logging::V2::MetricsServiceV2Client.project_path("[PROJECT]")
|
292
|
-
#
|
293
|
-
# # Iterate over all results.
|
294
|
-
# metrics_client.list_log_metrics(formatted_parent).each do |element|
|
295
|
-
# # Process element.
|
296
|
-
# end
|
297
|
-
#
|
298
|
-
# # Or iterate over results one page at a time.
|
299
|
-
# metrics_client.list_log_metrics(formatted_parent).each_page do |page|
|
300
|
-
# # Process each page at a time.
|
301
|
-
# page.each do |element|
|
302
|
-
# # Process element.
|
303
|
-
# end
|
304
|
-
# end
|
305
|
-
|
306
|
-
def list_log_metrics \
|
307
|
-
parent,
|
308
|
-
page_size: nil,
|
309
|
-
options: nil,
|
310
|
-
&block
|
311
|
-
req = {
|
312
|
-
parent: parent,
|
313
|
-
page_size: page_size
|
314
|
-
}.delete_if { |_, v| v.nil? }
|
315
|
-
req = Google::Gax::to_proto(req, Google::Logging::V2::ListLogMetricsRequest)
|
316
|
-
@list_log_metrics.call(req, options, &block)
|
317
|
-
end
|
318
|
-
|
319
|
-
# Gets a logs-based metric.
|
320
|
-
#
|
321
|
-
# @param metric_name [String]
|
322
|
-
# Required. The resource name of the desired metric:
|
323
|
-
#
|
324
|
-
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
325
|
-
# @param options [Google::Gax::CallOptions]
|
326
|
-
# Overrides the default settings for this call, e.g, timeout,
|
327
|
-
# retries, etc.
|
328
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
329
|
-
# @yieldparam result [Google::Logging::V2::LogMetric]
|
330
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
331
|
-
# @return [Google::Logging::V2::LogMetric]
|
332
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
333
|
-
# @example
|
334
|
-
# require "google/cloud/logging/v2"
|
335
|
-
#
|
336
|
-
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
337
|
-
# formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.log_metric_path("[PROJECT]", "[METRIC]")
|
338
|
-
# response = metrics_client.get_log_metric(formatted_metric_name)
|
339
|
-
|
340
|
-
def get_log_metric \
|
341
|
-
metric_name,
|
342
|
-
options: nil,
|
343
|
-
&block
|
344
|
-
req = {
|
345
|
-
metric_name: metric_name
|
346
|
-
}.delete_if { |_, v| v.nil? }
|
347
|
-
req = Google::Gax::to_proto(req, Google::Logging::V2::GetLogMetricRequest)
|
348
|
-
@get_log_metric.call(req, options, &block)
|
349
|
-
end
|
350
|
-
|
351
|
-
# Creates a logs-based metric.
|
352
|
-
#
|
353
|
-
# @param parent [String]
|
354
|
-
# Required. The resource name of the project in which to create the metric:
|
355
|
-
#
|
356
|
-
# "projects/[PROJECT_ID]"
|
357
|
-
#
|
358
|
-
# The new metric must be provided in the request.
|
359
|
-
# @param metric [Google::Logging::V2::LogMetric | Hash]
|
360
|
-
# Required. The new logs-based metric, which must not have an identifier that
|
361
|
-
# already exists.
|
362
|
-
# A hash of the same form as `Google::Logging::V2::LogMetric`
|
363
|
-
# can also be provided.
|
364
|
-
# @param options [Google::Gax::CallOptions]
|
365
|
-
# Overrides the default settings for this call, e.g, timeout,
|
366
|
-
# retries, etc.
|
367
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
368
|
-
# @yieldparam result [Google::Logging::V2::LogMetric]
|
369
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
370
|
-
# @return [Google::Logging::V2::LogMetric]
|
371
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
372
|
-
# @example
|
373
|
-
# require "google/cloud/logging/v2"
|
374
|
-
#
|
375
|
-
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
376
|
-
# formatted_parent = Google::Cloud::Logging::V2::MetricsServiceV2Client.project_path("[PROJECT]")
|
377
|
-
#
|
378
|
-
# # TODO: Initialize `metric`:
|
379
|
-
# metric = {}
|
380
|
-
# response = metrics_client.create_log_metric(formatted_parent, metric)
|
381
|
-
|
382
|
-
def create_log_metric \
|
383
|
-
parent,
|
384
|
-
metric,
|
385
|
-
options: nil,
|
386
|
-
&block
|
387
|
-
req = {
|
388
|
-
parent: parent,
|
389
|
-
metric: metric
|
390
|
-
}.delete_if { |_, v| v.nil? }
|
391
|
-
req = Google::Gax::to_proto(req, Google::Logging::V2::CreateLogMetricRequest)
|
392
|
-
@create_log_metric.call(req, options, &block)
|
393
|
-
end
|
394
|
-
|
395
|
-
# Creates or updates a logs-based metric.
|
396
|
-
#
|
397
|
-
# @param metric_name [String]
|
398
|
-
# Required. The resource name of the metric to update:
|
399
|
-
#
|
400
|
-
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
401
|
-
#
|
402
|
-
# The updated metric must be provided in the request and it's
|
403
|
-
# `name` field must be the same as `[METRIC_ID]` If the metric
|
404
|
-
# does not exist in `[PROJECT_ID]`, then a new metric is created.
|
405
|
-
# @param metric [Google::Logging::V2::LogMetric | Hash]
|
406
|
-
# Required. The updated metric.
|
407
|
-
# A hash of the same form as `Google::Logging::V2::LogMetric`
|
408
|
-
# can also be provided.
|
409
|
-
# @param options [Google::Gax::CallOptions]
|
410
|
-
# Overrides the default settings for this call, e.g, timeout,
|
411
|
-
# retries, etc.
|
412
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
413
|
-
# @yieldparam result [Google::Logging::V2::LogMetric]
|
414
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
415
|
-
# @return [Google::Logging::V2::LogMetric]
|
416
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
417
|
-
# @example
|
418
|
-
# require "google/cloud/logging/v2"
|
419
|
-
#
|
420
|
-
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
421
|
-
# formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.log_metric_path("[PROJECT]", "[METRIC]")
|
422
|
-
#
|
423
|
-
# # TODO: Initialize `metric`:
|
424
|
-
# metric = {}
|
425
|
-
# response = metrics_client.update_log_metric(formatted_metric_name, metric)
|
426
|
-
|
427
|
-
def update_log_metric \
|
428
|
-
metric_name,
|
429
|
-
metric,
|
430
|
-
options: nil,
|
431
|
-
&block
|
432
|
-
req = {
|
433
|
-
metric_name: metric_name,
|
434
|
-
metric: metric
|
435
|
-
}.delete_if { |_, v| v.nil? }
|
436
|
-
req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateLogMetricRequest)
|
437
|
-
@update_log_metric.call(req, options, &block)
|
438
|
-
end
|
439
|
-
|
440
|
-
# Deletes a logs-based metric.
|
441
|
-
#
|
442
|
-
# @param metric_name [String]
|
443
|
-
# Required. The resource name of the metric to delete:
|
444
|
-
#
|
445
|
-
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
446
|
-
# @param options [Google::Gax::CallOptions]
|
447
|
-
# Overrides the default settings for this call, e.g, timeout,
|
448
|
-
# retries, etc.
|
449
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
450
|
-
# @yieldparam result []
|
451
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
452
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
453
|
-
# @example
|
454
|
-
# require "google/cloud/logging/v2"
|
455
|
-
#
|
456
|
-
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
457
|
-
# formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.log_metric_path("[PROJECT]", "[METRIC]")
|
458
|
-
# metrics_client.delete_log_metric(formatted_metric_name)
|
459
|
-
|
460
|
-
def delete_log_metric \
|
461
|
-
metric_name,
|
462
|
-
options: nil,
|
463
|
-
&block
|
464
|
-
req = {
|
465
|
-
metric_name: metric_name
|
466
|
-
}.delete_if { |_, v| v.nil? }
|
467
|
-
req = Google::Gax::to_proto(req, Google::Logging::V2::DeleteLogMetricRequest)
|
468
|
-
@delete_log_metric.call(req, options, &block)
|
469
|
-
nil
|
470
|
-
end
|
471
|
-
end
|
472
|
-
end
|
473
|
-
end
|
474
|
-
end
|
475
|
-
end
|