activejob-traceable 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: f53b6279e6b8a5213846d99ddb0929f0d1571394
4
- data.tar.gz: 288b6db4b8adf00d9203f8f7bb534fb517ef3a65
3
+ metadata.gz: b7c05591e8a40f71a62321ff64b3f310cd3d2fd6
4
+ data.tar.gz: ac10c925fcdd8adc4446f752a23805c10f6f9548
5
5
  SHA512:
6
- metadata.gz: 0a4c98f6fdd79e1f1fe5d8a02357966b03dc8ff5242e577d2714bbf2ab29c78b3228c975fb2d6f6450af098806a84ea06a617e61a6e1c76b6c08a00cf1aea3c8
7
- data.tar.gz: 413071cf86256ca8acb7f9f9eba41d11873066e1070c2e930abf13a686b99e0a2a5b295e585f2dfdcc9df5ad79d1736c957d7f360e0da1a906df67af067bce7b
6
+ metadata.gz: 8625938781c924cf223599fa889a5f62b1d6adee95fdaaac31b921d84e8ffebc3161dac4c04c17893877ca91f6b6177d4493caea328b0a16dbf10350ab647a26
7
+ data.tar.gz: 53942c40d0e4ebeca6e3e0d9c35e6c706a42a99c5b6db780e50750ba175da36ae2800c8791ff5bcaeebfadd56757cdb952b4a4efa986e73482508ef793558417
@@ -8,8 +8,7 @@
8
8
  <orderEntry type="inheritedJdk" />
9
9
  <orderEntry type="sourceFolder" forTests="false" />
10
10
  <orderEntry type="library" scope="PROVIDED" name="activejob (v5.1.4, rbenv: 2.4.2) [gem]" level="application" />
11
- <orderEntry type="library" scope="PROVIDED" name="activesupport (v5.1.4, rbenv: 2.4.2) [gem]" level="application" />
12
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.1, rbenv: 2.4.2) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.1, rbenv: 2.4.2) [gem]" level="application" />
13
12
  <orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.2, rbenv: 2.4.2) [gem]" level="application" />
14
13
  <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.5, rbenv: 2.4.2) [gem]" level="application" />
15
14
  <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, rbenv: 2.4.2) [gem]" level="application" />
@@ -18,8 +17,8 @@
18
17
  <orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.0, rbenv: 2.4.2) [gem]" level="application" />
19
18
  <orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.3, rbenv: 2.4.2) [gem]" level="application" />
20
19
  <orderEntry type="library" scope="PROVIDED" name="pry (v0.11.3, rbenv: 2.4.2) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, rbenv: 2.4.2) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.7.0, rbenv: 2.4.2) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rake (v12.3.1, rbenv: 2.4.2) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, rbenv: 2.4.2) [gem]" level="application" />
23
22
  <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.7.0, rbenv: 2.4.2) [gem]" level="application" />
24
23
  <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.7.0, rbenv: 2.4.2) [gem]" level="application" />
25
24
  <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.7.0, rbenv: 2.4.2) [gem]" level="application" />
@@ -1,3 +1,3 @@
1
1
  <component name="MarkdownNavigator.ProfileManager">
2
- <settings default="" pdf-export="" />
2
+ <settings default="" pdf-export="" plain-text-search-scope="Project Files" />
3
3
  </component>
data/.idea/workspace.xml CHANGED
@@ -9,70 +9,73 @@
9
9
  <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
10
10
  </list>
11
11
  <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
12
- <option name="TRACKING_ENABLED" value="true" />
13
12
  <option name="SHOW_DIALOG" value="false" />
14
13
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
15
14
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
16
15
  <option name="LAST_RESOLUTION" value="IGNORE" />
17
16
  </component>
18
17
  <component name="FileEditorManager">
19
- <leaf>
20
- <file leaf-file-name="version.rb" pinned="false" current-in-tab="false">
18
+ <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
19
+ <file pinned="false" current-in-tab="false">
21
20
  <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/version.rb">
22
21
  <provider selected="true" editor-type-id="text-editor">
23
- <state>
24
- <caret column="14" selection-start-column="14" selection-end-column="14" />
22
+ <state relative-caret-position="30">
23
+ <caret line="2" column="14" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
25
24
  </state>
