business_flow 0.19.5 → 0.19.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -22
- data/lib/business_flow/instrument.rb +15 -1
- data/lib/business_flow/instrumented_executor.rb +3 -12
- data/lib/business_flow/instrumented_step_executor.rb +7 -1
- data/lib/business_flow/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: e3d7a4e0a69860a84583948ad6d3b6189619629e2b6b8a3dac4bdc10c5467c8d
|
4
|
+
data.tar.gz: b3ae0a3456b06ad06826cd55f1c0a7b0c1f5d2789d5d4514b8a155603fb28388
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08d17ede87236b175510b8e08d9f09815e77f24dd922d3abd5bbd22f447a6a6abbde9f7a3ab36158b70a9dbde879c0ab7949524c39da2162dd66cf16149c87cd'
|
7
|
+
data.tar.gz: e738a183b1fc48a0632eb4db0f6c3212b1e270d1e36f3fcdee7bbe1b1c2e0c6655de48036f66f25e7aa289f7b46cbe561e7f9b524534a05e1b9c836719a7e937
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
business_flow (0.19.
|
4
|
+
business_flow (0.19.6)
|
5
5
|
activemodel (>= 4.2, < 8)
|
6
6
|
activesupport (>= 4.2, < 8)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (7.1.
|
12
|
-
activesupport (= 7.1.
|
13
|
-
activesupport (7.1.
|
11
|
+
activemodel (7.1.4)
|
12
|
+
activesupport (= 7.1.4)
|
13
|
+
activesupport (7.1.4)
|
14
14
|
base64
|
15
15
|
bigdecimal
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -22,48 +22,48 @@ GEM
|
|
22
22
|
tzinfo (~> 2.0)
|
23
23
|
ast (2.4.2)
|
24
24
|
base64 (0.2.0)
|
25
|
-
bigdecimal (3.1.
|
25
|
+
bigdecimal (3.1.8)
|
26
26
|
coderay (1.1.3)
|
27
|
-
concurrent-ruby (1.
|
27
|
+
concurrent-ruby (1.3.4)
|
28
28
|
connection_pool (2.4.1)
|
29
29
|
diff-lcs (1.5.1)
|
30
|
-
docile (1.4.
|
30
|
+
docile (1.4.1)
|
31
31
|
drb (2.2.1)
|
32
|
-
i18n (1.14.
|
32
|
+
i18n (1.14.6)
|
33
33
|
concurrent-ruby (~> 1.0)
|
34
34
|
json (2.7.2)
|
35
35
|
kwalify (0.7.2)
|
36
36
|
language_server-protocol (3.17.0.3)
|
37
37
|
method_source (1.1.0)
|
38
|
-
minitest (5.
|
38
|
+
minitest (5.25.1)
|
39
39
|
mutex_m (0.2.0)
|
40
|
-
parallel (1.
|
40
|
+
parallel (1.26.3)
|
41
41
|
parser (3.2.2.4)
|
42
42
|
ast (~> 2.4.1)
|
43
43
|
racc
|
44
44
|
pry (0.14.2)
|
45
45
|
coderay (~> 1.1)
|
46
46
|
method_source (~> 1.0)
|
47
|
-
racc (1.
|
47
|
+
racc (1.8.1)
|
48
48
|
rainbow (3.1.1)
|
49
49
|
rake (13.2.1)
|
50
50
|
reek (6.1.4)
|
51
51
|
kwalify (~> 0.7.0)
|
52
52
|
parser (~> 3.2.0)
|
53
53
|
rainbow (>= 2.0, < 4.0)
|
54
|
-
regexp_parser (2.9.
|
54
|
+
regexp_parser (2.9.2)
|
55
55
|
retryable (3.0.5)
|
56
|
-
rexml (3.
|
56
|
+
rexml (3.3.7)
|
57
57
|
rspec (3.13.0)
|
58
58
|
rspec-core (~> 3.13.0)
|
59
59
|
rspec-expectations (~> 3.13.0)
|
60
60
|
rspec-mocks (~> 3.13.0)
|
61
|
-
rspec-core (3.13.
|
61
|
+
rspec-core (3.13.1)
|
62
62
|
rspec-support (~> 3.13.0)
|
63
|
-
rspec-expectations (3.13.
|
63
|
+
rspec-expectations (3.13.3)
|
64
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
65
|
rspec-support (~> 3.13.0)
|
66
|
-
rspec-mocks (3.13.
|
66
|
+
rspec-mocks (3.13.1)
|
67
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
68
|
rspec-support (~> 3.13.0)
|
69
69
|
rspec-support (3.13.1)
|
@@ -80,28 +80,28 @@ GEM
|
|
80
80
|
unicode-display_width (>= 2.4.0, < 3.0)
|
81
81
|
rubocop-ast (1.30.0)
|
82
82
|
parser (>= 3.2.1.0)
|
83
|
-
rubocop-capybara (2.
|
83
|
+
rubocop-capybara (2.21.0)
|
84
84
|
rubocop (~> 1.41)
|
85
|
-
rubocop-factory_bot (2.
|
85
|
+
rubocop-factory_bot (2.26.0)
|
86
86
|
rubocop (~> 1.41)
|
87
87
|
rubocop-rspec (2.29.2)
|
88
88
|
rubocop (~> 1.40)
|
89
89
|
rubocop-capybara (~> 2.17)
|
90
90
|
rubocop-factory_bot (~> 2.22)
|
91
91
|
rubocop-rspec_rails (~> 2.28)
|
92
|
-
rubocop-rspec_rails (2.
|
92
|
+
rubocop-rspec_rails (2.29.0)
|
93
93
|
rubocop (~> 1.40)
|
94
94
|
ruby-progressbar (1.13.0)
|
95
95
|
simplecov (0.22.0)
|
96
96
|
docile (~> 1.1)
|
97
97
|
simplecov-html (~> 0.11)
|
98
98
|
simplecov_json_formatter (~> 0.1)
|
99
|
-
simplecov-html (0.
|
99
|
+
simplecov-html (0.13.1)
|
100
100
|
simplecov_json_formatter (0.1.4)
|
101
|
-
timecop (0.9.
|
101
|
+
timecop (0.9.10)
|
102
102
|
tzinfo (2.0.6)
|
103
103
|
concurrent-ruby (~> 1.0)
|
104
|
-
unicode-display_width (2.
|
104
|
+
unicode-display_width (2.6.0)
|
105
105
|
|
106
106
|
PLATFORMS
|
107
107
|
ruby
|
@@ -13,8 +13,22 @@ module BusinessFlow
|
|
13
13
|
module ClassMethods
|
14
14
|
INSTRUMENTATION_PREFIX = 'business_flow'
|
15
15
|
|
16
|
+
def with_instrument_payload(payload = nil, opts = {}, &blk)
|
17
|
+
if payload.is_a?(Hash)
|
18
|
+
@payload = Step.new(Callable.new(proc { payload }), {})
|
19
|
+
elsif payload || blk
|
20
|
+
@payload = Step.new(Callable.new(payload || blk), { default_output: :instrument_payload}.merge(opts))
|
21
|
+
else
|
22
|
+
@payload ||= Step.new(Callable.new(proc { {} }), opts)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.instrument_payload(flow)
|
27
|
+
catch(:halt_step) { flow.class.with_instrument_payload.call(flow)&.merge_into(flow) }
|
28
|
+
end
|
29
|
+
|
16
30
|
def instrument(name, flow)
|
17
|
-
payload = { flow: flow }
|
31
|
+
payload = { flow: flow }.merge(ClassMethods.instrument_payload(flow))
|
18
32
|
ActiveSupport::Notifications.instrument(
|
19
33
|
"#{INSTRUMENTATION_PREFIX}.#{name}.#{instrumentation_name}", payload
|
20
34
|
) do
|
@@ -4,12 +4,11 @@ module BusinessFlow
|
|
4
4
|
# Fire ActiveSupport events for every step that's run and on errors
|
5
5
|
class InstrumentedExecutor < DefaultStepExecutor
|
6
6
|
def call
|
7
|
-
|
8
|
-
|
9
|
-
ActiveSupport::Notifications.instrument(name, payload) do
|
7
|
+
f_class = flow.class
|
8
|
+
f_class.instrument('flow', flow) do |payload|
|
10
9
|
super
|
10
|
+
notify_errors(f_class.event_name, payload)
|
11
11
|
end
|
12
|
-
notify_errors(name, payload)
|
13
12
|
end
|
14
13
|
|
15
14
|
protected
|
@@ -19,13 +18,5 @@ module BusinessFlow
|
|
19
18
|
|
20
19
|
ActiveSupport::Notifications.publish("#{name}.error", payload)
|
21
20
|
end
|
22
|
-
|
23
|
-
def flow_name
|
24
|
-
@flow_name ||= flow.class.instrumentation_name
|
25
|
-
end
|
26
|
-
|
27
|
-
def flow_event_name
|
28
|
-
@flow_event_name ||= flow.class.event_name
|
29
|
-
end
|
30
21
|
end
|
31
22
|
end
|
@@ -7,7 +7,7 @@ module BusinessFlow
|
|
7
7
|
|
8
8
|
def execute_step(step)
|
9
9
|
i_name = event_name(step)
|
10
|
-
i_payload = { flow: flow, step: step }
|
10
|
+
i_payload = { flow: flow, step: step }.merge(::BusinessFlow::Instrument::ClassMethods.instrument_payload(flow))
|
11
11
|
ActiveSupport::Notifications.instrument(i_name, i_payload) do |payload|
|
12
12
|
payload[:step_result] = super
|
13
13
|
end
|
@@ -21,5 +21,11 @@ module BusinessFlow
|
|
21
21
|
def event_name(step)
|
22
22
|
"business_flow.step.#{step_event_name(step)}"
|
23
23
|
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def flow_name
|
28
|
+
@flow_name ||= flow.class.instrumentation_name
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: business_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Scarborough
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|