google-cloud-logging 0.20.1 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google-cloud-logging.rb +27 -32
- data/lib/google/cloud/logging.rb +134 -44
- data/lib/google/cloud/logging/async_writer.rb +399 -0
- data/lib/google/cloud/logging/credentials.rb +10 -0
- data/lib/google/cloud/logging/entry.rb +22 -32
- data/lib/google/cloud/logging/entry/list.rb +10 -15
- data/lib/google/cloud/logging/logger.rb +93 -18
- data/lib/google/cloud/logging/metric.rb +8 -12
- data/lib/google/cloud/logging/metric/list.rb +10 -15
- data/lib/google/cloud/logging/middleware.rb +135 -0
- data/lib/google/cloud/logging/project.rb +138 -76
- data/lib/google/cloud/logging/rails.rb +121 -0
- data/lib/google/cloud/logging/resource.rb +2 -3
- data/lib/google/cloud/logging/resource_descriptor.rb +4 -6
- data/lib/google/cloud/logging/resource_descriptor/list.rb +10 -15
- data/lib/google/cloud/logging/service.rb +146 -141
- data/lib/google/cloud/logging/sink.rb +9 -11
- data/lib/google/cloud/logging/sink/list.rb +10 -15
- data/lib/google/cloud/logging/v2/config_service_v2_api.rb +93 -27
- data/lib/google/cloud/logging/v2/logging_service_v2_api.rb +118 -29
- data/lib/google/cloud/logging/v2/metrics_service_v2_api.rb +78 -10
- data/lib/google/cloud/logging/version.rb +1 -1
- data/lib/google/logging/v2/logging_config_pb.rb +1 -0
- data/lib/google/logging/v2/logging_config_services_pb.rb +1 -1
- data/lib/google/logging/v2/logging_metrics_pb.rb +6 -0
- data/lib/google/logging/v2/logging_pb.rb +1 -0
- data/lib/google/logging/v2/logging_services_pb.rb +0 -3
- metadata +84 -11
@@ -26,7 +26,7 @@ require "json"
|
|
26
26
|
require "pathname"
|
27
27
|
|
28
28
|
require "google/gax"
|
29
|
-
require "google/logging/v2/
|
29
|
+
require "google/logging/v2/logging_metrics_pb"
|
30
30
|
|
31
31
|
module Google
|
32
32
|
module Cloud
|
@@ -34,10 +34,10 @@ module Google
|
|
34
34
|
module V2
|
35
35
|
# Service for configuring logs-based metrics.
|
36
36
|
#
|
37
|
-
# @!attribute [r]
|
37
|
+
# @!attribute [r] metrics_service_v2_stub
|
38
38
|
# @return [Google::Logging::V2::MetricsServiceV2::Stub]
|
39
39
|
class MetricsServiceV2Api
|
40
|
-
attr_reader :
|
40
|
+
attr_reader :metrics_service_v2_stub
|
41
41
|
|
42
42
|
# The default address of the service.
|
43
43
|
SERVICE_ADDRESS = "logging.googleapis.com".freeze
|
@@ -150,8 +150,15 @@ module Google
|
|
150
150
|
timeout: DEFAULT_TIMEOUT,
|
151
151
|
app_name: "gax",
|
152
152
|
app_version: Google::Gax::VERSION
|
153
|
+
# These require statements are intentionally placed here to initialize
|
154
|
+
# the gRPC module only when it's required.
|
155
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
156
|
+
require "google/gax/grpc"
|
157
|
+
require "google/logging/v2/logging_metrics_services_pb"
|
158
|
+
|
153
159
|
google_api_client = "#{app_name}/#{app_version} " \
|
154
|
-
"#{CODE_GEN_NAME_VERSION}
|
160
|
+
"#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
|
161
|
+
"ruby/#{RUBY_VERSION}".freeze
|
155
162
|
headers = { :"x-goog-api-client" => google_api_client }
|
156
163
|
client_config_file = Pathname.new(__dir__).join(
|
157
164
|
"metrics_service_v2_client_config.json"
|
@@ -168,7 +175,7 @@ module Google
|
|
168
175
|
kwargs: headers
|
169
176
|
)
|
170
177
|
end
|
171
|
-
@
|
178
|
+
@metrics_service_v2_stub = Google::Gax::Grpc.create_stub(
|
172
179
|
service_path,
|
173
180
|
port,
|
174
181
|
chan_creds: chan_creds,
|
@@ -178,23 +185,23 @@ module Google
|
|
178
185
|
)
|
179
186
|
|
180
187
|
@list_log_metrics = Google::Gax.create_api_call(
|
181
|
-
@
|
188
|
+
@metrics_service_v2_stub.method(:list_log_metrics),
|
182
189
|
defaults["list_log_metrics"]
|
183
190
|
)
|
184
191
|
@get_log_metric = Google::Gax.create_api_call(
|
185
|
-
@
|
192
|
+
@metrics_service_v2_stub.method(:get_log_metric),
|
186
193
|
defaults["get_log_metric"]
|
187
194
|
)
|
188
195
|
@create_log_metric = Google::Gax.create_api_call(
|
189
|
-
@
|
196
|
+
@metrics_service_v2_stub.method(:create_log_metric),
|
190
197
|
defaults["create_log_metric"]
|
191
198
|
)
|
192
199
|
@update_log_metric = Google::Gax.create_api_call(
|
193
|
-
@
|
200
|
+
@metrics_service_v2_stub.method(:update_log_metric),
|
194
201
|
defaults["update_log_metric"]
|
195
202
|
)
|
196
203
|
@delete_log_metric = Google::Gax.create_api_call(
|
197
|
-
@
|
204
|
+
@metrics_service_v2_stub.method(:delete_log_metric),
|
198
205
|
defaults["delete_log_metric"]
|
199
206
|
)
|
200
207
|
end
|
@@ -221,6 +228,27 @@ module Google
|
|
221
228
|
# operations such as per-page iteration or access to the response
|
222
229
|
# object.
|
223
230
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
231
|
+
# @example
|
232
|
+
# require "google/cloud/logging/v2/metrics_service_v2_api"
|
233
|
+
#
|
234
|
+
# MetricsServiceV2Api = Google::Cloud::Logging::V2::MetricsServiceV2Api
|
235
|
+
#
|
236
|
+
# metrics_service_v2_api = MetricsServiceV2Api.new
|
237
|
+
# formatted_parent = MetricsServiceV2Api.parent_path("[PROJECT]")
|
238
|
+
#
|
239
|
+
# # Iterate over all results.
|
240
|
+
# metrics_service_v2_api.list_log_metrics(formatted_parent).each do |element|
|
241
|
+
# # Process element.
|
242
|
+
# end
|
243
|
+
#
|
244
|
+
# # Or iterate over results one page at a time.
|
245
|
+
# metrics_service_v2_api.list_log_metrics(formatted_parent).each_page do |page|
|
246
|
+
# # Process each page at a time.
|
247
|
+
# page.each do |element|
|
248
|
+
# # Process element.
|
249
|
+
# end
|
250
|
+
# end
|
251
|
+
|
224
252
|
def list_log_metrics \
|
225
253
|
parent,
|
226
254
|
page_size: nil,
|
@@ -242,6 +270,15 @@ module Google
|
|
242
270
|
# retries, etc.
|
243
271
|
# @return [Google::Logging::V2::LogMetric]
|
244
272
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
273
|
+
# @example
|
274
|
+
# require "google/cloud/logging/v2/metrics_service_v2_api"
|
275
|
+
#
|
276
|
+
# MetricsServiceV2Api = Google::Cloud::Logging::V2::MetricsServiceV2Api
|
277
|
+
#
|
278
|
+
# metrics_service_v2_api = MetricsServiceV2Api.new
|
279
|
+
# formatted_metric_name = MetricsServiceV2Api.metric_path("[PROJECT]", "[METRIC]")
|
280
|
+
# response = metrics_service_v2_api.get_log_metric(formatted_metric_name)
|
281
|
+
|
245
282
|
def get_log_metric \
|
246
283
|
metric_name,
|
247
284
|
options: nil
|
@@ -266,6 +303,17 @@ module Google
|
|
266
303
|
# retries, etc.
|
267
304
|
# @return [Google::Logging::V2::LogMetric]
|
268
305
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
306
|
+
# @example
|
307
|
+
# require "google/cloud/logging/v2/metrics_service_v2_api"
|
308
|
+
#
|
309
|
+
# LogMetric = Google::Logging::V2::LogMetric
|
310
|
+
# MetricsServiceV2Api = Google::Cloud::Logging::V2::MetricsServiceV2Api
|
311
|
+
#
|
312
|
+
# metrics_service_v2_api = MetricsServiceV2Api.new
|
313
|
+
# formatted_parent = MetricsServiceV2Api.parent_path("[PROJECT]")
|
314
|
+
# metric = LogMetric.new
|
315
|
+
# response = metrics_service_v2_api.create_log_metric(formatted_parent, metric)
|
316
|
+
|
269
317
|
def create_log_metric \
|
270
318
|
parent,
|
271
319
|
metric,
|
@@ -295,6 +343,17 @@ module Google
|
|
295
343
|
# retries, etc.
|
296
344
|
# @return [Google::Logging::V2::LogMetric]
|
297
345
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
346
|
+
# @example
|
347
|
+
# require "google/cloud/logging/v2/metrics_service_v2_api"
|
348
|
+
#
|
349
|
+
# LogMetric = Google::Logging::V2::LogMetric
|
350
|
+
# MetricsServiceV2Api = Google::Cloud::Logging::V2::MetricsServiceV2Api
|
351
|
+
#
|
352
|
+
# metrics_service_v2_api = MetricsServiceV2Api.new
|
353
|
+
# formatted_metric_name = MetricsServiceV2Api.metric_path("[PROJECT]", "[METRIC]")
|
354
|
+
# metric = LogMetric.new
|
355
|
+
# response = metrics_service_v2_api.update_log_metric(formatted_metric_name, metric)
|
356
|
+
|
298
357
|
def update_log_metric \
|
299
358
|
metric_name,
|
300
359
|
metric,
|
@@ -315,6 +374,15 @@ module Google
|
|
315
374
|
# Overrides the default settings for this call, e.g, timeout,
|
316
375
|
# retries, etc.
|
317
376
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
377
|
+
# @example
|
378
|
+
# require "google/cloud/logging/v2/metrics_service_v2_api"
|
379
|
+
#
|
380
|
+
# MetricsServiceV2Api = Google::Cloud::Logging::V2::MetricsServiceV2Api
|
381
|
+
#
|
382
|
+
# metrics_service_v2_api = MetricsServiceV2Api.new
|
383
|
+
# formatted_metric_name = MetricsServiceV2Api.metric_path("[PROJECT]", "[METRIC]")
|
384
|
+
# metrics_service_v2_api.delete_log_metric(formatted_metric_name)
|
385
|
+
|
318
386
|
def delete_log_metric \
|
319
387
|
metric_name,
|
320
388
|
options: nil
|
@@ -12,6 +12,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
12
12
|
optional :destination, :string, 3
|
13
13
|
optional :filter, :string, 5
|
14
14
|
optional :output_version_format, :enum, 6, "google.logging.v2.LogSink.VersionFormat"
|
15
|
+
optional :writer_identity, :string, 8
|
15
16
|
end
|
16
17
|
add_enum "google.logging.v2.LogSink.VersionFormat" do
|
17
18
|
value :VERSION_FORMAT_UNSPECIFIED, 0
|
@@ -39,7 +39,7 @@ module Google
|
|
39
39
|
rpc :GetSink, GetSinkRequest, LogSink
|
40
40
|
# Creates a sink.
|
41
41
|
rpc :CreateSink, CreateSinkRequest, LogSink
|
42
|
-
#
|
42
|
+
# Updates or creates a sink.
|
43
43
|
rpc :UpdateSink, UpdateSinkRequest, LogSink
|
44
44
|
# Deletes a sink.
|
45
45
|
rpc :DeleteSink, DeleteSinkRequest, Google::Protobuf::Empty
|
@@ -10,6 +10,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
10
10
|
optional :name, :string, 1
|
11
11
|
optional :description, :string, 2
|
12
12
|
optional :filter, :string, 3
|
13
|
+
optional :version, :enum, 4, "google.logging.v2.LogMetric.ApiVersion"
|
14
|
+
end
|
15
|
+
add_enum "google.logging.v2.LogMetric.ApiVersion" do
|
16
|
+
value :V2, 0
|
17
|
+
value :V1, 1
|
13
18
|
end
|
14
19
|
add_message "google.logging.v2.ListLogMetricsRequest" do
|
15
20
|
optional :parent, :string, 1
|
@@ -40,6 +45,7 @@ module Google
|
|
40
45
|
module Logging
|
41
46
|
module V2
|
42
47
|
LogMetric = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogMetric").msgclass
|
48
|
+
LogMetric::ApiVersion = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogMetric.ApiVersion").enummodule
|
43
49
|
ListLogMetricsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListLogMetricsRequest").msgclass
|
44
50
|
ListLogMetricsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListLogMetricsResponse").msgclass
|
45
51
|
GetLogMetricRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.GetLogMetricRequest").msgclass
|
@@ -25,6 +25,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
25
25
|
end
|
26
26
|
add_message "google.logging.v2.ListLogEntriesRequest" do
|
27
27
|
repeated :project_ids, :string, 1
|
28
|
+
repeated :resource_names, :string, 8
|
28
29
|
optional :filter, :string, 2
|
29
30
|
optional :order_by, :string, 3
|
30
31
|
optional :page_size, :int32, 4
|
@@ -34,16 +34,13 @@ module Google
|
|
34
34
|
|
35
35
|
# Deletes a log and all its log entries.
|
36
36
|
# The log will reappear if it receives new entries.
|
37
|
-
#
|
38
37
|
rpc :DeleteLog, DeleteLogRequest, Google::Protobuf::Empty
|
39
38
|
# Writes log entries to Stackdriver Logging. All log entries are
|
40
39
|
# written by this method.
|
41
|
-
#
|
42
40
|
rpc :WriteLogEntries, WriteLogEntriesRequest, WriteLogEntriesResponse
|
43
41
|
# Lists log entries. Use this method to retrieve log entries from Cloud
|
44
42
|
# Logging. For ways to export log entries, see
|
45
43
|
# [Exporting Logs](/logging/docs/export).
|
46
|
-
#
|
47
44
|
rpc :ListLogEntries, ListLogEntriesRequest, ListLogEntriesResponse
|
48
45
|
# Lists the monitored resource descriptors used by Stackdriver Logging.
|
49
46
|
rpc :ListMonitoredResourceDescriptors, ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse
|
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.21.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-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.21.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.21.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: grpc
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: google-gax
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.6.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.6.0
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: google-protobuf
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,28 +73,28 @@ dependencies:
|
|
59
73
|
requirements:
|
60
74
|
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
76
|
+
version: '1.3'
|
63
77
|
type: :runtime
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version: '1.
|
83
|
+
version: '1.3'
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
85
|
+
name: orderedhash
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
73
87
|
requirements:
|
74
|
-
- -
|
88
|
+
- - '='
|
75
89
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
90
|
+
version: 0.0.6
|
77
91
|
type: :runtime
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
|
-
- -
|
95
|
+
- - '='
|
82
96
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
97
|
+
version: 0.0.6
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: minitest
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,6 +207,62 @@ dependencies:
|
|
193
207
|
- - "~>"
|
194
208
|
- !ruby/object:Gem::Version
|
195
209
|
version: '0.9'
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
name: yard-doctest
|
212
|
+
requirement: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - "~>"
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: 0.1.6
|
217
|
+
type: :development
|
218
|
+
prerelease: false
|
219
|
+
version_requirements: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - "~>"
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: 0.1.6
|
224
|
+
- !ruby/object:Gem::Dependency
|
225
|
+
name: actionpack
|
226
|
+
requirement: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - "~>"
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '4.0'
|
231
|
+
type: :development
|
232
|
+
prerelease: false
|
233
|
+
version_requirements: !ruby/object:Gem::Requirement
|
234
|
+
requirements:
|
235
|
+
- - "~>"
|
236
|
+
- !ruby/object:Gem::Version
|
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
|
+
- !ruby/object:Gem::Dependency
|
253
|
+
name: rack
|
254
|
+
requirement: !ruby/object:Gem::Requirement
|
255
|
+
requirements:
|
256
|
+
- - ">="
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: '0.1'
|
259
|
+
type: :development
|
260
|
+
prerelease: false
|
261
|
+
version_requirements: !ruby/object:Gem::Requirement
|
262
|
+
requirements:
|
263
|
+
- - ">="
|
264
|
+
- !ruby/object:Gem::Version
|
265
|
+
version: '0.1'
|
196
266
|
description: google-cloud-logging is the official library for Stackdriver Logging.
|
197
267
|
email:
|
198
268
|
- mike@blowmage.com
|
@@ -203,6 +273,7 @@ extra_rdoc_files: []
|
|
203
273
|
files:
|
204
274
|
- lib/google-cloud-logging.rb
|
205
275
|
- lib/google/cloud/logging.rb
|
276
|
+
- lib/google/cloud/logging/async_writer.rb
|
206
277
|
- lib/google/cloud/logging/credentials.rb
|
207
278
|
- lib/google/cloud/logging/entry.rb
|
208
279
|
- lib/google/cloud/logging/entry/http_request.rb
|
@@ -211,7 +282,9 @@ files:
|
|
211
282
|
- lib/google/cloud/logging/logger.rb
|
212
283
|
- lib/google/cloud/logging/metric.rb
|
213
284
|
- lib/google/cloud/logging/metric/list.rb
|
285
|
+
- lib/google/cloud/logging/middleware.rb
|
214
286
|
- lib/google/cloud/logging/project.rb
|
287
|
+
- lib/google/cloud/logging/rails.rb
|
215
288
|
- lib/google/cloud/logging/resource.rb
|
216
289
|
- lib/google/cloud/logging/resource_descriptor.rb
|
217
290
|
- lib/google/cloud/logging/resource_descriptor/list.rb
|