26
25
  </provider>
27
26
  </entry>
28
27
  </file>
29
- <file leaf-file-name="traceable.rb" pinned="false" current-in-tab="false">
28
+ <file pinned="false" current-in-tab="false">
30
29
  <entry file="file://$PROJECT_DIR$/lib/activejob/traceable.rb">
31
30
  <provider selected="true" editor-type-id="text-editor">
32
31
  <state relative-caret-position="360">
33
- <caret line="24" selection-start-line="24" selection-end-line="24" />
32
+ <caret line="52" selection-start-line="52" selection-end-line="52" />
34
33
  </state>
35
34
  </provider>
36
35
  </entry>
37
36
  </file>
38
- <file leaf-file-name="traceable.rb" pinned="false" current-in-tab="false">
37
+ <file pinned="false" current-in-tab="false">
38
+ <entry file="file://$PROJECT_DIR$/activejob-traceable.gemspec">
39
+ <provider selected="true" editor-type-id="text-editor">
40
+ <state relative-caret-position="435">
41
+ <caret line="29" column="51" selection-start-line="29" selection-start-column="51" selection-end-line="29" selection-end-column="51" />
42
+ </state>
43
+ </provider>
44
+ </entry>
45
+ </file>
46
+ <file pinned="false" current-in-tab="false">
39
47
  <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/traceable.rb">
40
48
  <provider selected="true" editor-type-id="text-editor">
41
- <state relative-caret-position="60">
42
- <caret line="4" column="15" selection-start-line="2" selection-start-column="4" selection-end-line="4" selection-end-column="15" />
49
+ <state relative-caret-position="90">
50
+ <caret line="6" column="15" selection-start-line="6" selection-start-column="15" selection-end-line="6" selection-end-column="15" />
43
51
  </state>
44
52
  </provider>
45
53
  </entry>
46
54
  </file>
47
- <file leaf-file-name="logging_patch.rb" pinned="false" current-in-tab="false">
55
+ <file pinned="false" current-in-tab="false">
48
56
  <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/logging_patch.rb">
49
57
  <provider selected="true" editor-type-id="text-editor">
50
58
  <state relative-caret-position="345">
51
- <caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
59
+ <caret line="34" selection-start-line="34" selection-end-line="34" />
52
60
  </state>
53
61
  </provider>
54
62
  </entry>
55
63
  </file>
56
- <file leaf-file-name="activejob-traceable.gemspec" pinned="false" current-in-tab="false">
57
- <entry file="file://$PROJECT_DIR$/activejob-traceable.gemspec">
58
- <provider selected="true" editor-type-id="text-editor" />
59
- </entry>
60
- </file>
61
- <file leaf-file-name=".rspec" pinned="false" current-in-tab="false">
64
+ <file pinned="false" current-in-tab="false">
62
65
  <entry file="file://$PROJECT_DIR$/.rspec">
63
66
  <provider selected="true" editor-type-id="text-editor">
64
67
  <state relative-caret-position="15">
65
- <caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
68
+ <caret line="1" selection-start-line="1" selection-end-line="1" />
66
69
  </state>
67
70
  </provider>
68
71
  </entry>
69
72
  </file>
70
- <file leaf-file-name="README.md" pinned="false" current-in-tab="true">
73
+ <file pinned="false" current-in-tab="true">
71
74
  <entry file="file://$PROJECT_DIR$/README.md">
72
75
  <provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
73
76
  <state split_layout="SPLIT">
74
- <first_editor relative-caret-position="395">
75
- <caret line="41" column="15" lean-forward="true" selection-start-line="41" selection-start-column="15" selection-end-line="42" />
77
+ <first_editor relative-caret-position="445">
78
+ <caret line="54" lean-forward="true" selection-start-line="54" selection-end-line="54" />
76
79
  </first_editor>
77
80
  <second_editor>
78
81
  <markdownNavigatorState />
@@ -81,29 +84,20 @@
81
84
  </provider>
82
85
  </entry>
83
86
  </file>
84
- <file leaf-file-name="spec_helper.rb" pinned="false" current-in-tab="false">
87
+ <file pinned="false" current-in-tab="false">
85
88
  <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
86
89
  <provider selected="true" editor-type-id="text-editor">
