google-cloud-logging 0.21.2 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +0 -3
- data/lib/google/cloud/logging/entry/list.rb +8 -7
- data/lib/google/cloud/logging/logger.rb +2 -2
- data/lib/google/cloud/logging/metric/list.rb +1 -1
- data/lib/google/cloud/logging/middleware.rb +27 -23
- data/lib/google/cloud/logging/project.rb +41 -12
- data/lib/google/cloud/logging/resource_descriptor.rb +1 -1
- data/lib/google/cloud/logging/service.rb +47 -18
- data/lib/google/cloud/logging/sink.rb +81 -2
- data/lib/google/cloud/logging/sink/list.rb +1 -1
- data/lib/google/cloud/logging/v2.rb +3 -3
- data/lib/google/cloud/logging/v2/{config_service_v2_api.rb → config_service_v2_client.rb} +82 -52
- data/lib/google/cloud/logging/v2/doc/google/api/label.rb +41 -0
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +17 -12
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +28 -8
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +72 -36
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +39 -25
- data/lib/google/cloud/logging/v2/{logging_service_v2_api.rb → logging_service_v2_client.rb} +65 -43
- data/lib/google/cloud/logging/v2/{metrics_service_v2_api.rb → metrics_service_v2_client.rb} +57 -52
- data/lib/google/cloud/logging/version.rb +1 -1
- data/lib/google/logging/v2/logging_config_pb.rb +4 -0
- data/lib/google/logging/v2/logging_config_services_pb.rb +2 -2
- data/lib/google/logging/v2/logging_services_pb.rb +2 -2
- metadata +8 -21
@@ -36,7 +36,7 @@ module Google
|
|
36
36
|
#
|
37
37
|
# @!attribute [r] metrics_service_v2_stub
|
38
38
|
# @return [Google::Logging::V2::MetricsServiceV2::Stub]
|
39
|
-
class
|
39
|
+
class MetricsServiceV2Client
|
40
40
|
attr_reader :metrics_service_v2_stub
|
41
41
|
|
42
42
|
# The default address of the service.
|
@@ -68,11 +68,11 @@ module Google
|
|
68
68
|
"https://www.googleapis.com/auth/logging.write"
|
69
69
|
].freeze
|
70
70
|
|
71
|
-
|
71
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
72
72
|
"projects/{project}"
|
73
73
|
)
|
74
74
|
|
75
|
-
private_constant :
|
75
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
76
76
|
|
77
77
|
METRIC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
78
78
|
"projects/{project}/metrics/{metric}"
|
@@ -80,11 +80,11 @@ module Google
|
|
80
80
|
|
81
81
|
private_constant :METRIC_PATH_TEMPLATE
|
82
82
|
|
83
|
-
# Returns a fully-qualified
|
83
|
+
# Returns a fully-qualified project resource name string.
|
84
84
|
# @param project [String]
|
85
85
|
# @return [String]
|
86
|
-
def self.
|
87
|
-
|
86
|
+
def self.project_path project
|
87
|
+
PROJECT_PATH_TEMPLATE.render(
|
88
88
|
:"project" => project
|
89
89
|
)
|
90
90
|
end
|
@@ -100,11 +100,11 @@ module Google
|
|
100
100
|
)
|
101
101
|
end
|
102
102
|
|
103
|
-
# Parses the project from a
|
104
|
-
# @param
|
103
|
+
# Parses the project from a project resource.
|
104
|
+
# @param project_name [String]
|
105
105
|
# @return [String]
|
106
|
-
def self.
|
107
|
-
|
106
|
+
def self.match_project_from_project_name project_name
|
107
|
+
PROJECT_PATH_TEMPLATE.match(project_name)["project"]
|
108
108
|
end
|
109
109
|
|
110
110
|
# Parses the project from a metric resource.
|
@@ -156,6 +156,7 @@ module Google
|
|
156
156
|
require "google/gax/grpc"
|
157
157
|
require "google/logging/v2/logging_metrics_services_pb"
|
158
158
|
|
159
|
+
|
159
160
|
google_api_client = "#{app_name}/#{app_version} " \
|
160
161
|
"#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
|
161
162
|
"ruby/#{RUBY_VERSION}".freeze
|
@@ -211,8 +212,9 @@ module Google
|
|
211
212
|
# Lists logs-based metrics.
|
212
213
|
#
|
213
214
|
# @param parent [String]
|
214
|
-
# Required. The
|
215
|
-
#
|
215
|
+
# Required. The name of the project containing the metrics:
|
216
|
+
#
|
217
|
+
# "projects/[PROJECT_ID]"
|
216
218
|
# @param page_size [Integer]
|
217
219
|
# The maximum number of resources contained in the underlying API
|
218
220
|
# response. If page streaming is performed per-resource, this
|
@@ -229,20 +231,20 @@ module Google
|
|
229
231
|
# object.
|
230
232
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
231
233
|
# @example
|
232
|
-
# require "google/cloud/logging/v2/
|
234
|
+
# require "google/cloud/logging/v2/metrics_service_v2_client"
|
233
235
|
#
|
234
|
-
#
|
236
|
+
# MetricsServiceV2Client = Google::Cloud::Logging::V2::MetricsServiceV2Client
|
235
237
|
#
|
236
|
-
#
|
237
|
-
# formatted_parent =
|
238
|
+
# metrics_service_v2_client = MetricsServiceV2Client.new
|
239
|
+
# formatted_parent = MetricsServiceV2Client.project_path("[PROJECT]")
|
238
240
|
#
|
239
241
|
# # Iterate over all results.
|
240
|
-
#
|
242
|
+
# metrics_service_v2_client.list_log_metrics(formatted_parent).each do |element|
|
241
243
|
# # Process element.
|
242
244
|
# end
|
243
245
|
#
|
244
246
|
# # Or iterate over results one page at a time.
|
245
|
-
#
|
247
|
+
# metrics_service_v2_client.list_log_metrics(formatted_parent).each_page do |page|
|
246
248
|
# # Process each page at a time.
|
247
249
|
# page.each do |element|
|
248
250
|
# # Process element.
|
@@ -263,21 +265,22 @@ module Google
|
|
263
265
|
# Gets a logs-based metric.
|
264
266
|
#
|
265
267
|
# @param metric_name [String]
|
266
|
-
# The resource name of the desired metric
|
267
|
-
#
|
268
|
+
# The resource name of the desired metric:
|
269
|
+
#
|
270
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
268
271
|
# @param options [Google::Gax::CallOptions]
|
269
272
|
# Overrides the default settings for this call, e.g, timeout,
|
270
273
|
# retries, etc.
|
271
274
|
# @return [Google::Logging::V2::LogMetric]
|
272
275
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
273
276
|
# @example
|
274
|
-
# require "google/cloud/logging/v2/
|
277
|
+
# require "google/cloud/logging/v2/metrics_service_v2_client"
|
275
278
|
#
|
276
|
-
#
|
279
|
+
# MetricsServiceV2Client = Google::Cloud::Logging::V2::MetricsServiceV2Client
|
277
280
|
#
|
278
|
-
#
|
279
|
-
# formatted_metric_name =
|
280
|
-
# response =
|
281
|
+
# metrics_service_v2_client = MetricsServiceV2Client.new
|
282
|
+
# formatted_metric_name = MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
|
283
|
+
# response = metrics_service_v2_client.get_log_metric(formatted_metric_name)
|
281
284
|
|
282
285
|
def get_log_metric \
|
283
286
|
metric_name,
|
@@ -291,8 +294,9 @@ module Google
|
|
291
294
|
# Creates a logs-based metric.
|
292
295
|
#
|
293
296
|
# @param parent [String]
|
294
|
-
# The resource name of the project in which to create the metric
|
295
|
-
#
|
297
|
+
# The resource name of the project in which to create the metric:
|
298
|
+
#
|
299
|
+
# "projects/[PROJECT_ID]"
|
296
300
|
#
|
297
301
|
# The new metric must be provided in the request.
|
298
302
|
# @param metric [Google::Logging::V2::LogMetric]
|
@@ -304,15 +308,15 @@ module Google
|
|
304
308
|
# @return [Google::Logging::V2::LogMetric]
|
305
309
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
306
310
|
# @example
|
307
|
-
# require "google/cloud/logging/v2/
|
311
|
+
# require "google/cloud/logging/v2/metrics_service_v2_client"
|
308
312
|
#
|
309
313
|
# LogMetric = Google::Logging::V2::LogMetric
|
310
|
-
#
|
314
|
+
# MetricsServiceV2Client = Google::Cloud::Logging::V2::MetricsServiceV2Client
|
311
315
|
#
|
312
|
-
#
|
313
|
-
# formatted_parent =
|
316
|
+
# metrics_service_v2_client = MetricsServiceV2Client.new
|
317
|
+
# formatted_parent = MetricsServiceV2Client.project_path("[PROJECT]")
|
314
318
|
# metric = LogMetric.new
|
315
|
-
# response =
|
319
|
+
# response = metrics_service_v2_client.create_log_metric(formatted_parent, metric)
|
316
320
|
|
317
321
|
def create_log_metric \
|
318
322
|
parent,
|
@@ -328,31 +332,30 @@ module Google
|
|
328
332
|
# Creates or updates a logs-based metric.
|
329
333
|
#
|
330
334
|
# @param metric_name [String]
|
331
|
-
# The resource name of the metric to update
|
332
|
-
#
|
335
|
+
# The resource name of the metric to update:
|
336
|
+
#
|
337
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
333
338
|
#
|
334
|
-
# The updated metric must be provided in the request and
|
335
|
-
#
|
336
|
-
#
|
339
|
+
# The updated metric must be provided in the request and it's
|
340
|
+
# +name+ field must be the same as +[METRIC_ID]+ If the metric
|
341
|
+
# does not exist in +[PROJECT_ID]+, then a new metric is created.
|
337
342
|
# @param metric [Google::Logging::V2::LogMetric]
|
338
|
-
# The updated metric
|
339
|
-
# metric identifier in +metricName+. If +metricName+ does not
|
340
|
-
# exist, then a new metric is created.
|
343
|
+
# The updated metric.
|
341
344
|
# @param options [Google::Gax::CallOptions]
|
342
345
|
# Overrides the default settings for this call, e.g, timeout,
|
343
346
|
# retries, etc.
|
344
347
|
# @return [Google::Logging::V2::LogMetric]
|
345
348
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
346
349
|
# @example
|
347
|
-
# require "google/cloud/logging/v2/
|
350
|
+
# require "google/cloud/logging/v2/metrics_service_v2_client"
|
348
351
|
#
|
349
352
|
# LogMetric = Google::Logging::V2::LogMetric
|
350
|
-
#
|
353
|
+
# MetricsServiceV2Client = Google::Cloud::Logging::V2::MetricsServiceV2Client
|
351
354
|
#
|
352
|
-
#
|
353
|
-
# formatted_metric_name =
|
355
|
+
# metrics_service_v2_client = MetricsServiceV2Client.new
|
356
|
+
# formatted_metric_name = MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
|
354
357
|
# metric = LogMetric.new
|
355
|
-
# response =
|
358
|
+
# response = metrics_service_v2_client.update_log_metric(formatted_metric_name, metric)
|
356
359
|
|
357
360
|
def update_log_metric \
|
358
361
|
metric_name,
|
@@ -368,20 +371,21 @@ module Google
|
|
368
371
|
# Deletes a logs-based metric.
|
369
372
|
#
|
370
373
|
# @param metric_name [String]
|
371
|
-
# The resource name of the metric to delete
|
372
|
-
#
|
374
|
+
# The resource name of the metric to delete:
|
375
|
+
#
|
376
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
373
377
|
# @param options [Google::Gax::CallOptions]
|
374
378
|
# Overrides the default settings for this call, e.g, timeout,
|
375
379
|
# retries, etc.
|
376
380
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
377
381
|
# @example
|
378
|
-
# require "google/cloud/logging/v2/
|
382
|
+
# require "google/cloud/logging/v2/metrics_service_v2_client"
|
379
383
|
#
|
380
|
-
#
|
384
|
+
# MetricsServiceV2Client = Google::Cloud::Logging::V2::MetricsServiceV2Client
|
381
385
|
#
|
382
|
-
#
|
383
|
-
# formatted_metric_name =
|
384
|
-
#
|
386
|
+
# metrics_service_v2_client = MetricsServiceV2Client.new
|
387
|
+
# formatted_metric_name = MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
|
388
|
+
# metrics_service_v2_client.delete_log_metric(formatted_metric_name)
|
385
389
|
|
386
390
|
def delete_log_metric \
|
387
391
|
metric_name,
|
@@ -390,6 +394,7 @@ module Google
|
|
390
394
|
metric_name: metric_name
|
391
395
|
}.delete_if { |_, v| v.nil? })
|
392
396
|
@delete_log_metric.call(req, options)
|
397
|
+
nil
|
393
398
|
end
|
394
399
|
end
|
395
400
|
end
|
@@ -13,6 +13,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
13
13
|
optional :filter, :string, 5
|
14
14
|
optional :output_version_format, :enum, 6, "google.logging.v2.LogSink.VersionFormat"
|
15
15
|
optional :writer_identity, :string, 8
|
16
|
+
optional :start_time, :message, 10, "google.protobuf.Timestamp"
|
17
|
+
optional :end_time, :message, 11, "google.protobuf.Timestamp"
|
16
18
|
end
|
17
19
|
add_enum "google.logging.v2.LogSink.VersionFormat" do
|
18
20
|
value :VERSION_FORMAT_UNSPECIFIED, 0
|
@@ -34,10 +36,12 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
34
36
|
add_message "google.logging.v2.CreateSinkRequest" do
|
35
37
|
optional :parent, :string, 1
|
36
38
|
optional :sink, :message, 2, "google.logging.v2.LogSink"
|
39
|
+
optional :unique_writer_identity, :bool, 3
|
37
40
|
end
|
38
41
|
add_message "google.logging.v2.UpdateSinkRequest" do
|
39
42
|
optional :sink_name, :string, 1
|
40
43
|
optional :sink, :message, 2, "google.logging.v2.LogSink"
|
44
|
+
optional :unique_writer_identity, :bool, 3
|
41
45
|
end
|
42
46
|
add_message "google.logging.v2.DeleteSinkRequest" do
|
43
47
|
optional :sink_name, :string, 1
|
@@ -23,8 +23,8 @@ module Google
|
|
23
23
|
module Logging
|
24
24
|
module V2
|
25
25
|
module ConfigServiceV2
|
26
|
-
# Service for configuring sinks used to export log entries outside
|
27
|
-
# Logging.
|
26
|
+
# Service for configuring sinks used to export log entries outside of
|
27
|
+
# Stackdriver Logging.
|
28
28
|
class Service
|
29
29
|
|
30
30
|
include GRPC::GenericService
|
@@ -32,8 +32,8 @@ module Google
|
|
32
32
|
self.unmarshal_class_method = :decode
|
33
33
|
self.service_name = 'google.logging.v2.LoggingServiceV2'
|
34
34
|
|
35
|
-
# Deletes
|
36
|
-
# The log
|
35
|
+
# Deletes all the log entries in a log.
|
36
|
+
# The log reappears if it receives new entries.
|
37
37
|
rpc :DeleteLog, DeleteLogRequest, Google::Protobuf::Empty
|
38
38
|
# Writes log entries to Stackdriver Logging. All log entries are
|
39
39
|
# written by this method.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -222,7 +222,7 @@ dependencies:
|
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: 0.1.8
|
224
224
|
- !ruby/object:Gem::Dependency
|
225
|
-
name:
|
225
|
+
name: railties
|
226
226
|
requirement: !ruby/object:Gem::Requirement
|
227
227
|
requirements:
|
228
228
|
- - "~>"
|
@@ -235,20 +235,6 @@ dependencies:
|
|
235
235
|
- - "~>"
|
236
236
|
- !ruby/object:Gem::Version
|
237
237
|
version: '4.0'
|
238
|
-
- !ruby/object:Gem::Dependency
|
239
|
-
name: railties
|
240
|
-
requirement: !ruby/object:Gem::Requirement
|
241
|
-
requirements:
|
242
|
-
- - ">="
|
243
|
-
- !ruby/object:Gem::Version
|
244
|
-
version: '3.2'
|
245
|
-
type: :development
|
246
|
-
prerelease: false
|
247
|
-
version_requirements: !ruby/object:Gem::Requirement
|
248
|
-
requirements:
|
249
|
-
- - ">="
|
250
|
-
- !ruby/object:Gem::Version
|
251
|
-
version: '3.2'
|
252
238
|
- !ruby/object:Gem::Dependency
|
253
239
|
name: rack
|
254
240
|
requirement: !ruby/object:Gem::Requirement
|
@@ -295,8 +281,9 @@ files:
|
|
295
281
|
- lib/google/cloud/logging/sink.rb
|
296
282
|
- lib/google/cloud/logging/sink/list.rb
|
297
283
|
- lib/google/cloud/logging/v2.rb
|
298
|
-
- lib/google/cloud/logging/v2/
|
284
|
+
- lib/google/cloud/logging/v2/config_service_v2_client.rb
|
299
285
|
- lib/google/cloud/logging/v2/config_service_v2_client_config.json
|
286
|
+
- lib/google/cloud/logging/v2/doc/google/api/label.rb
|
300
287
|
- lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb
|
301
288
|
- lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb
|
302
289
|
- lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb
|
@@ -306,9 +293,9 @@ files:
|
|
306
293
|
- lib/google/cloud/logging/v2/doc/google/protobuf/any.rb
|
307
294
|
- lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb
|
308
295
|
- lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb
|
309
|
-
- lib/google/cloud/logging/v2/
|
296
|
+
- lib/google/cloud/logging/v2/logging_service_v2_client.rb
|
310
297
|
- lib/google/cloud/logging/v2/logging_service_v2_client_config.json
|
311
|
-
- lib/google/cloud/logging/v2/
|
298
|
+
- lib/google/cloud/logging/v2/metrics_service_v2_client.rb
|
312
299
|
- lib/google/cloud/logging/v2/metrics_service_v2_client_config.json
|
313
300
|
- lib/google/cloud/logging/version.rb
|
314
301
|
- lib/google/logging/v2/log_entry_pb.rb
|
@@ -338,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
338
325
|
version: '0'
|
339
326
|
requirements: []
|
340
327
|
rubyforge_project:
|
341
|
-
rubygems_version: 2.5.1
|
328
|
+
rubygems_version: 2.4.5.1
|
342
329
|
signing_key:
|
343
330
|
specification_version: 4
|
344
331
|
summary: API Client library for Stackdriver Logging
|