google-cloud-logging 1.5.5 → 1.5.6
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/CHANGELOG.md +6 -0
- data/lib/google/cloud/logging/logger.rb +11 -19
- data/lib/google/cloud/logging/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f0f56c213ee74340b1ad45478f47ccc2dd6679dab718127bfa4e47e5ba63a37
|
4
|
+
data.tar.gz: 06d6bf7c11816f05517a7e9b2016d45baebc6dd938c50ab4c4763730481d03c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b14c0195cb3290431e10b9554d31778eecbd2380694adcf2bc6911848c6d6aff7122906960abcd15f6749c3f49c08d61900c80cdf505641275ce837438f2e9f
|
7
|
+
data.tar.gz: ecffe6908619f5b2c6d9baa0f5ed785c4ccc129c58f3f5e23c31564b1cb513f28307d3de32c97daa18d74c45c83f89938ec6f6687f2aa30ddd03a26ee01e3e64
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.5.6 / 2018-10-03
|
4
|
+
|
5
|
+
* Use concurrent-ruby and ThreadLocalVar in Logger.
|
6
|
+
* Remove Monitor and synchronize blocks.
|
7
|
+
* Logger#thread_ids now only returns the current thread.
|
8
|
+
|
3
9
|
### 1.5.5 / 2018-09-20
|
4
10
|
|
5
11
|
* Make Logger thread-safe.
|
@@ -14,8 +14,8 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
require "logger"
|
17
|
-
require "monitor"
|
18
17
|
require "thread"
|
18
|
+
require "concurrent"
|
19
19
|
|
20
20
|
module Google
|
21
21
|
module Cloud
|
@@ -53,8 +53,6 @@ module Google
|
|
53
53
|
# logger.info payload
|
54
54
|
#
|
55
55
|
class Logger
|
56
|
-
include MonitorMixin
|
57
|
-
|
58
56
|
##
|
59
57
|
# A RequestInfo represents data about the request being handled by the
|
60
58
|
# current thread. It is used to configure logs coming from that thread.
|
@@ -122,12 +120,15 @@ module Google
|
|
122
120
|
# Stackdriver trace ID is a shared request identifier across all
|
123
121
|
# Stackdriver services.
|
124
122
|
#
|
123
|
+
# This method is deprecated and returns a Hash containing only the
|
124
|
+
# current Thread ID/trace_id now.
|
125
|
+
#
|
125
126
|
# @deprecated Use request_info
|
126
127
|
#
|
127
128
|
def trace_ids
|
128
|
-
|
129
|
-
|
130
|
-
|
129
|
+
current_request_info = request_info
|
130
|
+
return {} if current_request_info.nil?
|
131
|
+
{ current_thread_id => current_request_info.trace_id }
|
131
132
|
end
|
132
133
|
|
133
134
|
##
|
@@ -172,7 +173,7 @@ module Google
|
|
172
173
|
@resource = resource
|
173
174
|
@labels = labels || {}
|
174
175
|
@level = 0 # DEBUG is the default behavior
|
175
|
-
@
|
176
|
+
@request_info_var = Concurrent::ThreadLocalVar.new
|
176
177
|
@closed = false
|
177
178
|
# Unused, but present for API compatibility
|
178
179
|
@formatter = ::Logger::Formatter.new
|
@@ -182,8 +183,6 @@ module Google
|
|
182
183
|
# The writer is usually a Project or AsyncWriter.
|
183
184
|
logging = @writer.respond_to?(:logging) ? @writer.logging : @writer
|
184
185
|
@project = logging.project if logging.respond_to? :project
|
185
|
-
|
186
|
-
super() # to init MonitorMixin
|
187
186
|
end
|
188
187
|
|
189
188
|
##
|
@@ -461,14 +460,7 @@ module Google
|
|
461
460
|
def add_request_info info: nil, env: nil, trace_id: nil, log_name: nil
|
462
461
|
info ||= RequestInfo.new trace_id, log_name, env
|
463
462
|
|
464
|
-
|
465
|
-
@request_info_map[current_thread_id] = info
|
466
|
-
|
467
|
-
# Start removing old entries if hash gets too large.
|
468
|
-
# This should never happen, because middleware should automatically
|
469
|
-
# remove entries when a request is finished
|
470
|
-
@request_info_map.shift while @request_info_map.size > 10_000
|
471
|
-
end
|
463
|
+
@request_info_var.value = info
|
472
464
|
|
473
465
|
info
|
474
466
|
end
|
@@ -480,7 +472,7 @@ module Google
|
|
480
472
|
# or `nil` if there is no data set.
|
481
473
|
#
|
482
474
|
def request_info
|
483
|
-
|
475
|
+
@request_info_var.value
|
484
476
|
end
|
485
477
|
|
486
478
|
##
|
@@ -489,7 +481,7 @@ module Google
|
|
489
481
|
# @return [RequestInfo] The info that's being deleted
|
490
482
|
#
|
491
483
|
def delete_request_info
|
492
|
-
|
484
|
+
@request_info_var.value = nil
|
493
485
|
end
|
494
486
|
|
495
487
|
##
|
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.5.
|
4
|
+
version: 1.5.6
|
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: 2018-
|
12
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.0.2
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: concurrent-ruby
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.0'
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: minitest
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|