google-cloud-error_reporting 0.31.3 → 0.31.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2eb6ccf8aaf40df2e771dba9a082d755f3b790dfe506322a0a0470bb7f7c3b2d
4
- data.tar.gz: 1a2501e0f238dd91f43bb1e5698dcc7d797fdfd5950c3411447bfd77c00cab18
3
+ metadata.gz: b04d4011c2d0cf6a81432db4dbbc4de6dde79a5b97aadaca31e8ca211ba8a1cc
4
+ data.tar.gz: 658a0a43042377d9c6d960774848b90a74d90a0945efd766534d0e2de0c75080
5
5
  SHA512:
6
- metadata.gz: f41bd7899f505f6e646a6fdf26ef0d4222d54276c880f8c29d85e98feccf363dc526d3adad15f149fd03af9eaa7e3247b95f5151c202f60b2879bcebfbfc530f
7
- data.tar.gz: 28944bbf6588ee39f5126d51e03d567f789afaaf60df6c9e3680fc03c4a0215986956e5867c1afba46438a103e937f3d6f35b25ecbd0cf19538c2102050faf55
6
+ metadata.gz: 66a9368231038722509e06c61f5ee0554d9a8170ad4727e91e33d412ac58913c43a9994f744239767eda6e2f7ef3066afb0efc6a38cdfc067caf5bfe4142d557
7
+ data.tar.gz: a912d0edb55a20440ddcfd5a939af78812f0121ee54e38800aa0ee5f2c4b3cd685aed5a6a078e291a1a3c65660b798e828840850ccfd744915986c6bf80bcdd4
data/AUTHENTICATION.md CHANGED
@@ -1,21 +1,40 @@
1
- Error Reporting# Authentication
1
+ # Authentication
2
2
 
3
3
  In general, the google-cloud-error_reporting 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 on Compute Engine
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 variables. Additionally, Cloud
11
- SDK credentials can also be discovered automatically, but this is only
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 ERROR_REPORTING_CREDENTIALS=/path/to/json`
22
+ ```
23
+
24
+ 3. Initialize the client.
25
+
26
+ ```ruby
27
+ require "google/cloud/error_reporting"
28
+
29
+ client = Google::Cloud::ErrorReporting.new
30
+ ```
13
31
 
14
32
  ## Project and Credential Lookup
15
33
 
16
- The google-cloud-error_reporting library aims to make authentication as simple
17
- as possible, and provides several mechanisms to configure your system without
18
- providing **Project ID** and **Service Account Credentials** directly in code.
34
+ The google-cloud-error_reporting 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 Error Reporting checks for project ID are:
96
+ The environment variables that google-cloud-error_reporting checks for project ID are:
77
97
 
78
98
  1. `ERROR_REPORTING_PROJECT`
79
99
  2. `GOOGLE_CLOUD_PROJECT`
80
100
 
81
- The environment variables that Error Reporting checks for credentials are
82
- configured on {Google::Cloud::ErrorReporting::V1beta1::Credentials}:
101
+ The environment variables that google-cloud-error_reporting checks for credentials are configured on {Google::Cloud::ErrorReporting::V1beta1::Credentials}:
83
102
 
84
103
  1. `ERROR_REPORTING_CREDENTIALS` - Path to JSON file, or JSON contents
85
104
  2. `ERROR_REPORTING_KEYFILE` - Path to JSON file, or JSON contents
@@ -93,13 +112,12 @@ require "google/cloud/error_reporting"
93
112
  ENV["ERROR_REPORTING_PROJECT"] = "my-project-id"
94
113
  ENV["ERROR_REPORTING_CREDENTIALS"] = "path/to/keyfile.json"
95
114
 
96
- error_reporting = Google::Cloud::ErrorReporting.new
115
+ client = Google::Cloud::ErrorReporting.new
97
116
  ```
98
117
 
99
118
  ### Configuration
100
119
 
101
- The **Project ID** and **Credentials JSON** can be configured instead of placing
102
- them in environment variables or providing them as arguments.
120
+ The **Project ID** and **Credentials JSON** can be configured instead of placing them in environment variables or providing them as arguments.
103
121
 
104
122
  ```ruby
105
123
  require "google/cloud/error_reporting"
@@ -109,7 +127,7 @@ Google::Cloud::ErrorReporting.configure do |config|
109
127
  config.credentials = "path/to/keyfile.json"
110
128
  end
111
129
 
