google-cloud-error_reporting 0.35.0 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +47 -0
- data/CONTRIBUTING.md +2 -2
- data/LOGGING.md +1 -1
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google-cloud-error_reporting.rb +8 -14
- data/lib/google/cloud/error_reporting.rb +16 -13
- data/lib/google/cloud/error_reporting/async_error_reporter.rb +2 -2
- data/lib/google/cloud/error_reporting/credentials.rb +2 -2
- data/lib/google/cloud/error_reporting/error_event.rb +14 -18
- data/lib/google/cloud/error_reporting/middleware.rb +5 -5
- data/lib/google/cloud/error_reporting/rails.rb +2 -2
- data/lib/google/cloud/error_reporting/service.rb +15 -36
- data/lib/google/cloud/error_reporting/version.rb +1 -1
- metadata +13 -74
- data/lib/google/cloud/error_reporting/v1beta1.rb +0 -19
- data/lib/google/cloud/error_reporting/v1beta1/credentials.rb +0 -41
- data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/common.rb +0 -158
- data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/error_group_service.rb +0 -41
- data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/error_stats_service.rb +0 -314
- data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/report_errors_service.rb +0 -79
- data/lib/google/cloud/error_reporting/v1beta1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/error_reporting/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/error_reporting/v1beta1/error_group_service_client.rb +0 -285
- data/lib/google/cloud/error_reporting/v1beta1/error_group_service_client_config.json +0 -36
- data/lib/google/cloud/error_reporting/v1beta1/error_stats_service_client.rb +0 -457
- data/lib/google/cloud/error_reporting/v1beta1/error_stats_service_client_config.json +0 -41
- data/lib/google/cloud/error_reporting/v1beta1/report_errors_service_client.rb +0 -254
- data/lib/google/cloud/error_reporting/v1beta1/report_errors_service_client_config.json +0 -31
- data/lib/google/devtools/clouderrorreporting/v1beta1/common_pb.rb +0 -64
- data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_pb.rb +0 -30
- data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_services_pb.rb +0 -50
- data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_pb.rb +0 -116
- data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_services_pb.rb +0 -52
- data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_pb.rb +0 -38
- data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_services_pb.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d0236b7db5323c5ab86adccc9a0fcad7db65080f4a7ff47142fd6645cc50008
|
4
|
+
data.tar.gz: bda4d6819f6a6063097a4874b80a939dbc13afe32531cac53488a3f5019a7045
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70094df759c28f7ce883dc90d35bd1a820171ce41ddc03ea06f4b8f504f3f43891ecfb10e225d11d5de9224842e243c4f14e0b980f035a1e70edc2032ba98352
|
7
|
+
data.tar.gz: 4a2c39a5ee27364915bd340296f52dc5554c7e8f8a703c0bd3922b3b711e6ae87e9f44df0837bdb41bf7980c1377a0261624fac8723dc4f4c4ff24a475d3007d
|
data/AUTHENTICATION.md
CHANGED
@@ -76,7 +76,8 @@ The environment variables that google-cloud-error_reporting checks for project I
|
|
76
76
|
1. `ERROR_REPORTING_PROJECT`
|
77
77
|
2. `GOOGLE_CLOUD_PROJECT`
|
78
78
|
|
79
|
-
The environment variables that google-cloud-error_reporting checks for credentials
|
79
|
+
The environment variables that google-cloud-error_reporting checks for credentials
|
80
|
+
are configured on {Google::Cloud::ErrorReporting::Credentials}:
|
80
81
|
|
81
82
|
1. `ERROR_REPORTING_CREDENTIALS` - Path to JSON file, or JSON contents
|
82
83
|
2. `ERROR_REPORTING_KEYFILE` - Path to JSON file, or JSON contents
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,52 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.42.0 / 2021-03-10
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
8
|
+
|
9
|
+
### 0.41.0 / 2020-09-16
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* quota_project can be set via library configuration
|
14
|
+
|
15
|
+
### 0.40.0 / 2020-07-21
|
16
|
+
|
17
|
+
This is a major update that removes the "low-level" client interface code, and
|
18
|
+
instead adds the new `google-cloud-error_reporting-v1beta1` gem as a dependency.
|
19
|
+
This is a rewritten low-level client produced by a next-generation client code
|
20
|
+
generator, with improved performance and stability.
|
21
|
+
|
22
|
+
This change should have no effect on the high-level interface that most users
|
23
|
+
will use. The one exception is that the (mostly undocumented) `client_config`
|
24
|
+
argument, for adjusting low-level parameters such as RPC retry settings on
|
25
|
+
client objects, has been removed. If you need to adjust these parameters, use
|
26
|
+
the configuration interface in `google-cloud-error_reporting-v1beta1`.
|
27
|
+
|
28
|
+
Substantial changes have been made in the low-level interfaces, however. If you
|
29
|
+
are using the low-level classes under the `Google::Cloud::ErrorReporting::V1beta1`
|
30
|
+
module, please review the docs for the new `google-cloud-error_reporting-v1beta1`
|
31
|
+
gem. In particular:
|
32
|
+
|
33
|
+
* Some classes have been renamed, notably the client class itself.
|
34
|
+
* The client constructor takes a configuration block instead of configuration
|
35
|
+
keyword arguments.
|
36
|
+
* All RPC method arguments are now keyword arguments.
|
37
|
+
|
38
|
+
### 0.35.2 / 2020-06-08
|
39
|
+
|
40
|
+
#### Documentation
|
41
|
+
|
42
|
+
* Fixed broken links in the reference documentation
|
43
|
+
|
44
|
+
### 0.35.1 / 2020-05-19
|
45
|
+
|
46
|
+
#### Bug Fixes
|
47
|
+
|
48
|
+
* Adjusted some default timeout and retry settings
|
49
|
+
|
3
50
|
### 0.35.0 / 2020-03-11
|
4
51
|
|
5
52
|
#### Features
|
data/CONTRIBUTING.md
CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
|
|
24
24
|
In order to use the google-cloud-error_reporting console and run the project's
|
25
25
|
tests, there is a small amount of setup:
|
26
26
|
|
27
|
-
1. Install Ruby. google-cloud-error_reporting requires Ruby 2.
|
27
|
+
1. Install Ruby. google-cloud-error_reporting requires Ruby 2.5+. You may choose
|
28
28
|
to manage your Ruby and gem installations with [RVM](https://rvm.io/),
|
29
29
|
[rbenv](https://github.com/rbenv/rbenv), or
|
30
30
|
[chruby](https://github.com/postmodern/chruby).
|
@@ -45,7 +45,7 @@ tests, there is a small amount of setup:
|
|
45
45
|
|
46
46
|
```sh
|
47
47
|
$ cd google-cloud-error_reporting/
|
48
|
-
$ bundle
|
48
|
+
$ bundle install
|
49
49
|
```
|
50
50
|
|
51
51
|
## Console
|
data/LOGGING.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
To enable logging for this library, set the logger for the underlying
|
4
4
|
[gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
|
5
5
|
that you set may be a Ruby stdlib
|
6
|
-
[`Logger`](https://ruby-doc.org/stdlib
|
6
|
+
[`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
|
7
7
|
shown below, or a
|
8
8
|
[`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
9
9
|
that will write logs to [Stackdriver
|
data/TROUBLESHOOTING.md
CHANGED
@@ -24,14 +24,8 @@ improved, *please* create a new issue on GitHub so we can talk about it.
|
|
24
24
|
|
25
25
|
- [New issue][gh-ruby]
|
26
26
|
|
27
|
-
Or, you can ask questions on the [Google Cloud Platform Slack][slack-ruby]. You
|
28
|
-
can use the "ruby" channel for general Ruby questions, or use the
|
29
|
-
"google-cloud-ruby" channel if you have questions about this gem in particular.
|
30
|
-
|
31
27
|
[so-ruby]: http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby+errorreporting
|
32
28
|
|
33
|
-
[gh-search-ruby]: https://github.com/
|
34
|
-
|
35
|
-
[gh-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues/new
|
29
|
+
[gh-search-ruby]: https://github.com/googleapis/google-cloud-ruby/issues?q=label%3A%22api%3A+error+reporting%22
|
36
30
|
|
37
|
-
[
|
31
|
+
[gh-ruby]: https://github.com/googleapis/google-cloud-ruby/issues/new
|
@@ -41,8 +41,6 @@ module Google
|
|
41
41
|
# * `https://www.googleapis.com/auth/cloud-platform`
|
42
42
|
#
|
43
43
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
44
|
-
# @param [Hash] client_config A hash of values to override the default
|
45
|
-
# behavior of the API client. Optional.
|
46
44
|
#
|
47
45
|
# @return [Google::Cloud::ErrorReporting::Project]
|
48
46
|
#
|
@@ -59,11 +57,10 @@ module Google
|
|
59
57
|
# service_version: "v8"
|
60
58
|
# error_reporting.report error_event
|
61
59
|
#
|
62
|
-
def error_reporting scope: nil, timeout: nil
|
60
|
+
def error_reporting scope: nil, timeout: nil
|
63
61
|
Google::Cloud.error_reporting @project, @keyfile,
|
64
62
|
scope: scope,
|
65
|
-
timeout: (timeout || @timeout)
|
66
|
-
client_config: client_config
|
63
|
+
timeout: (timeout || @timeout)
|
67
64
|
end
|
68
65
|
|
69
66
|
##
|
@@ -89,8 +86,6 @@ module Google
|
|
89
86
|
# * `https://www.googleapis.com/auth/cloud-platform`
|
90
87
|
#
|
91
88
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
92
|
-
# @param [Hash] client_config A hash of values to override the default
|
93
|
-
# behavior of the API client. Optional.
|
94
89
|
#
|
95
90
|
# @return [Google::Cloud::ErrorReporting::Project]
|
96
91
|
#
|
@@ -107,13 +102,11 @@ module Google
|
|
107
102
|
# service_version: "v8"
|
108
103
|
# error_reporting.report error_event
|
109
104
|
#
|
110
|
-
def self.error_reporting project_id = nil, credentials = nil, scope: nil,
|
111
|
-
timeout: nil, client_config: nil
|
105
|
+
def self.error_reporting project_id = nil, credentials = nil, scope: nil, timeout: nil
|
112
106
|
require "google/cloud/error_reporting"
|
113
107
|
Google::Cloud::ErrorReporting.new project_id: project_id,
|
114
108
|
credentials: credentials,
|
115
|
-
scope: scope, timeout: timeout
|
116
|
-
client_config: client_config
|
109
|
+
scope: scope, timeout: timeout
|
117
110
|
end
|
118
111
|
end
|
119
112
|
end
|
@@ -148,6 +141,7 @@ Google::Cloud.configure.add_config! :error_reporting do |config|
|
|
148
141
|
default_version = Google::Cloud::Config.deferred do
|
149
142
|
ENV["ERROR_REPORTING_VERSION"]
|
150
143
|
end
|
144
|
+
default_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
|
151
145
|
|
152
146
|
config.add_field! :project_id, default_project, match: String, allow_nil: true
|
153
147
|
config.add_alias! :project, :project_id
|
@@ -155,10 +149,10 @@ Google::Cloud.configure.add_config! :error_reporting do |config|
|
|
155
149
|
match: [String, Hash, Google::Auth::Credentials],
|
156
150
|
allow_nil: true
|
157
151
|
config.add_alias! :keyfile, :credentials
|
158
|
-
config.add_field! :scope,
|
152
|
+
config.add_field! :scope, default_scopes, match: [String, Array]
|
153
|
+
config.add_field! :quota_project, nil, match: String
|
159
154
|
config.add_field! :timeout, nil, match: Integer
|
160
|
-
config.add_field! :
|
161
|
-
config.add_field! :endpoint, nil, match: String
|
155
|
+
config.add_field! :endpoint, "clouderrorreporting.googleapis.com", match: String
|
162
156
|
config.add_field! :service_name, default_service,
|
163
157
|
match: String, allow_nil: true
|
164
158
|
config.add_field! :service_version, default_version,
|
@@ -62,8 +62,6 @@ module Google
|
|
62
62
|
# * `https://www.googleapis.com/auth/cloud-platform`
|
63
63
|
#
|
64
64
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
65
|
-
# @param [Hash] client_config A hash of values to override the default
|
66
|
-
# behavior of the API client. Optional.
|
67
65
|
# @param [String] endpoint Override of the endpoint host name. Optional.
|
68
66
|
# If the param is nil, uses the default endpoint.
|
69
67
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
@@ -78,25 +76,25 @@ module Google
|
|
78
76
|
# error_reporting = Google::Cloud::ErrorReporting.new
|
79
77
|
# # ...
|
80
78
|
#
|
81
|
-
def self.new project_id: nil,
|
82
|
-
|
79
|
+
def self.new project_id: nil,
|
80
|
+
credentials: nil,
|
81
|
+
scope: nil,
|
82
|
+
timeout: nil,
|
83
|
+
endpoint: nil,
|
84
|
+
project: nil,
|
85
|
+
keyfile: nil
|
83
86
|
project_id ||= project
|
84
87
|
project_id ||= ErrorReporting::Project.default_project_id
|
85
88
|
scope ||= configure.scope
|
86
89
|
timeout ||= configure.timeout
|
87
|
-
client_config ||= configure.client_config
|
88
90
|
endpoint ||= configure.endpoint
|
89
91
|
credentials ||= (keyfile || default_credentials(scope: scope))
|
90
92
|
|
91
93
|
credentials = resolve_credentials credentials, scope
|
92
94
|
project_id = resolve_project_id project_id, credentials
|
93
95
|
|
94
|
-
ErrorReporting::
|
95
|
-
|
96
|
-
project_id, credentials,
|
97
|
-
host: endpoint, timeout: timeout, client_config: client_config
|
98
|
-
)
|
99
|
-
)
|
96
|
+
service = ErrorReporting::Service.new project_id, credentials, host: endpoint, timeout: timeout
|
97
|
+
ErrorReporting::Project.new service
|
100
98
|
end
|
101
99
|
|
102
100
|
##
|
@@ -118,8 +116,6 @@ module Google
|
|
118
116
|
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
119
117
|
# the set of resources and operations that the connection can access.
|
120
118
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
121
|
-
# * `client_config` - (Hash) A hash of values to override the default
|
122
|
-
# behavior of the API client.
|
123
119
|
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
124
120
|
# to use the default endpoint.
|
125
121
|
# * `service_name` - (String) Name for the application.
|
@@ -292,4 +288,11 @@ module Google
|
|
292
288
|
private_class_method :default_credentials
|
293
289
|
end
|
294
290
|
end
|
291
|
+
|
292
|
+
# Aliases for compatibility with older spellings.
|
293
|
+
# @private
|
294
|
+
module Devtools
|
295
|
+
# @private
|
296
|
+
Clouderrorreporting = ::Google::Cloud::ErrorReporting unless const_defined? :Clouderrorreporting
|
297
|
+
end
|
295
298
|
end
|
@@ -108,7 +108,7 @@ module Google
|
|
108
108
|
#
|
109
109
|
# @return [AsyncErrorReporter] returns self so calls can be chained.
|
110
110
|
def stop
|
111
|
-
@thread_pool
|
111
|
+
@thread_pool&.shutdown
|
112
112
|
|
113
113
|
self
|
114
114
|
end
|
@@ -145,7 +145,7 @@ module Google
|
|
145
145
|
# @return [boolean] `true` when started, `false` otherwise.
|
146
146
|
#
|
147
147
|
def started?
|
148
|
-
@thread_pool
|
148
|
+
@thread_pool&.running?
|
149
149
|
end
|
150
150
|
|
151
151
|
##
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
require "google/cloud/error_reporting/v1beta1/credentials"
|
16
|
+
require "google/cloud/error_reporting/v1beta1/report_errors_service/credentials"
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
@@ -37,7 +37,7 @@ module Google
|
|
37
37
|
#
|
38
38
|
# error_reporting.project_id #=> "my-project"
|
39
39
|
#
|
40
|
-
class Credentials < Google::Cloud::ErrorReporting::V1beta1::Credentials
|
40
|
+
class Credentials < Google::Cloud::ErrorReporting::V1beta1::ReportErrorsService::Credentials
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -23,8 +23,7 @@ module Google
|
|
23
23
|
# service.
|
24
24
|
#
|
25
25
|
# Google::Cloud::ErrorReporting::ErrorEvent is able to be transformed
|
26
|
-
# into
|
27
|
-
# {Google::Devtools::Clouderrorreporting::V1beta1::ReportedErrorEvent}
|
26
|
+
# into the `Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent`
|
28
27
|
# gRPC structure. Once an error event is reported, the GCP
|
29
28
|
# Stackdriver ErrorReporting service is able to parse the message and
|
30
29
|
# backtrace, then group the error events by content.
|
@@ -119,13 +118,10 @@ module Google
|
|
119
118
|
|
120
119
|
##
|
121
120
|
# Build a new ErrorEvent from a
|
122
|
-
# Google::
|
123
|
-
# object.
|
121
|
+
# `Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent` object.
|
124
122
|
#
|
125
|
-
# @param [
|
126
|
-
# Google::
|
127
|
-
# grpc A
|
128
|
-
# Google::Devtools::Clouderrorreporting::V1beta1::ReportedErrorEvent
|
123
|
+
# @param [Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent]
|
124
|
+
# grpc A `Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent`
|
129
125
|
# object
|
130
126
|
#
|
131
127
|
# @return [ErrorEvent] A new ErrorEvent instance derived from given grpc
|
@@ -233,10 +229,10 @@ module Google
|
|
233
229
|
##
|
234
230
|
# Convert ErrorEvent object to gRPC struct.
|
235
231
|
#
|
236
|
-
# @return [
|
232
|
+
# @return [Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent]
|
237
233
|
# gRPC struct that represent an ErrorEvent.
|
238
234
|
def to_grpc
|
239
|
-
|
235
|
+
Google::Cloud::ErrorReporting::V1beta1::ReportedErrorEvent.new(
|
240
236
|
event_time: event_time_grpc,
|
241
237
|
message: message.to_s,
|
242
238
|
service_context: service_context_grpc,
|
@@ -259,11 +255,11 @@ module Google
|
|
259
255
|
|
260
256
|
##
|
261
257
|
# @private Formats the service_name and service_version as a
|
262
|
-
# Google::
|
258
|
+
# Google::Cloud::ErrorReporting::V1beta1::ServiceContext.
|
263
259
|
#
|
264
260
|
def service_context_grpc
|
265
261
|
return nil if !service_name && !service_version
|
266
|
-
|
262
|
+
Google::Cloud::ErrorReporting::V1beta1::ServiceContext.new(
|
267
263
|
service: service_name.to_s,
|
268
264
|
version: service_version.to_s
|
269
265
|
)
|
@@ -271,12 +267,12 @@ module Google
|
|
271
267
|
|
272
268
|
##
|
273
269
|
# @private Formats the http request context as a
|
274
|
-
# Google::
|
270
|
+
# Google::Cloud::ErrorReporting::V1beta1::HttpRequestContext
|
275
271
|
#
|
276
272
|
def http_request_grpc
|
277
273
|
return nil if !http_method && !http_url && !http_user_agent &&
|
278
274
|
!http_referrer && !http_status && !http_remote_ip
|
279
|
-
|
275
|
+
Google::Cloud::ErrorReporting::V1beta1::HttpRequestContext.new(
|
280
276
|
method: http_method.to_s,
|
281
277
|
url: http_url.to_s,
|
282
278
|
user_agent: http_user_agent.to_s,
|
@@ -288,11 +284,11 @@ module Google
|
|
288
284
|
|
289
285
|
##
|
290
286
|
# @private Formats the source location as a
|
291
|
-
# Google::
|
287
|
+
# Google::Cloud::ErrorReporting::V1beta1::SourceLocation
|
292
288
|
#
|
293
289
|
def source_location_grpc
|
294
290
|
return nil if !file_path && !line_number && !function_name
|
295
|
-
|
291
|
+
Google::Cloud::ErrorReporting::V1beta1::SourceLocation.new(
|
296
292
|
file_path: file_path.to_s,
|
297
293
|
line_number: line_number.to_i,
|
298
294
|
function_name: function_name.to_s
|
@@ -301,13 +297,13 @@ module Google
|
|
301
297
|
|
302
298
|
##
|
303
299
|
# @private Formats the error context info as a
|
304
|
-
# Google::
|
300
|
+
# Google::Cloud::ErrorReporting::V1beta1::ErrorContext
|
305
301
|
#
|
306
302
|
def error_context_grpc
|
307
303
|
http_request = http_request_grpc
|
308
304
|
source_location = source_location_grpc
|
309
305
|
return nil if !http_request && !source_location && !user
|
310
|
-
|
306
|
+
Google::Cloud::ErrorReporting::V1beta1::ErrorContext.new(
|
311
307
|
http_request: http_request,
|
312
308
|
user: user.to_s,
|
313
309
|
report_location: source_location
|
@@ -50,7 +50,7 @@ module Google
|
|
50
50
|
require "rack/request"
|
51
51
|
@app = app
|
52
52
|
|
53
|
-
load_config
|
53
|
+
load_config(**kwargs)
|
54
54
|
|
55
55
|
@error_reporting =
|
56
56
|
error_reporting ||
|
@@ -86,11 +86,11 @@ module Google
|
|
86
86
|
end
|
87
87
|
|
88
88
|
response
|
89
|
-
rescue Exception =>
|
90
|
-
report_exception env,
|
89
|
+
rescue Exception => e
|
90
|
+
report_exception env, e
|
91
91
|
|
92
92
|
# Always raise exception backup
|
93
|
-
raise
|
93
|
+
raise e
|
94
94
|
end
|
95
95
|
|
96
96
|
##
|
@@ -112,7 +112,7 @@ module Google
|
|
112
112
|
# If this exception maps to a HTTP status code less than 500, do
|
113
113
|
# not report it.
|
114
114
|
status_code = error_event.http_status.to_i
|
115
|
-
return if status_code
|
115
|
+
return if status_code.positive? && status_code < 500
|
116
116
|
|
117
117
|
error_reporting.report error_event
|
118
118
|
end
|
@@ -151,13 +151,13 @@ module Google
|
|
151
151
|
ErrorReporting::Credentials.new credentials
|
152
152
|
end
|
153
153
|
rescue StandardError => e
|
154
|
-
|
154
|
+
$stdout.puts "Note: Google::Cloud::ErrorReporting is disabled " \
|
155
155
|
"because it failed to authorize with the service. (#{e.message})"
|
156
156
|
return false
|
157
157
|
end
|
158
158
|
|
159
159
|
if project_id.to_s.empty?
|
160
|
-
|
160
|
+
$stdout.puts "Note: Google::Cloud::ErrorReporting is disabled " \
|
161
161
|
"because the project ID could not be determined."
|
162
162
|
return false
|
163
163
|
end
|
@@ -16,7 +16,6 @@
|
|
16
16
|
require "google/cloud/errors"
|
17
17
|
require "google/cloud/error_reporting/version"
|
18
18
|
require "google/cloud/error_reporting/v1beta1"
|
19
|
-
require "google/gax/errors"
|
20
19
|
require "uri"
|
21
20
|
|
22
21
|
module Google
|
@@ -26,31 +25,30 @@ module Google
|
|
26
25
|
# @private Represents the gRPC Error Reporting service, including all the
|
27
26
|
# API methods.
|
28
27
|
class Service
|
29
|
-
attr_accessor :project
|
28
|
+
attr_accessor :project
|
29
|
+
attr_accessor :credentials
|
30
|
+
attr_accessor :timeout
|
31
|
+
attr_accessor :host
|
30
32
|
|
31
33
|
##
|
32
34
|
# Creates a new Service instance.
|
33
|
-
def initialize project, credentials, timeout: nil,
|
34
|
-
host: nil
|
35
|
+
def initialize project, credentials, timeout: nil, host: nil
|
35
36
|
@project = project
|
36
37
|
@credentials = credentials
|
37
38
|
@timeout = timeout
|
38
|
-
@
|
39
|
-
@host = host || V1beta1::ReportErrorsServiceClient::SERVICE_ADDRESS
|
39
|
+
@host = host
|
40
40
|
end
|
41
41
|
|
42
42
|
def error_reporting
|
43
43
|
return mocked_error_reporting if mocked_error_reporting
|
44
44
|
@error_reporting ||= \
|
45
|
-
V1beta1::
|
46
|
-
credentials
|
47
|
-
timeout
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
lib_version: Google::Cloud::ErrorReporting::VERSION
|
53
|
-
)
|
45
|
+
V1beta1::ReportErrorsService::Client.new do |config|
|
46
|
+
config.credentials = credentials if credentials
|
47
|
+
config.timeout = timeout if timeout
|
48
|
+
config.endpoint = host if host
|
49
|
+
config.lib_name = "gccl"
|
50
|
+
config.lib_version = Google::Cloud::ErrorReporting::VERSION
|
51
|
+
end
|
54
52
|
end
|
55
53
|
attr_accessor :mocked_error_reporting
|
56
54
|
|
@@ -81,32 +79,13 @@ module Google
|
|
81
79
|
|
82
80
|
error_event_grpc = error_event.to_grpc
|
83
81
|
|
84
|
-
|
85
|
-
error_reporting.report_error_event project_path, error_event_grpc
|
86
|
-
end
|
82
|
+
error_reporting.report_error_event project_name: project_path, event: error_event_grpc
|
87
83
|
end
|
88
84
|
|
89
85
|
protected
|
90
86
|
|
91
|
-
def service_address
|
92
|
-
return nil if host.nil?
|
93
|
-
URI.parse("//#{host}").host
|
94
|
-
end
|
95
|
-
|
96
|
-
def service_port
|
97
|
-
return nil if host.nil?
|
98
|
-
URI.parse("//#{host}").port
|
99
|
-
end
|
100
|
-
|
101
87
|
def project_path
|
102
|
-
V1beta1::
|
103
|
-
end
|
104
|
-
|
105
|
-
def execute
|
106
|
-
yield
|
107
|
-
rescue Google::Gax::GaxError => e
|
108
|
-
# GaxError wraps BadStatus, but exposes it as #cause
|
109
|
-
raise Google::Cloud::Error.from_error(e.cause)
|
88
|
+
V1beta1::ReportErrorsService::Paths.project_path project: project
|
110
89
|
end
|
111
90
|
end
|
112
91
|
end
|