87
- <state relative-caret-position="60">
88
- <caret line="4" selection-start-line="4" selection-end-line="4" />
90
+ <state relative-caret-position="90">
91
+ <caret line="6" selection-start-line="6" selection-end-line="6" />
89
92
  </state>
90
93
  </provider>
91
94
  </entry>
92
95
  </file>
93
- <file leaf-file-name="traceable_spec.rb" pinned="false" current-in-tab="false">
96
+ <file pinned="false" current-in-tab="false">
94
97
  <entry file="file://$PROJECT_DIR$/spec/activejob/traceable_spec.rb">
95
98
  <provider selected="true" editor-type-id="text-editor">
96
- <state relative-caret-position="345">
97
- <caret line="23" column="26" lean-forward="true" selection-start-line="23" selection-start-column="26" selection-end-line="23" selection-end-column="26" />
98
- </state>
99
- </provider>
100
- </entry>
101
- </file>
102
- <file leaf-file-name=".travis.yml" pinned="false" current-in-tab="false">
103
- <entry file="file://$PROJECT_DIR$/.travis.yml">
104
- <provider selected="true" editor-type-id="text-editor">
105
- <state>
106
- <caret lean-forward="true" />
99
+ <state relative-caret-position="1755">
100
+ <caret line="117" column="26" selection-start-line="117" selection-start-column="26" selection-end-line="117" selection-end-column="26" />
107
101
  </state>
108
102
  </provider>
109
103
  </entry>
@@ -137,16 +131,10 @@
137
131
  </list>
138
132
  </option>
139
133
  </component>
140
- <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
141
- <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
142
- <component name="JsGulpfileManager">
143
- <detection-done>true</detection-done>
144
- <sorting>DEFINITION_ORDER</sorting>
145
- </component>
146
134
  <component name="ProjectFrameBounds" extendedState="6">
147
- <option name="y" value="-1057" />
148
- <option name="width" value="1920" />
149
- <option name="height" value="1057" />
135
+ <option name="y" value="-877" />
136
+ <option name="width" value="1440" />
137
+ <option name="height" value="877" />
150
138
  </component>
151
139
  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
152
140
  <component name="ProjectView">
@@ -198,6 +186,7 @@
198
186
  </panes>
199
187
  </component>
200
188
  <component name="PropertiesComponent">
189
+ <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
201
190
  <property name="WebServerToolWindowFactoryState" value="false" />
202
191
  <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
203
192
  <property name="nodejs_npm_path_reset_for_default_project" value="true" />
@@ -228,6 +217,9 @@
228
217
  <option name="presentableId" value="Default" />
229
218
  <updated>1533206891659</updated>
230
219
  <workItem from="1533206893365" duration="7822000" />
220
+ <workItem from="1533286104852" duration="354000" />
221
+ <workItem from="1533630485631" duration="249000" />
222
+ <workItem from="1565183643326" duration="519000" />
231
223
  </task>
232
224
  <task id="LOCAL-00001" summary="Initial commit">
233
225
  <created>1533223167114</created>
@@ -247,121 +239,109 @@
247
239
  <servers />
248
240
  </component>
249
241
  <component name="TimeTrackingManager">
250
- <option name="totallyTimeSpent" value="7822000" />
242
+ <option name="totallyTimeSpent" value="8944000" />
251
243
  </component>
252
244
  <component name="ToolWindowManager">
253
- <frame x="0" y="-1057" width="1920" height="1053" extended-state="6" />
254
- <editor active="true" />
245
+ <frame x="0" y="-1057" width="1920" height="1057" extended-state="6" />
255
246
  <layout>
256
- <window_info anchor="bottom" id="TODO" order="6" />
257
- <window_info anchor="bottom" id="Event Log" side_tool="true" />
258
- <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
259
- <window_info anchor="bottom" id="Run" order="2" weight="0.3294979" />
260
- <window_info anchor="bottom" id="Version Control" />
261
- <window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.3294979" />
262
- <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24973376" />
263
- <window_info anchor="bottom" id="Docker" />
264
- <window_info anchor="right" id="Database" />
265
- <window_info anchor="bottom" id="Find" order="1" />
247
+ <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.19329074" />
266
248
  <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