112
- error_reporting = Google::Cloud::ErrorReporting.new
130
+ client = Google::Cloud::ErrorReporting.new
113
131
  ```
114
132
 
115
133
  ### Cloud SDK
@@ -142,7 +160,8 @@ Google Cloud requires a **Project ID** and **Service Account Credentials** to
142
160
  connect to the APIs. You will use the **Project ID** and **JSON key file** to
143
161
  connect to most services with google-cloud-error_reporting.
144
162
 
145
- If you are not running this client on Google Compute Engine, you need a Google
163
+ If you are not running this client within [Google Cloud Platform
164
+ environments](#google-cloud-platform-environments), you need a Google
146
165
  Developers service account.
147
166
 
148
167
  1. Visit the [Google Developers Console][dev-console].
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Release History
2
2
 
3
+ ### 0.31.4 / 2019-04-29
4
+
5
+ * Add AUTHENTICATION.md guide.
6
+ * Update documentation for common types.
7
+ * Update generated code examples.
8
+ * Extract gRPC header values from request.
9
+
3
10
  ### 0.31.3 / 2019-02-13
4
11
 
5
12
  * Fix bug (typo) in retrieving default on_error proc.
@@ -34,7 +34,7 @@ module Google
34
34
  attr_reader :error_event
35
35
 
36
36
  def initialize message, error_event = nil
37
- super(message)
37
+ super message
38
38
  @error_event = error_event
39
39
  end
40
40
  end
@@ -53,7 +53,7 @@ module Google
53
53
  attr_reader :error_event
54
54
 
55
55
  def initialize message, error_event = nil
56
- super(message)
56
+ super message
57
57
  @error_event = error_event
58
58
  end
59
59
  end
@@ -91,7 +91,7 @@ module Google
91
91
  # Add the error event to the queue. This will raise if there are no
92
92
  # resources available to make the API call.
93
93
  def report error_event
94
- Concurrent::Promises.future_on(@thread_pool, error_event) do |error|
94
+ Concurrent::Promises.future_on @thread_pool, error_event do |error|
95
95
  report_sync error
96
96
  end
97
97
  rescue Concurrent::RejectedExecutionError => e
@@ -220,7 +220,7 @@ module Google
220
220
 
221
221
  message = "#{error_location}: #{message}\n\t" +
222
222
  backtrace.drop(1).join("\n\t")
223
- file_path, line_number, function_name = error_location.split(":")
223
+ file_path, line_number, function_name = error_location.split ":"
224
224
  function_name = function_name.to_s[/`(.*)'/, 1]
225
225
  end
226
226
 
@@ -147,7 +147,7 @@ module Google
147
147
  error_event.http_url = rack_request.url
148
148
  error_event.http_user_agent = rack_request.user_agent
149
149
  error_event.http_referrer = rack_request.referrer
150
- error_event.http_status = http_status(exception)
150
+ error_event.http_status = http_status exception
151
151
  error_event.http_remote_ip = rack_request.ip
152
152
 
153
153
  error_event
@@ -22,8 +22,9 @@ module Google
22
22
  # @return [String]
23
23
  # [Required] The resource name of the Google Cloud Platform project. Written
24
24
  # as `projects/` plus the
25
- # [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
26
- # Example: `projects/my-project-123`.
25
+ # [Google Cloud Platform project
26
+ # ID](https://support.google.com/cloud/answer/6158840). Example:
27
+ # `projects/my-project-123`.
27
28
  # @!attribute [rw] event
28
29
  # @return [Google::Devtools::Clouderrorreporting::V1beta1::ReportedErrorEvent]
29
30
  # [Required] The error event to be reported.
@@ -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
- # or calendar, represented as seconds and fractions of seconds at
20
- # nanosecond resolution in UTC Epoch time. It is encoded using the
21
- # Proleptic Gregorian Calendar which extends the Gregorian calendar
22
- # backwards to year one. It is encoded assuming all minutes are 60
23
- # seconds long, i.e. leap seconds are "smeared" so that no leap second
24
- # table is needed for interpretation. Range is from
25
- # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
26
- # By restricting to that range, we ensure that we can convert to
27
- # and from RFC 3339 date strings.
28
- # See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
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]
@@ -180,12 +180,18 @@ module Google
180
180
  @get_group = Google::Gax.create_api_call(
181
181
  @error_group_service_stub.method(:get_group),
182
182
  defaults["get_group"],
183
- exception_transformer: exception_transformer
183
+ exception_transformer: exception_transformer,
184
+ params_extractor: proc do |request|
185
+ {'group_name' => request.group_name}
186
+ end
184
187
  )
