google-cloud-error_reporting 0.32.0 → 0.32.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/google/cloud/error_reporting.rb +27 -15
- data/lib/google/cloud/error_reporting/middleware.rb +6 -8
- data/lib/google/cloud/error_reporting/v1beta1/doc/google/protobuf/timestamp.rb +6 -4
- data/lib/google/cloud/error_reporting/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9979f9f2835f10dddb6e0176470af18c3365f327c08b738986327efffab2408
|
4
|
+
data.tar.gz: 68c69be359657054041e9c8a81948c16750245a9ecc211679f610eab74931004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae9b9ea77ab3cf2119c798d82cdf3060903fa2bff1797d112c33e1e3dadda94143e580cfa644aca7ee44e707633300df58d38daa72386320799120d90f196967
|
7
|
+
data.tar.gz: a89bb5a4d117fc776db3f55d12b0f127bd8742ad4b82414a8f4ff1c6dd269dfcd7dff2494fbea8b9a70f2f2ca127cea2b66d1a3230a7d637c6160d2676b38881
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
+
require "monitor"
|
16
17
|
require "google-cloud-error_reporting"
|
17
18
|
require "google/cloud/error_reporting/async_error_reporter"
|
18
19
|
require "google/cloud/error_reporting/project"
|
@@ -35,7 +36,8 @@ module Google
|
|
35
36
|
##
|
36
37
|
# @private The default Google::Cloud::ErrorReporting::Project client used
|
37
38
|
# for the Google::Cloud::ErrorReporting.report API.
|
38
|
-
|
39
|
+
@default_reporter = nil
|
40
|
+
@default_reporter_mutex = Monitor.new
|
39
41
|
|
40
42
|
##
|
41
43
|
# Creates a new object for connecting to the Stackdriver Error Reporting
|
@@ -224,7 +226,7 @@ module Google
|
|
224
226
|
|
225
227
|
yield error_event if block_given?
|
226
228
|
|
227
|
-
|
229
|
+
default_reporter.report error_event
|
228
230
|
end
|
229
231
|
|
230
232
|
##
|
@@ -253,22 +255,32 @@ module Google
|
|
253
255
|
private_class_method :resolve_project_id
|
254
256
|
|
255
257
|
##
|
256
|
-
#
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
258
|
+
# Returns the global default reporter used by middleware and the
|
259
|
+
# {Google::Cloud::ErrorReporting.report} convenience method.
|
260
|
+
#
|
261
|
+
# If the default reporter is already defined, returns it. Otherwise, if
|
262
|
+
# a block is given, it is called and the result is set as the default
|
263
|
+
# reporter. Otherwise, if no block is given, a reporter is constructed
|
264
|
+
# from the default project and credentials.
|
265
|
+
#
|
266
|
+
# @return [#report]
|
267
|
+
#
|
268
|
+
def self.default_reporter &block
|
269
|
+
@default_reporter_mutex.synchronize do
|
270
|
+
@default_reporter ||=
|
271
|
+
if block
|
272
|
+
block.call
|
273
|
+
else
|
274
|
+
project_id = Project.default_project_id
|
275
|
+
credentials = default_credentials
|
276
|
+
AsyncErrorReporter.new(
|
277
|
+
new(project_id: project_id, credentials: credentials)
|
278
|
+
)
|
279
|
+
end
|
265
280
|
end
|
266
|
-
|
267
|
-
@@default_client
|
281
|
+
@default_reporter
|
268
282
|
end
|
269
283
|
|
270
|
-
private_class_method :default_client
|
271
|
-
|
272
284
|
##
|
273
285
|
# @private Default credentials.
|
274
286
|
def self.default_credentials scope: nil
|
@@ -54,14 +54,12 @@ module Google
|
|
54
54
|
|
55
55
|
@error_reporting =
|
56
56
|
error_reporting ||
|
57
|
-
ErrorReporting
|
58
|
-
ErrorReporting.new(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# configuration parameters.
|
64
|
-
ErrorReporting.class_variable_set :@@default_client, @error_reporting
|
57
|
+
ErrorReporting.default_reporter do
|
58
|
+
ErrorReporting::AsyncErrorReporter.new(
|
59
|
+
ErrorReporting.new(project: configuration.project_id,
|
60
|
+
credentials: configuration.credentials)
|
61
|
+
)
|
62
|
+
end
|
65
63
|
end
|
66
64
|
|
67
65
|
##
|
@@ -88,11 +88,13 @@ module Google
|
|
88
88
|
# 01:30 UTC on January 15, 2017.
|
89
89
|
#
|
90
90
|
# In JavaScript, one can convert a Date object to this format using the
|
91
|
-
# standard
|
91
|
+
# standard
|
92
|
+
# [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
92
93
|
# method. In Python, a standard `datetime.datetime` object can be converted
|
93
|
-
# to this format using
|
94
|
-
#
|
95
|
-
#
|
94
|
+
# to this format using
|
95
|
+
# [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
96
|
+
# the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
97
|
+
# the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
96
98
|
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
97
99
|
# ) to obtain a formatter capable of generating timestamps in this format.
|
98
100
|
# @!attribute [rw] seconds
|
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.32.
|
4
|
+
version: 0.32.1
|
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-
|
11
|
+
date: 2019-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|