249
+ <window_info id="Favorites" order="2" side_tool="true" />
250
+ <window_info anchor="bottom" id="Message" order="0" />
251
+ <window_info anchor="bottom" id="Find" order="1" />
252
+ <window_info anchor="bottom" id="Run" order="2" weight="0.3294979" />
267
253
  <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
268
- <window_info id="Favorites" side_tool="true" />
269
- <window_info anchor="right" id="Commander" order="0" weight="0.4" />
270
- <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
254
+ <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
271
255
  <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
256
+ <window_info anchor="bottom" id="TODO" order="6" />
257
+ <window_info anchor="bottom" id="Docker" order="7" />
258
+ <window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
259
+ <window_info active="true" anchor="bottom" id="Terminal" order="9" visible="true" weight="0.3284974" />
260
+ <window_info anchor="bottom" id="Version Control" order="10" weight="0.27564767" />
261
+ <window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
262
+ <window_info anchor="right" id="Commander" order="0" weight="0.4" />
272
263
  <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
273
- <window_info anchor="bottom" id="Message" order="0" />
274
- <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
264
+ <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
265
+ <window_info anchor="right" id="Database" order="3" />
275
266
  </layout>
276
267
  </component>
277
268
  <component name="TypeScriptGeneratedFilesManager">
278
269
  <option name="version" value="1" />
279
270
  </component>
280
- <component name="VcsContentAnnotationSettings">
281
- <option name="myLimit" value="2678400000" />
282
- </component>
283
271
  <component name="VcsManagerConfiguration">
284
272
  <MESSAGE value="Initial commit" />
285
273
  <option name="LAST_COMMIT_MESSAGE" value="Initial commit" />
286
274
  </component>
287
275
  <component name="editorHistoryManager">
288
- <entry file="file://$PROJECT_DIR$/bin/console">
289
- <provider selected="true" editor-type-id="text-editor" />
290
- </entry>
291
- <entry file="file://$PROJECT_DIR$/bin/setup">
276
+ <entry file="file://$PROJECT_DIR$/.travis.yml">
292
277
  <provider selected="true" editor-type-id="text-editor">
293
- <state relative-caret-position="120">
294
- <caret line="8" selection-start-line="8" selection-end-line="8" />
278
+ <state>
279
+ <caret lean-forward="true" />
295
280
  </state>
296
281
  </provider>
297
282
  </entry>
298
- <entry file="file://$PROJECT_DIR$/Rakefile">
299
- <provider selected="true" editor-type-id="text-editor" />
300
- </entry>
301
- <entry file="file://$PROJECT_DIR$/lib/activejob/traceable.rb">
283
+ <entry file="file://$PROJECT_DIR$/bin/setup" />
284
+ <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/version.rb">
302
285
  <provider selected="true" editor-type-id="text-editor">
303
- <state relative-caret-position="360">
304
- <caret line="24" selection-start-line="24" selection-end-line="24" />
286
+ <state relative-caret-position="30">
287
+ <caret line="2" column="14" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
305
288
  </state>
306
289
  </provider>
307
290
  </entry>
308
- <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
291
+ <entry file="file://$PROJECT_DIR$/lib/activejob/traceable.rb">
309
292
  <provider selected="true" editor-type-id="text-editor">
310
- <state relative-caret-position="60">
311
- <caret line="4" selection-start-line="4" selection-end-line="4" />
293
+ <state relative-caret-position="360">
294
+ <caret line="52" selection-start-line="52" selection-end-line="52" />
312
295
  </state>
313
296
  </provider>
314
297
  </entry>
315
- <entry file="file://$PROJECT_DIR$/spec/activejob/traceable_spec.rb">
298
+ <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/traceable.rb">
316
299
  <provider selected="true" editor-type-id="text-editor">
317
- <state relative-caret-position="345">
318
- <caret line="23" column="26" lean-forward="true" selection-start-line="23" selection-start-column="26" selection-end-line="23" selection-end-column="26" />
300
+ <state relative-caret-position="90">
301
+ <caret line="6" column="15" selection-start-line="6" selection-start-column="15" selection-end-line="6" selection-end-column="15" />
319
302
  </state>
320
303
  </provider>
321
304
  </entry>