185
188
  @update_group = Google::Gax.create_api_call(
186
189
  @error_group_service_stub.method(:update_group),
187
190
  defaults["update_group"],
188
- exception_transformer: exception_transformer
191
+ exception_transformer: exception_transformer,
192
+ params_extractor: proc do |request|
193
+ {'group.name' => request.group.name}
194
+ end
189
195
  )
190
196
  end
191
197
 
@@ -213,9 +219,9 @@ module Google
213
219
  # @example
214
220
  # require "google/cloud/error_reporting"
215
221
  #
216
- # error_group_service_client = Google::Cloud::ErrorReporting::ErrorGroup.new(version: :v1beta1)
222
+ # error_group_client = Google::Cloud::ErrorReporting::ErrorGroup.new(version: :v1beta1)
217
223
  # formatted_group_name = Google::Cloud::ErrorReporting::V1beta1::ErrorGroupServiceClient.group_path("[PROJECT]", "[GROUP]")
218
- # response = error_group_service_client.get_group(formatted_group_name)
224
+ # response = error_group_client.get_group(formatted_group_name)
219
225
 
220
226
  def get_group \
221
227
  group_name,
@@ -246,11 +252,11 @@ module Google
246
252
  # @example
247
253
  # require "google/cloud/error_reporting"
248
254
  #
249
- # error_group_service_client = Google::Cloud::ErrorReporting::ErrorGroup.new(version: :v1beta1)
255
+ # error_group_client = Google::Cloud::ErrorReporting::ErrorGroup.new(version: :v1beta1)
250
256
  #
251
257
  # # TODO: Initialize `group`:
252
258
  # group = {}
253
- # response = error_group_service_client.update_group(group)
259
+ # response = error_group_client.update_group(group)
254
260
 
255
261
  def update_group \
256
262
  group,
@@ -193,17 +193,26 @@ module Google
193
193
  @list_group_stats = Google::Gax.create_api_call(
194
194
  @error_stats_service_stub.method(:list_group_stats),
195
195
  defaults["list_group_stats"],
196
- exception_transformer: exception_transformer
196
+ exception_transformer: exception_transformer,
197
+ params_extractor: proc do |request|
198
+ {'project_name' => request.project_name}
199
+ end
197
200
  )
198
201
  @list_events = Google::Gax.create_api_call(
199
202
  @error_stats_service_stub.method(:list_events),
200
203
  defaults["list_events"],
201
- exception_transformer: exception_transformer
204
+ exception_transformer: exception_transformer,
205
+ params_extractor: proc do |request|
206
+ {'project_name' => request.project_name}
207
+ end
202
208
  )
203
209
  @delete_events = Google::Gax.create_api_call(
204
210
  @error_stats_service_stub.method(:delete_events),
205
211
  defaults["delete_events"],
206
- exception_transformer: exception_transformer
212
+ exception_transformer: exception_transformer,
213
+ params_extractor: proc do |request|
214
+ {'project_name' => request.project_name}
215
+ end
207
216
  )
208
217
  end
209
218
 
@@ -273,19 +282,19 @@ module Google
273
282
  # @example
274
283
  # require "google/cloud/error_reporting"
275
284
  #
276
- # error_stats_service_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
285
+ # error_stats_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
277
286
  # formatted_project_name = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceClient.project_path("[PROJECT]")
278
287
  #
279
288
  # # TODO: Initialize `time_range`:
280
289
  # time_range = {}
281
290
  #
282
291
  # # Iterate over all results.
283
- # error_stats_service_client.list_group_stats(formatted_project_name, time_range).each do |element|
292
+ # error_stats_client.list_group_stats(formatted_project_name, time_range).each do |element|
284
293
  # # Process element.
285
294
  # end
286
295
  #
287
296
  # # Or iterate over results one page at a time.
288
- # error_stats_service_client.list_group_stats(formatted_project_name, time_range).each_page do |page|
297
+ # error_stats_client.list_group_stats(formatted_project_name, time_range).each_page do |page|
289
298
  # # Process each page at a time.
290
299
  # page.each do |element|
291
300
  # # Process element.
@@ -362,19 +371,19 @@ module Google
362
371
  # @example
363
372
  # require "google/cloud/error_reporting"
364
373
  #
365
- # error_stats_service_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
374
+ # error_stats_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
366
375
  # formatted_project_name = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceClient.project_path("[PROJECT]")
367
376
  #
368
377
  # # TODO: Initialize `group_id`:
369
378
  # group_id = ''
370
379
  #
371
380
  # # Iterate over all results.
