activejob-traceable 0.3.1 → 0.3.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cb378813a2f5765ca4f61d2ddd47f20eb51d12a459999e9097ad48dee946b3f
|
4
|
+
data.tar.gz: '0290962714ba0b3da20c57dff9d494b91e11158b7da115f5a258cac7d89e2949'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d436c1d712b26ca84ad773d2d1c5b9514a368c59a35a8dfa521821544d73470792602226bc9c8c9f2e5ec2cbfff7da2bc0d6dbdc87d7e617525890755cfe5557
|
7
|
+
data.tar.gz: acba39bed024643d06b5d15e87f09d6b991a48b8c3379068e570ac5b3b0f72b044ce4b724bb105e1fa98821a31e2d4f869209c8897f8ccc636190c273fda6866
|
data/lib/activejob/traceable.rb
CHANGED
@@ -14,15 +14,26 @@ module ActiveJob
|
|
14
14
|
module_function
|
15
15
|
|
16
16
|
def tracing_info_getter=(lambda)
|
17
|
-
|
17
|
+
if lambda
|
18
|
+
raise 'Tracing info getter should be callable' unless lambda.respond_to?(:call)
|
19
|
+
raise 'Tracing info getter should contain a hash' unless lambda.call.is_a?(Hash)
|
18
20
|
|
19
|
-
|
21
|
+
@tracing_info_getter = lambda
|
22
|
+
else
|
23
|
+
# Resets the value
|
24
|
+
@tracing_info_getter = nil
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
def tracing_info_setter=(lambda)
|
23
|
-
|
29
|
+
if lambda
|
30
|
+
raise 'Tracing info setter should be callable' unless lambda.respond_to?(:call)
|
24
31
|
|
25
|
-
|
32
|
+
@tracing_info_setter = lambda
|
33
|
+
else
|
34
|
+
# Resets the value
|
35
|
+
@tracing_info_setter = nil
|
36
|
+
end
|
26
37
|
end
|
27
38
|
end
|
28
39
|
end
|
@@ -9,9 +9,8 @@ module ActiveJob
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def tag_logger(*tags)
|
12
|
-
|
13
|
-
|
14
|
-
end
|
12
|
+
tags << ActiveJob::Traceable.tracing_info_getter.call.values.compact
|
13
|
+
tags.flatten!
|
15
14
|
|
16
15
|
if logger.respond_to?(:tagged)
|
17
16
|
tags.unshift 'ActiveJob' unless logger_tagged_by_active_job?
|
@@ -10,7 +10,7 @@ module ActiveJob
|
|
10
10
|
def initialize(*arguments)
|
11
11
|
super(*arguments)
|
12
12
|
|
13
|
-
@tracing_info = Traceable.tracing_info_getter.call
|
13
|
+
@tracing_info = Traceable.tracing_info_getter.call
|
14
14
|
end
|
15
15
|
|
16
16
|
def serialize
|
@@ -20,14 +20,22 @@ module ActiveJob
|
|
20
20
|
def deserialize(job_data)
|
21
21
|
super(job_data)
|
22
22
|
|
23
|
-
|
23
|
+
if job_data['tracing_info'].is_a?(Hash)
|
24
|
+
self.tracing_info = job_data['tracing_info']
|
25
|
+
end
|
24
26
|
|
25
|
-
Traceable.tracing_info_setter.call(tracing_info)
|
27
|
+
Traceable.tracing_info_setter.call(tracing_info)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
31
|
class << self
|
30
|
-
|
32
|
+
def tracing_info_getter
|
33
|
+
@tracing_info_getter || -> { {} }
|
34
|
+
end
|
35
|
+
|
36
|
+
def tracing_info_setter
|
37
|
+
@tracing_info_setter || -> {}
|
38
|
+
end
|
31
39
|
end
|
32
40
|
end
|
33
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activejob-traceable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Qonto team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|