322
- <entry file="file://$PROJECT_DIR$/.travis.yml">
305
+ <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/logging_patch.rb">
323
306
  <provider selected="true" editor-type-id="text-editor">
324
- <state>
325
- <caret lean-forward="true" />
307
+ <state relative-caret-position="345">
308
+ <caret line="34" selection-start-line="34" selection-end-line="34" />
326
309
  </state>
327
310
  </provider>
328
311
  </entry>
329
- <entry file="file://$PROJECT_DIR$/activejob-traceable.gemspec">
330
- <provider selected="true" editor-type-id="text-editor" />
331
- </entry>
332
312
  <entry file="file://$PROJECT_DIR$/.rspec">
333
313
  <provider selected="true" editor-type-id="text-editor">
334
314
  <state relative-caret-position="15">
335
- <caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
315
+ <caret line="1" selection-start-line="1" selection-end-line="1" />
336
316
  </state>
337
317
  </provider>
338
318
  </entry>
339
- <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/traceable.rb">
319
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
340
320
  <provider selected="true" editor-type-id="text-editor">
341
- <state relative-caret-position="60">
342
- <caret line="4" column="15" selection-start-line="2" selection-start-column="4" selection-end-line="4" selection-end-column="15" />
321
+ <state relative-caret-position="90">
322
+ <caret line="6" selection-start-line="6" selection-end-line="6" />
343
323
  </state>
344
324
  </provider>
345
325
  </entry>
346
- <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/logging_patch.rb">
326
+ <entry file="file://$PROJECT_DIR$/spec/activejob/traceable_spec.rb">
347
327
  <provider selected="true" editor-type-id="text-editor">
348
- <state relative-caret-position="345">
349
- <caret line="23" lean-forward="true" selection-start-line="23" selection-end-line="23" />
328
+ <state relative-caret-position="1755">
329
+ <caret line="117" column="26" selection-start-line="117" selection-start-column="26" selection-end-line="117" selection-end-column="26" />
350
330
  </state>
351
331
  </provider>
352
332
  </entry>
353
- <entry file="file://$PROJECT_DIR$/lib/activejob/traceable/version.rb">
333
+ <entry file="file://$PROJECT_DIR$/activejob-traceable.gemspec">
354
334
  <provider selected="true" editor-type-id="text-editor">
355
- <state>
356
- <caret column="14" selection-start-column="14" selection-end-column="14" />
335
+ <state relative-caret-position="435">
336
+ <caret line="29" column="51" selection-start-line="29" selection-start-column="51" selection-end-line="29" selection-end-column="51" />
357
337
  </state>
358
338
  </provider>
359
339
  </entry>
360
340
  <entry file="file://$PROJECT_DIR$/README.md">
361
341
  <provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
362
342
  <state split_layout="SPLIT">
363
- <first_editor relative-caret-position="395">
364
- <caret line="41" column="15" lean-forward="true" selection-start-line="41" selection-start-column="15" selection-end-line="42" />
343
+ <first_editor relative-caret-position="445">
344
+ <caret line="54" lean-forward="true" selection-start-line="54" selection-end-line="54" />
365
345
  </first_editor>
366
346
  <second_editor>
367
347
  <markdownNavigatorState />
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in activejob-traceable.gemspec
6
8
  gemspec
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # ActiveJob::Traceable
2
2
 
3
- Patches ActiveJob to add an attribute `trace_id`, which is added as log's tag.
3
+ Patches ActiveJob to add attributes `actor_id` and `correlation_id`, which are added as log's tags.
4
4
  The purpose of this patch is to be able to trace which workers are called as a result of user's HTTP request.
5
5
 
6
+ :warning: `trace_id` attribute is now deprecated in favor of `actor_id` and `correlation_id`.
7
+
6
8
  ## Installation
7
9
 
8
10
  Add this line to your application's Gemfile:
@@ -21,12 +23,16 @@ Or install it yourself as:
21
23
 
22
24
  ## Configuration
23
25
 
24
- Create an initiazlier to tell ActiveJob how to get current `trace_id` and how to set it once deserialized:
26
+ Create an initializer to tell ActiveJob how to get current `actor_id` and `correlation_id` and how to set them once deserialized:
25
27
 
