google-cloud-logging 1.6.2 → 1.6.3
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 +33 -13
- data/CHANGELOG.md +7 -0
- data/lib/google/cloud/logging/async_writer.rb +1 -1
- data/lib/google/cloud/logging/convert.rb +1 -1
- data/lib/google/cloud/logging/entry.rb +3 -3
- data/lib/google/cloud/logging/entry/list.rb +1 -1
- data/lib/google/cloud/logging/errors.rb +2 -2
- data/lib/google/cloud/logging/log/list.rb +2 -2
- data/lib/google/cloud/logging/logger.rb +4 -4
- data/lib/google/cloud/logging/metric/list.rb +1 -1
- data/lib/google/cloud/logging/project.rb +1 -1
- data/lib/google/cloud/logging/resource.rb +1 -1
- data/lib/google/cloud/logging/resource_descriptor/list.rb +1 -1
- data/lib/google/cloud/logging/service.rb +1 -1
- data/lib/google/cloud/logging/sink/list.rb +1 -1
- data/lib/google/cloud/logging/v2/config_service_v2_client.rb +83 -51
- data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +4 -2
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +5 -3
- data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +2 -1
- data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +18 -26
- data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +15 -13
- data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +21 -15
- data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +45 -30
- data/lib/google/cloud/logging/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcbc7c47b6db3fc6f156af9ed6eb545352326b6eef6d526127e1f430f7228f62
|
4
|
+
data.tar.gz: c3edf43f7604b5dc3ce0bacfcb49b8beb289618d394a568462e542ea277beb13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd2ea2da3f2d6dd440f310766413086e28456a13d10e69478c09fd713f5cd28795e5dfdd383dd2d19a3aaa45e771c2d931011a90cbd578ae8e82b15d5161fc53
|
7
|
+
data.tar.gz: 84689a6d0b5d9308465ea074fcfefad1b11146d0c1515bca84ddd632fb53423912273d9302a89d8c4807bcbee7d1de53070a3e5f63b923a8419bcea5c1a72045
|
data/AUTHENTICATION.md
CHANGED
@@ -2,20 +2,39 @@
|
|
2
2
|
|
3
3
|
In general, the google-cloud-logging library uses [Service
|
4
4
|
Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
|
5
|
-
credentials to connect to Google Cloud services. When running
|
5
|
+
credentials to connect to Google Cloud services. When running within [Google
|
6
|
+
Cloud Platform environments](#google-cloud-platform-environments)
|
6
7
|
the credentials will be discovered automatically. When running on other
|
7
8
|
environments, the Service Account credentials can be specified by providing the
|
8
9
|
path to the [JSON
|
9
10
|
keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
|
10
|
-
the account (or the JSON itself) in environment
|
11
|
-
SDK credentials can also
|
12
|
-
recommended during development.
|
11
|
+
the account (or the JSON itself) in [environment
|
12
|
+
variables](#environment-variables). Additionally, Cloud SDK credentials can also
|
13
|
+
be discovered automatically, but this is only recommended during development.
|
14
|
+
|
15
|
+
## Quickstart
|
16
|
+
|
17
|
+
1. [Create a service account and credentials](#creating-a-service-account).
|
18
|
+
2. Set the [environment variable](#environment-variables).
|
19
|
+
|
20
|
+
```sh
|
21
|
+
export LOGGING_CREDENTIALS=/path/to/json`
|
22
|
+
```
|
23
|
+
|
24
|
+
3. Initialize the client.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require "google/cloud/logging"
|
28
|
+
|
29
|
+
client = Google::Cloud::Logging.new
|
30
|
+
```
|
13
31
|
|
14
32
|
## Project and Credential Lookup
|
15
33
|
|
16
|
-
The google-cloud-logging library aims to make authentication
|
17
|
-
possible, and provides several mechanisms to configure your system
|
18
|
-
providing **Project ID** and **Service Account Credentials** directly in
|
34
|
+
The google-cloud-logging library aims to make authentication
|
35
|
+
as simple as possible, and provides several mechanisms to configure your system
|
36
|
+
without providing **Project ID** and **Service Account Credentials** directly in
|
37
|
+
code.
|
19
38
|
|
20
39
|
**Project ID** is discovered in the following order:
|
21
40
|
|
@@ -23,6 +42,7 @@ providing **Project ID** and **Service Account Credentials** directly in code.
|
|
23
42
|
2. Specify project ID in configuration
|
24
43
|
3. Discover project ID in environment variables
|
25
44
|
4. Discover GCE project ID
|
45
|
+
5. Discover project ID in credentials JSON
|
26
46
|
|
27
47
|
**Credentials** are discovered in the following order:
|
28
48
|
|
@@ -73,13 +93,12 @@ environment variable, or the **Credentials JSON** itself can be stored for
|
|
73
93
|
environments such as Docker containers where writing files is difficult or not
|
74
94
|
encouraged.
|
75
95
|
|
76
|
-
The environment variables that
|
96
|
+
The environment variables that google-cloud-logging checks for project ID are:
|
77
97
|
|
78
98
|
1. `LOGGING_PROJECT`
|
79
99
|
2. `GOOGLE_CLOUD_PROJECT`
|
80
100
|
|
81
|
-
The environment variables that
|
82
|
-
{Google::Cloud::Logging::V2::Credentials}:
|
101
|
+
The environment variables that google-cloud-logging checks for credentials are configured on {Google::Cloud::Logging::V2::Credentials}:
|
83
102
|
|
84
103
|
1. `LOGGING_CREDENTIALS` - Path to JSON file, or JSON contents
|
85
104
|
2. `LOGGING_KEYFILE` - Path to JSON file, or JSON contents
|
@@ -93,7 +112,7 @@ require "google/cloud/logging"
|
|
93
112
|
ENV["LOGGING_PROJECT"] = "my-project-id"
|
94
113
|
ENV["LOGGING_CREDENTIALS"] = "path/to/keyfile.json"
|
95
114
|
|
96
|
-
|
115
|
+
client = Google::Cloud::Logging.new
|
97
116
|
```
|
98
117
|
|
99
118
|
### Configuration
|
@@ -108,7 +127,7 @@ Google::Cloud::Logging.configure do |config|
|
|
108
127
|
config.credentials = "path/to/keyfile.json"
|
109
128
|
end
|
110
129
|
|
111
|
-
|
130
|
+
client = Google::Cloud::Logging.new
|
112
131
|
```
|
113
132
|
|
114
133
|
### Cloud SDK
|
@@ -141,7 +160,8 @@ Google Cloud requires a **Project ID** and **Service Account Credentials** to
|
|
141
160
|
connect to the APIs. You will use the **Project ID** and **JSON key file** to
|
142
161
|
connect to most services with google-cloud-logging.
|
143
162
|
|
144
|
-
If you are not running this client
|
163
|
+
If you are not running this client within [Google Cloud Platform
|
164
|
+
environments](#google-cloud-platform-environments), you need a Google
|
145
165
|
Developers service account.
|
146
166
|
|
147
167
|
1. Visit the [Google Developers Console][dev-console].
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.6.3 / 2019-04-29
|
4
|
+
|
5
|
+
* Add AUTHENTICATION.md guide.
|
6
|
+
* Update generated documentation.
|
7
|
+
* Update generated code examples.
|
8
|
+
* Extract gRPC header values from request.
|
9
|
+
|
3
10
|
### 1.6.2 / 2019-02-13
|
4
11
|
|
5
12
|
* Fix bug (typo) in retrieving default on_error proc.
|
@@ -449,11 +449,11 @@ module Google
|
|
449
449
|
return new if grpc.nil?
|
450
450
|
new.tap do |e|
|
451
451
|
e.log_name = grpc.log_name
|
452
|
-
e.timestamp = extract_timestamp
|
452
|
+
e.timestamp = extract_timestamp grpc
|
453
453
|
e.severity = grpc.severity
|
454
454
|
e.insert_id = grpc.insert_id
|
455
|
-
e.labels = Convert.map_to_hash
|
456
|
-
e.payload = extract_payload
|
455
|
+
e.labels = Convert.map_to_hash grpc.labels
|
456
|
+
e.payload = extract_payload grpc
|
457
457
|
e.instance_variable_set :@resource,
|
458
458
|
Resource.from_grpc(grpc.resource)
|
459
459
|
e.instance_variable_set :@http_request,
|
@@ -129,7 +129,7 @@ module Google
|
|
129
129
|
def all request_limit: nil
|
130
130
|
request_limit = request_limit.to_i if request_limit
|
131
131
|
unless block_given?
|
132
|
-
return enum_for
|
132
|
+
return enum_for :all, request_limit: request_limit
|
133
133
|
end
|
134
134
|
results = self
|
135
135
|
loop do
|
@@ -53,7 +53,7 @@ module Google
|
|
53
53
|
attr_reader :entries
|
54
54
|
|
55
55
|
def initialize message, entries = nil
|
56
|
-
super
|
56
|
+
super message
|
57
57
|
@entries = entries if entries
|
58
58
|
end
|
59
59
|
end
|
@@ -92,7 +92,7 @@ module Google
|
|
92
92
|
attr_reader :entries
|
93
93
|
|
94
94
|
def initialize message, entries = nil
|
95
|
-
super
|
95
|
+
super message
|
96
96
|
@entries = entries if entries
|
97
97
|
end
|
98
98
|
end
|
@@ -113,7 +113,7 @@ module Google
|
|
113
113
|
def all request_limit: nil
|
114
114
|
request_limit = request_limit.to_i if request_limit
|
115
115
|
unless block_given?
|
116
|
-
return enum_for
|
116
|
+
return enum_for :all, request_limit: request_limit
|
117
117
|
end
|
118
118
|
results = self
|
119
119
|
loop do
|
@@ -131,7 +131,7 @@ module Google
|
|
131
131
|
# @private New Log::List from a
|
132
132
|
# Google::Logging::V2::ListLogsResponse object.
|
133
133
|
def self.from_grpc grpc_list, service, resource: nil, max: nil
|
134
|
-
logs = new
|
134
|
+
logs = new Array(grpc_list.log_names)
|
135
135
|
token = grpc_list.next_page_token
|
136
136
|
token = nil if token == "".freeze
|
137
137
|
logs.instance_variable_set :@token, token
|
@@ -539,7 +539,7 @@ module Google
|
|
539
539
|
def write_entry severity, message
|
540
540
|
entry = Entry.new.tap do |e|
|
541
541
|
e.timestamp = Time.now
|
542
|
-
e.severity = gcloud_severity
|
542
|
+
e.severity = gcloud_severity severity
|
543
543
|
e.payload = message
|
544
544
|
end
|
545
545
|
|
@@ -572,7 +572,7 @@ module Google
|
|
572
572
|
|
573
573
|
request_env = info && info.env || {}
|
574
574
|
|
575
|
-
compute_labels(request_env).merge
|
575
|
+
compute_labels(request_env).merge merged_labels
|
576
576
|
end
|
577
577
|
|
578
578
|
##
|
@@ -621,8 +621,8 @@ module Google
|
|
621
621
|
# @private Compute individual label value.
|
622
622
|
# Value can be a Proc (function of the request env) or a static value.
|
623
623
|
def compute_label_value request_env, value_or_proc
|
624
|
-
if value_or_proc.respond_to?
|
625
|
-
value_or_proc.call
|
624
|
+
if value_or_proc.respond_to? :call
|
625
|
+
value_or_proc.call request_env
|
626
626
|
else
|
627
627
|
value_or_proc
|
628
628
|
end
|
@@ -126,7 +126,7 @@ module Google
|
|
126
126
|
def all request_limit: nil
|
127
127
|
request_limit = request_limit.to_i if request_limit
|
128
128
|
unless block_given?
|
129
|
-
return enum_for
|
129
|
+
return enum_for :all, request_limit: request_limit
|
130
130
|
end
|
131
131
|
results = self
|
132
132
|
loop do
|
@@ -209,7 +209,7 @@ module Google
|
|
209
209
|
ensure_service!
|
210
210
|
|
211
211
|
e = Entry.new
|
212
|
-
e.log_name = service.log_path
|
212
|
+
e.log_name = service.log_path log_name if log_name
|
213
213
|
e.resource = resource if resource
|
214
214
|
e.timestamp = timestamp if timestamp
|
215
215
|
e.severity = severity if severity
|
@@ -131,7 +131,7 @@ module Google
|
|
131
131
|
def all request_limit: nil
|
132
132
|
request_limit = request_limit.to_i if request_limit
|
133
133
|
unless block_given?
|
134
|
-
return enum_for
|
134
|
+
return enum_for :all, request_limit: request_limit
|
135
135
|
end
|
136
136
|
results = self
|
137
137
|
loop do
|
@@ -101,7 +101,7 @@ module Google
|
|
101
101
|
partial_success: nil
|
102
102
|
# Fix log names so they are the full path
|
103
103
|
entries = Array(entries).each do |entry|
|
104
|
-
entry.log_name = log_path
|
104
|
+
entry.log_name = log_path entry.log_name
|
105
105
|
end
|
106
106
|
resource = resource.to_grpc if resource
|
107
107
|
labels = Hash[labels.map { |k, v| [String(k), String(v)] }] if labels
|
@@ -125,7 +125,7 @@ module Google
|
|
125
125
|
def all request_limit: nil
|
126
126
|
request_limit = request_limit.to_i if request_limit
|
127
127
|
unless block_given?
|
128
|
-
return enum_for
|
128
|
+
return enum_for :all, request_limit: request_limit
|
129
129
|
end
|
130
130
|
results = self
|
131
131
|
loop do
|
@@ -76,6 +76,12 @@ module Google
|
|
76
76
|
].freeze
|
77
77
|
|
78
78
|
|
79
|
+
EXCLUSION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
80
|
+
"projects/{project}/exclusions/{exclusion}"
|
81
|
+
)
|
82
|
+
|
83
|
+
private_constant :EXCLUSION_PATH_TEMPLATE
|
84
|
+
|
79
85
|
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
80
86
|
"projects/{project}"
|
81
87
|
)
|
@@ -88,11 +94,16 @@ module Google
|
|
88
94
|
|
89
95
|
private_constant :SINK_PATH_TEMPLATE
|
90
96
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
97
|
+
# Returns a fully-qualified exclusion resource name string.
|
98
|
+
# @param project [String]
|
99
|
+
# @param exclusion [String]
|
100
|
+
# @return [String]
|
101
|
+
def self.exclusion_path project, exclusion
|
102
|
+
EXCLUSION_PATH_TEMPLATE.render(
|
103
|
+
:"project" => project,
|
104
|
+
:"exclusion" => exclusion
|
105
|
+
)
|
106
|
+
end
|
96
107
|
|
97
108
|
# Returns a fully-qualified project resource name string.
|
98
109
|
# @param project [String]
|
@@ -114,17 +125,6 @@ module Google
|
|
114
125
|
)
|
115
126
|
end
|
116
127
|
|
117
|
-
# Returns a fully-qualified exclusion resource name string.
|
118
|
-
# @param project [String]
|
119
|
-
# @param exclusion [String]
|
120
|
-
# @return [String]
|
121
|
-
def self.exclusion_path project, exclusion
|
122
|
-
EXCLUSION_PATH_TEMPLATE.render(
|
123
|
-
:"project" => project,
|
124
|
-
:"exclusion" => exclusion
|
125
|
-
)
|
126
|
-
end
|
127
|
-
|
128
128
|
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
129
129
|
# Provides the means for authenticating requests made by the client. This parameter can
|
130
130
|
# be many types.
|
@@ -231,52 +231,82 @@ module Google
|
|
231
231
|
@list_sinks = Google::Gax.create_api_call(
|
232
232
|
@config_service_v2_stub.method(:list_sinks),
|
233
233
|
defaults["list_sinks"],
|
234
|
-
exception_transformer: exception_transformer
|
234
|
+
exception_transformer: exception_transformer,
|
235
|
+
params_extractor: proc do |request|
|
236
|
+
{'parent' => request.parent}
|
237
|
+
end
|
235
238
|
)
|
236
239
|
@get_sink = Google::Gax.create_api_call(
|
237
240
|
@config_service_v2_stub.method(:get_sink),
|
238
241
|
defaults["get_sink"],
|
239
|
-
exception_transformer: exception_transformer
|
242
|
+
exception_transformer: exception_transformer,
|
243
|
+
params_extractor: proc do |request|
|
244
|
+
{'sink_name' => request.sink_name}
|
245
|
+
end
|
240
246
|
)
|
241
247
|
@create_sink = Google::Gax.create_api_call(
|
242
248
|
@config_service_v2_stub.method(:create_sink),
|
243
249
|
defaults["create_sink"],
|
244
|
-
exception_transformer: exception_transformer
|
250
|
+
exception_transformer: exception_transformer,
|
251
|
+
params_extractor: proc do |request|
|
252
|
+
{'parent' => request.parent}
|
253
|
+
end
|
245
254
|
)
|
246
255
|
@update_sink = Google::Gax.create_api_call(
|
247
256
|
@config_service_v2_stub.method(:update_sink),
|
248
257
|
defaults["update_sink"],
|
249
|
-
exception_transformer: exception_transformer
|
258
|
+
exception_transformer: exception_transformer,
|
259
|
+
params_extractor: proc do |request|
|
260
|
+
{'sink_name' => request.sink_name}
|
261
|
+
end
|
250
262
|
)
|
251
263
|
@delete_sink = Google::Gax.create_api_call(
|
252
264
|
@config_service_v2_stub.method(:delete_sink),
|
253
265
|
defaults["delete_sink"],
|
254
|
-
exception_transformer: exception_transformer
|
266
|
+
exception_transformer: exception_transformer,
|
267
|
+
params_extractor: proc do |request|
|
268
|
+
{'sink_name' => request.sink_name}
|
269
|
+
end
|
255
270
|
)
|
256
271
|
@list_exclusions = Google::Gax.create_api_call(
|
257
272
|
@config_service_v2_stub.method(:list_exclusions),
|
258
273
|
defaults["list_exclusions"],
|
259
|
-
exception_transformer: exception_transformer
|
274
|
+
exception_transformer: exception_transformer,
|
275
|
+
params_extractor: proc do |request|
|
276
|
+
{'parent' => request.parent}
|
277
|
+
end
|
260
278
|
)
|
261
279
|
@get_exclusion = Google::Gax.create_api_call(
|
262
280
|
@config_service_v2_stub.method(:get_exclusion),
|
263
281
|
defaults["get_exclusion"],
|
264
|
-
exception_transformer: exception_transformer
|
282
|
+
exception_transformer: exception_transformer,
|
283
|
+
params_extractor: proc do |request|
|
284
|
+
{'name' => request.name}
|
285
|
+
end
|
265
286
|
)
|
266
287
|
@create_exclusion = Google::Gax.create_api_call(
|
267
288
|
@config_service_v2_stub.method(:create_exclusion),
|
268
289
|
defaults["create_exclusion"],
|
269
|
-
exception_transformer: exception_transformer
|
290
|
+
exception_transformer: exception_transformer,
|
291
|
+
params_extractor: proc do |request|
|
292
|
+
{'parent' => request.parent}
|
293
|
+
end
|
270
294
|
)
|
271
295
|
@update_exclusion = Google::Gax.create_api_call(
|
272
296
|
@config_service_v2_stub.method(:update_exclusion),
|
273
297
|
defaults["update_exclusion"],
|
274
|
-
exception_transformer: exception_transformer
|
298
|
+
exception_transformer: exception_transformer,
|
299
|
+
params_extractor: proc do |request|
|
300
|
+
{'name' => request.name}
|
301
|
+
end
|
275
302
|
)
|
276
303
|
@delete_exclusion = Google::Gax.create_api_call(
|
277
304
|
@config_service_v2_stub.method(:delete_exclusion),
|
278
305
|
defaults["delete_exclusion"],
|
279
|
-
exception_transformer: exception_transformer
|
306
|
+
exception_transformer: exception_transformer,
|
307
|
+
params_extractor: proc do |request|
|
308
|
+
{'name' => request.name}
|
309
|
+
end
|
280
310
|
)
|
281
311
|
end
|
282
312
|
|
@@ -312,16 +342,16 @@ module Google
|
|
312
342
|
# @example
|
313
343
|
# require "google/cloud/logging/v2"
|
314
344
|
#
|
315
|
-
#
|
345
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
316
346
|
# formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
|
317
347
|
#
|
318
348
|
# # Iterate over all results.
|
319
|
-
#
|
349
|
+
# config_client.list_sinks(formatted_parent).each do |element|
|
320
350
|
# # Process element.
|
321
351
|
# end
|
322
352
|
#
|
323
353
|
# # Or iterate over results one page at a time.
|
324
|
-
#
|
354
|
+
# config_client.list_sinks(formatted_parent).each_page do |page|
|
325
355
|
# # Process each page at a time.
|
326
356
|
# page.each do |element|
|
327
357
|
# # Process element.
|
@@ -363,9 +393,9 @@ module Google
|
|
363
393
|
# @example
|
364
394
|
# require "google/cloud/logging/v2"
|
365
395
|
#
|
366
|
-
#
|
396
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
367
397
|
# formatted_sink_name = Google::Cloud::Logging::V2::ConfigServiceV2Client.sink_path("[PROJECT]", "[SINK]")
|
368
|
-
# response =
|
398
|
+
# response = config_client.get_sink(formatted_sink_name)
|
369
399
|
|
370
400
|
def get_sink \
|
371
401
|
sink_name,
|
@@ -408,7 +438,8 @@ module Google
|
|
408
438
|
# If this field is set to true, or if the sink is owned by a non-project
|
409
439
|
# resource such as an organization, then the value of `writer_identity` will
|
410
440
|
# be a unique service account used only for exports from the new sink. For
|
411
|
-
# more information, see `writer_identity` in
|
441
|
+
# more information, see `writer_identity` in
|
442
|
+
# {Google::Logging::V2::LogSink LogSink}.
|
412
443
|
# @param options [Google::Gax::CallOptions]
|
413
444
|
# Overrides the default settings for this call, e.g, timeout,
|
414
445
|
# retries, etc.
|
@@ -420,12 +451,12 @@ module Google
|
|
420
451
|
# @example
|
421
452
|
# require "google/cloud/logging/v2"
|
422
453
|
#
|
423
|
-
#
|
454
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
424
455
|
# formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
|
425
456
|
#
|
426
457
|
# # TODO: Initialize `sink`:
|
427
458
|
# sink = {}
|
428
|
-
# response =
|
459
|
+
# response = config_client.create_sink(formatted_parent, sink)
|
429
460
|
|
430
461
|
def create_sink \
|
431
462
|
parent,
|
@@ -503,12 +534,12 @@ module Google
|
|
503
534
|
# @example
|
504
535
|
# require "google/cloud/logging/v2"
|
505
536
|
#
|
506
|
-
#
|
537
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
507
538
|
# formatted_sink_name = Google::Cloud::Logging::V2::ConfigServiceV2Client.sink_path("[PROJECT]", "[SINK]")
|
508
539
|
#
|
509
540
|
# # TODO: Initialize `sink`:
|
510
541
|
# sink = {}
|
511
|
-
# response =
|
542
|
+
# response = config_client.update_sink(formatted_sink_name, sink)
|
512
543
|
|
513
544
|
def update_sink \
|
514
545
|
sink_name,
|
@@ -550,9 +581,9 @@ module Google
|
|
550
581
|
# @example
|
551
582
|
# require "google/cloud/logging/v2"
|
552
583
|
#
|
553
|
-
#
|
584
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
554
585
|
# formatted_sink_name = Google::Cloud::Logging::V2::ConfigServiceV2Client.sink_path("[PROJECT]", "[SINK]")
|
555
|
-
#
|
586
|
+
# config_client.delete_sink(formatted_sink_name)
|
556
587
|
|
557
588
|
def delete_sink \
|
558
589
|
sink_name,
|
@@ -596,16 +627,16 @@ module Google
|
|
596
627
|
# @example
|
597
628
|
# require "google/cloud/logging/v2"
|
598
629
|
#
|
599
|
-
#
|
630
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
600
631
|
# formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
|
601
632
|
#
|
602
633
|
# # Iterate over all results.
|
603
|
-
#
|
634
|
+
# config_client.list_exclusions(formatted_parent).each do |element|
|
604
635
|
# # Process element.
|
605
636
|
# end
|
606
637
|
#
|
607
638
|
# # Or iterate over results one page at a time.
|
608
|
-
#
|
639
|
+
# config_client.list_exclusions(formatted_parent).each_page do |page|
|
609
640
|
# # Process each page at a time.
|
610
641
|
# page.each do |element|
|
611
642
|
# # Process element.
|
@@ -647,9 +678,9 @@ module Google
|
|
647
678
|
# @example
|
648
679
|
# require "google/cloud/logging/v2"
|
649
680
|
#
|
650
|
-
#
|
681
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
651
682
|
# formatted_name = Google::Cloud::Logging::V2::ConfigServiceV2Client.exclusion_path("[PROJECT]", "[EXCLUSION]")
|
652
|
-
# response =
|
683
|
+
# response = config_client.get_exclusion(formatted_name)
|
653
684
|
|
654
685
|
def get_exclusion \
|
655
686
|
name,
|
@@ -691,12 +722,12 @@ module Google
|
|
691
722
|
# @example
|
692
723
|
# require "google/cloud/logging/v2"
|
693
724
|
#
|
694
|
-
#
|
725
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
695
726
|
# formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
|
696
727
|
#
|
697
728
|
# # TODO: Initialize `exclusion`:
|
698
729
|
# exclusion = {}
|
699
|
-
# response =
|
730
|
+
# response = config_client.create_exclusion(formatted_parent, exclusion)
|
700
731
|
|
701
732
|
def create_exclusion \
|
702
733
|
parent,
|
@@ -730,8 +761,9 @@ module Google
|
|
730
761
|
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
731
762
|
# Required. A nonempty list of fields to change in the existing exclusion.
|
732
763
|
# New values for the fields are taken from the corresponding fields in the
|
733
|
-
# {Google::Logging::V2::LogExclusion LogExclusion} included in this request.
|
734
|
-
# `update_mask` are not changed and are ignored in
|
764
|
+
# {Google::Logging::V2::LogExclusion LogExclusion} included in this request.
|
765
|
+
# Fields not mentioned in `update_mask` are not changed and are ignored in
|
766
|
+
# the request.
|
735
767
|
#
|
736
768
|
# For example, to change the filter and description of an exclusion,
|
737
769
|
# specify an `update_mask` of `"filter,description"`.
|
@@ -748,7 +780,7 @@ module Google
|
|
748
780
|
# @example
|
749
781
|
# require "google/cloud/logging/v2"
|
750
782
|
#
|
751
|
-
#
|
783
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
752
784
|
# formatted_name = Google::Cloud::Logging::V2::ConfigServiceV2Client.exclusion_path("[PROJECT]", "[EXCLUSION]")
|
753
785
|
#
|
754
786
|
# # TODO: Initialize `exclusion`:
|
@@ -756,7 +788,7 @@ module Google
|
|
756
788
|
#
|
757
789
|
# # TODO: Initialize `update_mask`:
|
758
790
|
# update_mask = {}
|
759
|
-
# response =
|
791
|
+
# response = config_client.update_exclusion(formatted_name, exclusion, update_mask)
|
760
792
|
|
761
793
|
def update_exclusion \
|
762
794
|
name,
|
@@ -794,9 +826,9 @@ module Google
|
|
794
826
|
# @example
|
795
827
|
# require "google/cloud/logging/v2"
|
796
828
|
#
|
797
|
-
#
|
829
|
+
# config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
|
798
830
|
# formatted_name = Google::Cloud::Logging::V2::ConfigServiceV2Client.exclusion_path("[PROJECT]", "[EXCLUSION]")
|
799
|
-
#
|
831
|
+
# config_client.delete_exclusion(formatted_name)
|
800
832
|
|
801
833
|
def delete_exclusion \
|
802
834
|
name,
|
@@ -42,7 +42,8 @@ module Google
|
|
42
42
|
# @!attribute [rw] user_agent
|
43
43
|
# @return [String]
|
44
44
|
# The user agent sent by the client. Example:
|
45
|
-
# `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
|
45
|
+
# `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET
|
46
|
+
# CLR 1.0.3705)"`.
|
46
47
|
# @!attribute [rw] remote_ip
|
47
48
|
# @return [String]
|
48
49
|
# The IP address (IPv4 or IPv6) of the client that issued the HTTP
|
@@ -54,7 +55,8 @@ module Google
|
|
54
55
|
# @!attribute [rw] referer
|
55
56
|
# @return [String]
|
56
57
|
# The referer URL of the request, as defined in
|
57
|
-
# [HTTP/1.1 Header Field
|
58
|
+
# [HTTP/1.1 Header Field
|
59
|
+
# Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
|
58
60
|
# @!attribute [rw] latency
|
59
61
|
# @return [Google::Protobuf::Duration]
|
60
62
|
# The request processing latency on the server, from the time the request was
|
@@ -178,7 +178,8 @@ module Google
|
|
178
178
|
# If this field is set to true, or if the sink is owned by a non-project
|
179
179
|
# resource such as an organization, then the value of `writer_identity` will
|
180
180
|
# be a unique service account used only for exports from the new sink. For
|
181
|
-
# more information, see `writer_identity` in
|
181
|
+
# more information, see `writer_identity` in
|
182
|
+
# {Google::Logging::V2::LogSink LogSink}.
|
182
183
|
class CreateSinkRequest; end
|
183
184
|
|
184
185
|
# The parameters to `UpdateSink`.
|
@@ -358,8 +359,9 @@ module Google
|
|
358
359
|
# @return [Google::Protobuf::FieldMask]
|
359
360
|
# Required. A nonempty list of fields to change in the existing exclusion.
|
360
361
|
# New values for the fields are taken from the corresponding fields in the
|
361
|
-
# {Google::Logging::V2::LogExclusion LogExclusion} included in this request.
|
362
|
-
# `update_mask` are not changed and are ignored in
|
362
|
+
# {Google::Logging::V2::LogExclusion LogExclusion} included in this request.
|
363
|
+
# Fields not mentioned in `update_mask` are not changed and are ignored in
|
364
|
+
# the request.
|
363
365
|
#
|
364
366
|
# For example, to change the filter and description of an exclusion,
|
365
367
|
# specify an `update_mask` of `"filter,description"`.
|
@@ -97,7 +97,8 @@ module Google
|
|
97
97
|
# @!attribute [rw] type_url
|
98
98
|
# @return [String]
|
99
99
|
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message.
|
100
|
+
# protocol buffer message. This string must contain at least
|
101
|
+
# one "/" character. The last segment of the URL's path must represent
|
101
102
|
# the fully qualified name of the type (as in
|
102
103
|
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
103
104
|
# (e.g., leading "." is not accepted).
|
@@ -83,57 +83,49 @@ module Google
|
|
83
83
|
# describe the updated values, the API ignores the values of all
|
84
84
|
# fields not covered by the mask.
|
85
85
|
#
|
86
|
-
# If a repeated field is specified for an update operation,
|
87
|
-
#
|
88
|
-
#
|
89
|
-
# string.
|
86
|
+
# If a repeated field is specified for an update operation, new values will
|
87
|
+
# be appended to the existing repeated field in the target resource. Note that
|
88
|
+
# a repeated field is only allowed in the last position of a `paths` string.
|
90
89
|
#
|
91
90
|
# If a sub-message is specified in the last position of the field mask for an
|
92
|
-
# update operation, then the existing sub-message
|
93
|
-
#
|
91
|
+
# update operation, then new value will be merged into the existing sub-message
|
92
|
+
# in the target resource.
|
93
|
+
#
|
94
|
+
# For example, given the target message:
|
94
95
|
#
|
95
96
|
# f {
|
96
97
|
# b {
|
97
|
-
# d
|
98
|
-
# x
|
98
|
+
# d: 1
|
99
|
+
# x: 2
|
99
100
|
# }
|
100
|
-
# c
|
101
|
+
# c: [1]
|
101
102
|
# }
|
102
103
|
#
|
103
104
|
# And an update message:
|
104
105
|
#
|
105
106
|
# f {
|
106
107
|
# b {
|
107
|
-
# d
|
108
|
+
# d: 10
|
108
109
|
# }
|
110
|
+
# c: [2]
|
109
111
|
# }
|
110
112
|
#
|
111
113
|
# then if the field mask is:
|
112
114
|
#
|
113
|
-
# paths: "f.b"
|
115
|
+
# paths: ["f.b", "f.c"]
|
114
116
|
#
|
115
117
|
# then the result will be:
|
116
118
|
#
|
117
119
|
# f {
|
118
120
|
# b {
|
119
|
-
# d
|
121
|
+
# d: 10
|
122
|
+
# x: 2
|
120
123
|
# }
|
121
|
-
# c
|
124
|
+
# c: [1, 2]
|
122
125
|
# }
|
123
126
|
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# paths: "f.b.d"
|
127
|
-
#
|
128
|
-
# then the result would be:
|
129
|
-
#
|
130
|
-
# f {
|
131
|
-
# b {
|
132
|
-
# d : 10
|
133
|
-
# x : 2
|
134
|
-
# }
|
135
|
-
# c : 1
|
136
|
-
# }
|
127
|
+
# An implementation may provide options to override this default behavior for
|
128
|
+
# repeated and message fields.
|
137
129
|
#
|
138
130
|
# In order to reset a field's value to the default, the field must
|
139
131
|
# be in the mask and set to the default value in the provided resource.
|
@@ -15,17 +15,19 @@
|
|
15
15
|
|
16
16
|
module Google
|
17
17
|
module Protobuf
|
18
|
-
# A Timestamp represents a point in time independent of any time zone
|
19
|
-
#
|
20
|
-
# nanosecond resolution
|
21
|
-
#
|
22
|
-
# backwards to year one.
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
18
|
+
# A Timestamp represents a point in time independent of any time zone or local
|
19
|
+
# calendar, encoded as a count of seconds and fractions of seconds at
|
20
|
+
# nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
21
|
+
# January 1, 1970, in the proleptic Gregorian calendar which extends the
|
22
|
+
# Gregorian calendar backwards to year one.
|
23
|
+
#
|
24
|
+
# All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
25
|
+
# second table is needed for interpretation, using a [24-hour linear
|
26
|
+
# smear](https://developers.google.com/time/smear).
|
27
|
+
#
|
28
|
+
# The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
29
|
+
# restricting to that range, we ensure that we can convert to and from [RFC
|
30
|
+
# 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
29
31
|
#
|
30
32
|
# = Examples
|
31
33
|
#
|
@@ -86,12 +88,12 @@ module Google
|
|
86
88
|
# 01:30 UTC on January 15, 2017.
|
87
89
|
#
|
88
90
|
# In JavaScript, one can convert a Date object to this format using the
|
89
|
-
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
|
91
|
+
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
90
92
|
# method. In Python, a standard `datetime.datetime` object can be converted
|
91
93
|
# to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
92
94
|
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
93
95
|
# can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
94
|
-
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime
|
96
|
+
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
95
97
|
# ) to obtain a formatter capable of generating timestamps in this format.
|
96
98
|
# @!attribute [rw] seconds
|
97
99
|
# @return [Integer]
|
@@ -230,7 +230,10 @@ module Google
|
|
230
230
|
@delete_log = Google::Gax.create_api_call(
|
231
231
|
@logging_service_v2_stub.method(:delete_log),
|
232
232
|
defaults["delete_log"],
|
233
|
-
exception_transformer: exception_transformer
|
233
|
+
exception_transformer: exception_transformer,
|
234
|
+
params_extractor: proc do |request|
|
235
|
+
{'log_name' => request.log_name}
|
236
|
+
end
|
234
237
|
)
|
235
238
|
@write_log_entries = Google::Gax.create_api_call(
|
236
239
|
@logging_service_v2_stub.method(:write_log_entries),
|
@@ -250,7 +253,10 @@ module Google
|
|
250
253
|
@list_logs = Google::Gax.create_api_call(
|
251
254
|
@logging_service_v2_stub.method(:list_logs),
|
252
255
|
defaults["list_logs"],
|
253
|
-
exception_transformer: exception_transformer
|
256
|
+
exception_transformer: exception_transformer,
|
257
|
+
params_extractor: proc do |request|
|
258
|
+
{'parent' => request.parent}
|
259
|
+
end
|
254
260
|
)
|
255
261
|
end
|
256
262
|
|
@@ -284,9 +290,9 @@ module Google
|
|
284
290
|
# @example
|
285
291
|
# require "google/cloud/logging/v2"
|
286
292
|
#
|
287
|
-
#
|
293
|
+
# logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
288
294
|
# formatted_log_name = Google::Cloud::Logging::V2::LoggingServiceV2Client.log_path("[PROJECT]", "[LOG]")
|
289
|
-
#
|
295
|
+
# logging_client.delete_log(formatted_log_name)
|
290
296
|
|
291
297
|
def delete_log \
|
292
298
|
log_name,
|
@@ -389,11 +395,11 @@ module Google
|
|
389
395
|
# @example
|
390
396
|
# require "google/cloud/logging/v2"
|
391
397
|
#
|
392
|
-
#
|
398
|
+
# logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
393
399
|
#
|
394
400
|
# # TODO: Initialize `entries`:
|
395
401
|
# entries = []
|
396
|
-
# response =
|
402
|
+
# response = logging_client.write_log_entries(entries)
|
397
403
|
|
398
404
|
def write_log_entries \
|
399
405
|
entries,
|
@@ -472,18 +478,18 @@ module Google
|
|
472
478
|
# @example
|
473
479
|
# require "google/cloud/logging/v2"
|
474
480
|
#
|
475
|
-
#
|
481
|
+
# logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
476
482
|
#
|
477
483
|
# # TODO: Initialize `formatted_resource_names`:
|
478
484
|
# formatted_resource_names = []
|
479
485
|
#
|
480
486
|
# # Iterate over all results.
|
481
|
-
#
|
487
|
+
# logging_client.list_log_entries(formatted_resource_names).each do |element|
|
482
488
|
# # Process element.
|
483
489
|
# end
|
484
490
|
#
|
485
491
|
# # Or iterate over results one page at a time.
|
486
|
-
#
|
492
|
+
# logging_client.list_log_entries(formatted_resource_names).each_page do |page|
|
487
493
|
# # Process each page at a time.
|
488
494
|
# page.each do |element|
|
489
495
|
# # Process element.
|
@@ -532,15 +538,15 @@ module Google
|
|
532
538
|
# @example
|
533
539
|
# require "google/cloud/logging/v2"
|
534
540
|
#
|
535
|
-
#
|
541
|
+
# logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
536
542
|
#
|
537
543
|
# # Iterate over all results.
|
538
|
-
#
|
544
|
+
# logging_client.list_monitored_resource_descriptors.each do |element|
|
539
545
|
# # Process element.
|
540
546
|
# end
|
541
547
|
#
|
542
548
|
# # Or iterate over results one page at a time.
|
543
|
-
#
|
549
|
+
# logging_client.list_monitored_resource_descriptors.each_page do |page|
|
544
550
|
# # Process each page at a time.
|
545
551
|
# page.each do |element|
|
546
552
|
# # Process element.
|
@@ -589,16 +595,16 @@ module Google
|
|
589
595
|
# @example
|
590
596
|
# require "google/cloud/logging/v2"
|
591
597
|
#
|
592
|
-
#
|
598
|
+
# logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
593
599
|
# formatted_parent = Google::Cloud::Logging::V2::LoggingServiceV2Client.project_path("[PROJECT]")
|
594
600
|
#
|
595
601
|
# # Iterate over all results.
|
596
|
-
#
|
602
|
+
# logging_client.list_logs(formatted_parent).each do |element|
|
597
603
|
# # Process element.
|
598
604
|
# end
|
599
605
|
#
|
600
606
|
# # Or iterate over results one page at a time.
|
601
|
-
#
|
607
|
+
# logging_client.list_logs(formatted_parent).each_page do |page|
|
602
608
|
# # Process each page at a time.
|
603
609
|
# page.each do |element|
|
604
610
|
# # Process element.
|
@@ -71,26 +71,17 @@ module Google
|
|
71
71
|
].freeze
|
72
72
|
|
73
73
|
|
74
|
-
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
75
|
-
"projects/{project}"
|
76
|
-
)
|
77
|
-
|
78
|
-
private_constant :PROJECT_PATH_TEMPLATE
|
79
|
-
|
80
74
|
METRIC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
81
75
|
"projects/{project}/metrics/{metric}"
|
82
76
|
)
|
83
77
|
|
84
78
|
private_constant :METRIC_PATH_TEMPLATE
|
85
79
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
:"project" => project
|
92
|
-
)
|
93
|
-
end
|
80
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
81
|
+
"projects/{project}"
|
82
|
+
)
|
83
|
+
|
84
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
94
85
|
|
95
86
|
# Returns a fully-qualified metric resource name string.
|
96
87
|
# @param project [String]
|
@@ -103,6 +94,15 @@ module Google
|
|
103
94
|
)
|
104
95
|
end
|
105
96
|
|
97
|
+
# Returns a fully-qualified project resource name string.
|
98
|
+
# @param project [String]
|
99
|
+
# @return [String]
|
100
|
+
def self.project_path project
|
101
|
+
PROJECT_PATH_TEMPLATE.render(
|
102
|
+
:"project" => project
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
106
|
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
107
107
|
# Provides the means for authenticating requests made by the client. This parameter can
|
108
108
|
# be many types.
|
@@ -209,27 +209,42 @@ module Google
|
|
209
209
|
@list_log_metrics = Google::Gax.create_api_call(
|
210
210
|
@metrics_service_v2_stub.method(:list_log_metrics),
|
211
211
|
defaults["list_log_metrics"],
|
212
|
-
exception_transformer: exception_transformer
|
212
|
+
exception_transformer: exception_transformer,
|
213
|
+
params_extractor: proc do |request|
|
214
|
+
{'parent' => request.parent}
|
215
|
+
end
|
213
216
|
)
|
214
217
|
@get_log_metric = Google::Gax.create_api_call(
|
215
218
|
@metrics_service_v2_stub.method(:get_log_metric),
|
216
219
|
defaults["get_log_metric"],
|
217
|
-
exception_transformer: exception_transformer
|
220
|
+
exception_transformer: exception_transformer,
|
221
|
+
params_extractor: proc do |request|
|
222
|
+
{'metric_name' => request.metric_name}
|
223
|
+
end
|
218
224
|
)
|
219
225
|
@create_log_metric = Google::Gax.create_api_call(
|
220
226
|
@metrics_service_v2_stub.method(:create_log_metric),
|
221
227
|
defaults["create_log_metric"],
|
222
|
-
exception_transformer: exception_transformer
|
228
|
+
exception_transformer: exception_transformer,
|
229
|
+
params_extractor: proc do |request|
|
230
|
+
{'parent' => request.parent}
|
231
|
+
end
|
223
232
|
)
|
224
233
|
@update_log_metric = Google::Gax.create_api_call(
|
225
234
|
@metrics_service_v2_stub.method(:update_log_metric),
|
226
235
|
defaults["update_log_metric"],
|
227
|
-
exception_transformer: exception_transformer
|
236
|
+
exception_transformer: exception_transformer,
|
237
|
+
params_extractor: proc do |request|
|
238
|
+
{'metric_name' => request.metric_name}
|
239
|
+
end
|
228
240
|
)
|
229
241
|
@delete_log_metric = Google::Gax.create_api_call(
|
230
242
|
@metrics_service_v2_stub.method(:delete_log_metric),
|
231
243
|
defaults["delete_log_metric"],
|
232
|
-
exception_transformer: exception_transformer
|
244
|
+
exception_transformer: exception_transformer,
|
245
|
+
params_extractor: proc do |request|
|
246
|
+
{'metric_name' => request.metric_name}
|
247
|
+
end
|
233
248
|
)
|
234
249
|
end
|
235
250
|
|
@@ -262,16 +277,16 @@ module Google
|
|
262
277
|
# @example
|
263
278
|
# require "google/cloud/logging/v2"
|
264
279
|
#
|
265
|
-
#
|
280
|
+
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
266
281
|
# formatted_parent = Google::Cloud::Logging::V2::MetricsServiceV2Client.project_path("[PROJECT]")
|
267
282
|
#
|
268
283
|
# # Iterate over all results.
|
269
|
-
#
|
284
|
+
# metrics_client.list_log_metrics(formatted_parent).each do |element|
|
270
285
|
# # Process element.
|
271
286
|
# end
|
272
287
|
#
|
273
288
|
# # Or iterate over results one page at a time.
|
274
|
-
#
|
289
|
+
# metrics_client.list_log_metrics(formatted_parent).each_page do |page|
|
275
290
|
# # Process each page at a time.
|
276
291
|
# page.each do |element|
|
277
292
|
# # Process element.
|
@@ -308,9 +323,9 @@ module Google
|
|
308
323
|
# @example
|
309
324
|
# require "google/cloud/logging/v2"
|
310
325
|
#
|
311
|
-
#
|
326
|
+
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
312
327
|
# formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
|
313
|
-
# response =
|
328
|
+
# response = metrics_client.get_log_metric(formatted_metric_name)
|
314
329
|
|
315
330
|
def get_log_metric \
|
316
331
|
metric_name,
|
@@ -347,12 +362,12 @@ module Google
|
|
347
362
|
# @example
|
348
363
|
# require "google/cloud/logging/v2"
|
349
364
|
#
|
350
|
-
#
|
365
|
+
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
351
366
|
# formatted_parent = Google::Cloud::Logging::V2::MetricsServiceV2Client.project_path("[PROJECT]")
|
352
367
|
#
|
353
368
|
# # TODO: Initialize `metric`:
|
354
369
|
# metric = {}
|
355
|
-
# response =
|
370
|
+
# response = metrics_client.create_log_metric(formatted_parent, metric)
|
356
371
|
|
357
372
|
def create_log_metric \
|
358
373
|
parent,
|
@@ -392,12 +407,12 @@ module Google
|
|
392
407
|
# @example
|
393
408
|
# require "google/cloud/logging/v2"
|
394
409
|
#
|
395
|
-
#
|
410
|
+
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
396
411
|
# formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
|
397
412
|
#
|
398
413
|
# # TODO: Initialize `metric`:
|
399
414
|
# metric = {}
|
400
|
-
# response =
|
415
|
+
# response = metrics_client.update_log_metric(formatted_metric_name, metric)
|
401
416
|
|
402
417
|
def update_log_metric \
|
403
418
|
metric_name,
|
@@ -428,9 +443,9 @@ module Google
|
|
428
443
|
# @example
|
429
444
|
# require "google/cloud/logging/v2"
|
430
445
|
#
|
431
|
-
#
|
446
|
+
# metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
|
432
447
|
# formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
|
433
|
-
#
|
448
|
+
# metrics_client.delete_log_metric(formatted_metric_name)
|
434
449
|
|
435
450
|
def delete_log_metric \
|
436
451
|
metric_name,
|
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: 1.6.
|
4
|
+
version: 1.6.3
|
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: 2019-
|
12
|
+
date: 2019-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -171,14 +171,14 @@ dependencies:
|
|
171
171
|
requirements:
|
172
172
|
- - "~>"
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version: 0.
|
174
|
+
version: 0.64.0
|
175
175
|
type: :development
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
179
|
- - "~>"
|
180
180
|
- !ruby/object:Gem::Version
|
181
|
-
version: 0.
|
181
|
+
version: 0.64.0
|
182
182
|
- !ruby/object:Gem::Dependency
|
183
183
|
name: simplecov
|
184
184
|
requirement: !ruby/object:Gem::Requirement
|
@@ -341,8 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
341
|
- !ruby/object:Gem::Version
|
342
342
|
version: '0'
|
343
343
|
requirements: []
|
344
|
-
|
345
|
-
rubygems_version: 2.7.6
|
344
|
+
rubygems_version: 3.0.3
|
346
345
|
signing_key:
|
347
346
|
specification_version: 4
|
348
347
|
summary: API Client library for Stackdriver Logging
|