372
- # error_stats_service_client.list_events(formatted_project_name, group_id).each do |element|
381
+ # error_stats_client.list_events(formatted_project_name, group_id).each do |element|
373
382
  # # Process element.
374
383
  # end
375
384
  #
376
385
  # # Or iterate over results one page at a time.
377
- # error_stats_service_client.list_events(formatted_project_name, group_id).each_page do |page|
386
+ # error_stats_client.list_events(formatted_project_name, group_id).each_page do |page|
378
387
  # # Process each page at a time.
379
388
  # page.each do |element|
380
389
  # # Process element.
@@ -419,9 +428,9 @@ module Google
419
428
  # @example
420
429
  # require "google/cloud/error_reporting"
421
430
  #
422
- # error_stats_service_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
431
+ # error_stats_client = Google::Cloud::ErrorReporting::ErrorStats.new(version: :v1beta1)
423
432
  # formatted_project_name = Google::Cloud::ErrorReporting::V1beta1::ErrorStatsServiceClient.project_path("[PROJECT]")
424
- # response = error_stats_service_client.delete_events(formatted_project_name)
433
+ # response = error_stats_client.delete_events(formatted_project_name)
425
434
 
426
435
  def delete_events \
427
436
  project_name,
@@ -178,7 +178,10 @@ module Google
178
178
  @report_error_event = Google::Gax.create_api_call(
179
179
  @report_errors_service_stub.method(:report_error_event),
180
180
  defaults["report_error_event"],
181
- exception_transformer: exception_transformer
181
+ exception_transformer: exception_transformer,
182
+ params_extractor: proc do |request|
183
+ {'project_name' => request.project_name}
184
+ end
182
185
  )
183
186
  end
184
187
 
@@ -191,13 +194,15 @@ module Google
191
194
  # <a href="https://support.google.com/cloud/answer/6158862">API key</a>
192
195
  # for authentication. To use an API key, append it to the URL as the value of
193
196
  # a `key` parameter. For example:
194
- # <pre>POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
197
+ # <pre>POST
198
+ # https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
195
199
  #
196
200
  # @param project_name [String]
197
201
  # [Required] The resource name of the Google Cloud Platform project. Written
198
202
  # as `projects/` plus the
199
- # [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).
200
- # Example: `projects/my-project-123`.
203
+ # [Google Cloud Platform project
204
+ # ID](https://support.google.com/cloud/answer/6158840). Example:
205
+ # `projects/my-project-123`.
201
206
  # @param event [Google::Devtools::Clouderrorreporting::V1beta1::ReportedErrorEvent | Hash]
202
207
  # [Required] The error event to be reported.
203
208
  # A hash of the same form as `Google::Devtools::Clouderrorreporting::V1beta1::ReportedErrorEvent`
@@ -213,12 +218,12 @@ module Google
213
218
  # @example
214
219
  # require "google/cloud/error_reporting"
215
220
  #
216
- # report_errors_service_client = Google::Cloud::ErrorReporting::ReportErrors.new(version: :v1beta1)
221
+ # report_errors_client = Google::Cloud::ErrorReporting::ReportErrors.new(version: :v1beta1)
217
222
  # formatted_project_name = Google::Cloud::ErrorReporting::V1beta1::ReportErrorsServiceClient.project_path("[PROJECT]")
218
223
  #
219
224
  # # TODO: Initialize `event`:
220
225
  # event = {}
221
- # response = report_errors_service_client.report_error_event(formatted_project_name, event)
226
+ # response = report_errors_client.report_error_event(formatted_project_name, event)
222
227
 
223
228
  def report_error_event \
224
229
  project_name,
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module ErrorReporting
19
- VERSION = "0.31.3".freeze
19
+ VERSION = "0.31.4".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -41,7 +41,8 @@ module Google
41
41
  # <a href="https://support.google.com/cloud/answer/6158862">API key</a>
42
42
  # for authentication. To use an API key, append it to the URL as the value of
43
43
  # a `key` parameter. For example:
44
- # <pre>POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
44
+ # <pre>POST
45
+ # https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456</pre>
45
46
  rpc :ReportErrorEvent, ReportErrorEventRequest, ReportErrorEventResponse
46
47
  end
47
48
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-error_reporting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.3
4
+ version: 0.31.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.61.0
145
+ version: 0.64.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.61.0
152
+ version: 0.64.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: railties
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -288,8 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  requirements: []
291
- rubyforge_project:
292
- rubygems_version: 2.7.6
291
+ rubygems_version: 3.0.3
293
292
  signing_key:
294
293
  specification_version: 4
295
294
  summary: API Client library for Stackdriver Error Reporting