26
28
  ```ruby
27
29
  # config/initializers/activejob_traceable.rb
28
- ActiveJob::Traceable.trace_id_getter = -> { CurrentScope.trace_id }
29
- ActiveJob::Traceable.trace_id_setter = -> (trace_id) { CurrentScope.trace_id = trace_id }
30
+
31
+ ActiveJob::Traceable.actor_id_getter = -> { CurrentScope.actor_id }
32
+ ActiveJob::Traceable.actor_id_setter = ->(id) { CurrentScope.actor_id = id }
33
+
34
+ ActiveJob::Traceable.correlation_id_getter = -> { CurrentScope.correlation_id }
35
+ ActiveJob::Traceable.correlation_id_setter = ->(id) { CurrentScope.correlation_id = id }
30
36
  ```
31
37
 
32
38
  ## Usage
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1,14 +1,16 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'activejob/traceable/version'
4
6
 
5
7
  Gem::Specification.new do |spec|
6
8
  spec.name = 'activejob-traceable'
7
9
  spec.version = ActiveJob::Traceable::VERSION
8
- spec.authors = ['Dmytro Zakharov']
9
- spec.email = ['dmytro@qonto.eu']
10
+ spec.authors = ['Qonto team']
11
+ spec.email = ['backend@qonto.eu']
10
12
 
11
- spec.summary = %q{Patches ActiveJob to add trace_id attribute.}
13
+ spec.summary = 'Patches ActiveJob to add trace_id attribute.'
12
14
  spec.homepage = 'https://github.com/qonto/activejob-traceable'
13
15
  spec.license = 'MIT'
14
16
 
@@ -22,8 +24,8 @@ Gem::Specification.new do |spec|
22
24
  spec.add_dependency 'activejob'
23
25
  spec.add_dependency 'activesupport'
24
26
 
25
- spec.add_development_dependency 'bundler', '~> 1.16'
26
- spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'bundler', '~> 2.0'
27
28
  spec.add_development_dependency 'pry'
28
- spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'rake', '~> 12.3'
30
+ spec.add_development_dependency 'rspec', '~> 3.8'
29
31
  end
@@ -1,23 +1,51 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/lazy_load_hooks'
2
4
 
3
5
  ActiveSupport.on_load :active_job do
4
6
  require 'activejob/traceable/traceable'
5
7
  require 'activejob/traceable/logging_patch'
6
- ActiveJob::Base.send(:include, ActiveJob::Traceable)
7
- ActiveJob::Base.send(:include, ActiveJob::Traceable::LoggingPatch)
8
+ ActiveJob::Base.public_send(:include, ActiveJob::Traceable)
9
+ ActiveJob::Base.public_send(:include, ActiveJob::Traceable::LoggingPatch)
8
10
  end
9
11
 
10
12
  module ActiveJob
11
13
  module Traceable
12
- extend self
14
+ module_function
15
+
16
+ def actor_id_setter=(lambda)
17
+ raise 'Actor ID setter should be callable' unless lambda.respond_to?(:call)
18
+
19
+ @actor_id_setter = lambda
20
+ end
21
+
22
+ def actor_id_getter=(lambda)
23
+ raise 'Actor ID getter should be callable' unless lambda.respond_to?(:call)
24
+
25
+ @actor_id_getter = lambda
26
+ end
27
+
28
+ def correlation_id_setter=(lambda)
29
+ raise 'Correlation ID setter should be callable' unless lambda.respond_to?(:call)
30
+
31
+ @correlation_id_setter = lambda
32
+ end
33
+
34
+ def correlation_id_getter=(lambda)
35
+ raise 'Correlation ID getter should be callable' unless lambda.respond_to?(:call)
36
+
37
+ @correlation_id_getter = lambda
38
+ end
13
39
 
14
40
  def trace_id_setter=(lambda)
15
41
  raise 'Trace ID setter should be callable' unless lambda.respond_to?(:call)
42
+
16
43
  @trace_id_setter = lambda
17
44
  end
18
45
 
19
46
  def trace_id_getter=(lambda)
20
47
  raise 'Trace ID getter should be callable' unless lambda.respond_to?(:call)
48
+
21
49
  @trace_id_getter = lambda
22
50
  end
23
51
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveJob
2
4
  module Traceable
