google-cloud-error_reporting 0.35.1 → 0.42.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +4 -2
- data/CHANGELOG.md +47 -0
- data/CONTRIBUTING.md +4 -7
- data/LOGGING.md +1 -1
- data/OVERVIEW.md +1 -2
- 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 +8 -13
- 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 +11 -72
- 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: 957342da4923bb845176e5ac341ffe375eff6c6fa8ccb6f7d19af8f30dce0170
|
4
|
+
data.tar.gz: cca90ec0d9c27d14252c863a3e8ae401b3e9e0c22db1f8036c240ff394ab2daa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98bf8f3898e2f5326cc3f5b1aa1997442bd7514f9a47d40abeb6602ac80cc638841fa90be67e3169492ef31990d352dcd4883d07725aac62ae4975ca23218a88
|
7
|
+
data.tar.gz: a7af81a8f51b5c183715a132a390023c1d4dc683c9547a22ad7b7d079495cf433739e78ca921b799911f50eb1749dd4098a8bb3e441871e58efa006c78d9ebb7
|
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
|
@@ -95,7 +96,8 @@ client = Google::Cloud::ErrorReporting.new
|
|
95
96
|
|
96
97
|
### Configuration
|
97
98
|
|
98
|
-
The **Project ID** and **Credentials JSON** can be configured
|
99
|
+
The **Project ID** and the path to the **Credentials JSON** file can be configured
|
100
|
+
instead of placing them in environment variables or providing them as arguments.
|
99
101
|
|
100
102
|
```ruby
|
101
103
|
require "google/cloud/error_reporting"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,52 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.42.1 / 2021-07-08
|
4
|
+
|
5
|
+
#### Documentation
|
6
|
+
|
7
|
+
* Update AUTHENTICATION.md in handwritten packages
|
8
|
+
|
9
|
+
### 0.42.0 / 2021-03-10
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
14
|
+
|
15
|
+
### 0.41.0 / 2020-09-16
|
16
|
+
|
17
|
+
#### Features
|
18
|
+
|
19
|
+
* quota_project can be set via library configuration
|
20
|
+
|
21
|
+
### 0.40.0 / 2020-07-21
|
22
|
+
|
23
|
+
This is a major update that removes the "low-level" client interface code, and
|
24
|
+
instead adds the new `google-cloud-error_reporting-v1beta1` gem as a dependency.
|
25
|
+
This is a rewritten low-level client produced by a next-generation client code
|
26
|
+
generator, with improved performance and stability.
|
27
|
+
|
28
|
+
This change should have no effect on the high-level interface that most users
|
29
|
+
will use. The one exception is that the (mostly undocumented) `client_config`
|
30
|
+
argument, for adjusting low-level parameters such as RPC retry settings on
|
31
|
+
client objects, has been removed. If you need to adjust these parameters, use
|
32
|
+
the configuration interface in `google-cloud-error_reporting-v1beta1`.
|
33
|
+
|
34
|
+
Substantial changes have been made in the low-level interfaces, however. If you
|
35
|
+
are using the low-level classes under the `Google::Cloud::ErrorReporting::V1beta1`
|
36
|
+
module, please review the docs for the new `google-cloud-error_reporting-v1beta1`
|
37
|
+
gem. In particular:
|
38
|
+
|
39
|
+
* Some classes have been renamed, notably the client class itself.
|
40
|
+
* The client constructor takes a configuration block instead of configuration
|
41
|
+
keyword arguments.
|
42
|
+
* All RPC method arguments are now keyword arguments.
|
43
|
+
|
44
|
+
### 0.35.2 / 2020-06-08
|
45
|
+
|
46
|
+
#### Documentation
|
47
|
+
|
48
|
+
* Fixed broken links in the reference documentation
|
49
|
+
|
3
50
|
### 0.35.1 / 2020-05-19
|
4
51
|
|
5
52
|
#### Bug Fixes
|
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
|
@@ -126,9 +126,7 @@ run the entire acceptance test suite. However, please ensure that you do
|
|
126
126
|
successfully run acceptance tests for any code areas covered by your pull
|
127
127
|
request.
|
128
128
|
|
129
|
-
To run the acceptance tests, first
|
130
|
-
Developers Console, as described in the {file:AUTHENTICATION.md Authentication
|
131
|
-
guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
|
129
|
+
To run the acceptance tests, first creat{file:AUTHENTICATION.md Authentication Guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
|
132
130
|
the KEYFILE location on your system.
|
133
131
|
|
134
132
|
Before you can run the Error Reporting acceptance tests, you must first create
|
@@ -185,5 +183,4 @@ $ bundle exec rake rubocop
|
|
185
183
|
## Code of Conduct
|
186
184
|
|
187
185
|
Please note that this project is released with a Contributor Code of Conduct. By
|
188
|
-
participating in this project you agree to abide by its terms. See
|
189
|
-
{file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
|
186
|
+
participating in this project you agree to abide by its terms. See {file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
|
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/OVERVIEW.md
CHANGED
@@ -44,5 +44,4 @@ See the {file:INSTRUMENTATION.md Instrumentation Guide} for more examples.
|
|
44
44
|
|
45
45
|
## Additional information
|
46
46
|
|
47
|
-
Stackdriver Error Reporting can be configured to use gRPC's logging. To learn more, see the
|
48
|
-
{file:LOGGING.md Logging guide}.
|
47
|
+
Stackdriver Error Reporting can be configured to use gRPC's logging. To learn more, see the{file:LOGGING.md Logging guide}.
|
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
|
@@ -180,15 +180,10 @@ module Google
|
|
180
180
|
##
|
181
181
|
# Fallback to default configuration values if not defined already
|
182
182
|
def init_default_config
|
183
|
-
configuration.project_id ||=
|
184
|
-
(Cloud.configure.project_id ||
|
185
|
-
ErrorReporting::Project.default_project_id)
|
186
|
-
end
|
183
|
+
configuration.project_id ||= (Cloud.configure.project_id || ErrorReporting::Project.default_project_id)
|
187
184
|
configuration.credentials ||= Cloud.configure.credentials
|
188
|
-
configuration.service_name ||=
|
189
|
-
|
190
|
-
configuration.service_version ||=
|
191
|
-
ErrorReporting::Project.default_service_version
|
185
|
+
configuration.service_name ||= ErrorReporting::Project.default_service_name
|
186
|
+
configuration.service_version ||= ErrorReporting::Project.default_service_version
|
192
187
|
configuration.ignore_classes = Array(configuration.ignore_classes)
|
193
188
|
end
|
194
189
|
|