3
5
  module LoggingPatch
@@ -7,16 +9,25 @@ module ActiveJob
7
9
  private
8
10
 
9
11
  def tag_logger(*tags)
10
- if ActiveJob::Traceable.trace_id_getter.respond_to?(:call)
11
- tags << ActiveJob::Traceable.trace_id_getter.call # add custom tag
12
- end
12
+ tags = append_custom_tags(tags)
13
+
13
14
  if logger.respond_to?(:tagged)
14
- tags.unshift "ActiveJob" unless logger_tagged_by_active_job?
15
+ tags.unshift 'ActiveJob' unless logger_tagged_by_active_job?
15
16
  logger.tagged(*tags) { yield }
16
17
  else
17
18
  yield
18
19
  end
19
20
  end
21
+
22
+ def append_custom_tags(tags)
23
+ traceable = ActiveJob::Traceable
24
+
25
+ tags << traceable.actor_id_getter.call if traceable.actor_id_getter.respond_to?(:call)
26
+ tags << traceable.correlation_id_getter.call if traceable.correlation_id_getter.respond_to?(:call)
27
+ tags << traceable.trace_id_getter.call if traceable.trace_id_getter.respond_to?(:call)
28
+
29
+ tags
30
+ end
20
31
  end
21
32
  end
22
33
  end
@@ -1,33 +1,44 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveJob
2
4
  module Traceable
3
5
  extend ActiveSupport::Concern
4
6
 
5
7
  included do
6
- attr_accessor :trace_id
8
+ attr_accessor :actor_id, :correlation_id, :trace_id
7
9
 
8
10
  def initialize(*arguments)
9
11
  super(*arguments)
10
- if Traceable.trace_id_getter.respond_to?(:call)
11
- @trace_id = Traceable.trace_id_getter.call
12
- end
12
+
13
+ @actor_id = Traceable.actor_id_getter.call if Traceable.actor_id_getter.respond_to?(:call)
14
+ @correlation_id = Traceable.correlation_id_getter.call if Traceable.correlation_id_getter.respond_to?(:call)
15
+ @trace_id = Traceable.trace_id_getter.call if Traceable.trace_id_getter.respond_to?(:call)
13
16
  end
14
17
 
15
18
  def serialize
16
- super.merge!(trace_id: trace_id)
19
+ super.merge!(
20
+ actor_id: actor_id,
21
+ correlation_id: correlation_id,
22
+ trace_id: trace_id,
23
+ )
17
24
  end
18
25
 
19
26
  def deserialize(job_data)
20
27
  super(job_data)
28
+
29
+ self.actor_id = job_data['actor_id']
30
+ self.correlation_id = job_data['correlation_id']
21
31
  self.trace_id = job_data['trace_id']
22
- if Traceable.trace_id_setter.respond_to?(:call)
23
- Traceable.trace_id_setter.call(self.trace_id)
24
- end
32
+
33
+ Traceable.actor_id_setter.call(actor_id) if Traceable.actor_id_setter.respond_to?(:call)
34
+ Traceable.correlation_id_setter.call(correlation_id) if Traceable.correlation_id_setter.respond_to?(:call)
35
+ Traceable.trace_id_setter.call(trace_id) if Traceable.trace_id_setter.respond_to?(:call)
25
36
  end
26
37
  end
27
38
 
28
39
  class << self
29
- attr_accessor :trace_id_getter
30
- attr_accessor :trace_id_setter
40
+ attr_accessor :actor_id_getter, :correlation_id_getter, :trace_id_getter
41
+ attr_accessor :actor_id_setter, :correlation_id_setter, :trace_id_setter
31
42
  end
32
43
  end
33
44
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveJob
2
4
  module Traceable
3
- VERSION = '0.1.0'.freeze
5
+ VERSION = '0.2.0'
4
6
  end
5
7
  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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Dmytro Zakharov
7
+ - Qonto team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-03 00:00:00.000000000 Z
11
+ date: 2019-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -44,59 +44,59 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.16'
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.16'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '12.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '12.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.0'
89
+ version: '3.8'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.0'
96
+ version: '3.8'
97
97
  description:
98
98
  email:
99
- - dmytro@qonto.eu
99
+ - backend@qonto.eu
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []