opera 0.3.4 → 0.3.5
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/.gitignore +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/opera/operation/base.rb +1 -1
- data/lib/opera/operation/config.rb +4 -6
- data/lib/opera/operation/instructions/executors/step.rb +1 -1
- data/lib/opera/operation/instrumentation.rb +15 -13
- data/lib/opera/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: bc70b6a1f69200a0b37229ed04034c3bcc12c66c94dc9a5d0c066ceaf9971cdb
|
4
|
+
data.tar.gz: 7b369d14c001a62b07d91c43efd52e23ddb65749aae9a1a19e3cf49105e190a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ae2fc0df4e8969215716157838de9ce26b4bfc66007c2c62b57e7a2ffd0b918be8974b7513f28d81c14593b41ecff1d573e4fca2ea4502761b9306abc273b4b
|
7
|
+
data.tar.gz: 6abf3cb52cd156ae7e458772842e62b1dbca0e2f93dde5af040e68c8c426c75088ae2ef2f11a164372a6d7535e4a0f6516643a78955a67f5040bf53f81ed6485
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/opera/operation/base.rb
CHANGED
@@ -33,7 +33,7 @@ module Opera
|
|
33
33
|
def call(args = {})
|
34
34
|
operation = new(params: args.fetch(:params, {}), dependencies: args.fetch(:dependencies, {}))
|
35
35
|
executor = Executor.new(operation)
|
36
|
-
Instrumentation.new(
|
36
|
+
Instrumentation.new(operation).instrument(name: self.name, level: :operation) do
|
37
37
|
executor.evaluate_instructions(instructions)
|
38
38
|
end
|
39
39
|
executor.result
|
@@ -6,8 +6,8 @@ module Opera
|
|
6
6
|
DEVELOPMENT_MODE = :development
|
7
7
|
PRODUCTION_MODE = :production
|
8
8
|
|
9
|
-
attr_accessor :transaction_class, :transaction_method, :transaction_options,
|
10
|
-
:
|
9
|
+
attr_accessor :transaction_class, :transaction_method, :transaction_options, :instrumentation_class,
|
10
|
+
:mode, :reporter
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
@transaction_class = self.class.transaction_class
|
@@ -15,8 +15,6 @@ module Opera
|
|
15
15
|
@transaction_options = self.class.transaction_options
|
16
16
|
|
17
17
|
@instrumentation_class = self.class.instrumentation_class
|
18
|
-
@instrumentation_method = self.class.instrumentation_method || :instrument
|
19
|
-
@instrumentation_options = self.class.instrumentation_options || {}
|
20
18
|
|
21
19
|
@mode = self.class.mode || DEVELOPMENT_MODE
|
22
20
|
@reporter = custom_reporter || self.class.reporter
|
@@ -41,8 +39,8 @@ module Opera
|
|
41
39
|
end
|
42
40
|
|
43
41
|
class << self
|
44
|
-
attr_accessor :transaction_class, :transaction_method, :transaction_options,
|
45
|
-
:
|
42
|
+
attr_accessor :transaction_class, :transaction_method, :transaction_options, :instrumentation_class,
|
43
|
+
:mode, :reporter
|
46
44
|
|
47
45
|
def configure
|
48
46
|
yield self
|
@@ -8,7 +8,7 @@ module Opera
|
|
8
8
|
def call(instruction)
|
9
9
|
method = instruction[:method]
|
10
10
|
|
11
|
-
Instrumentation.new(
|
11
|
+
Instrumentation.new(operation).instrument(name: "##{method}", level: :step) do
|
12
12
|
operation.result.add_execution(method) unless production_mode?
|
13
13
|
operation.send(method)
|
14
14
|
end
|
@@ -3,29 +3,31 @@
|
|
3
3
|
module Opera
|
4
4
|
module Operation
|
5
5
|
class Instrumentation
|
6
|
-
|
6
|
+
class Base
|
7
|
+
def self.instrument(operation, name:, level: :operation)
|
8
|
+
raise NotImplementedError, "#{self.class} must implement #instrument"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :operation
|
7
13
|
|
8
|
-
def initialize(
|
9
|
-
@
|
14
|
+
def initialize(operation)
|
15
|
+
@operation = operation
|
10
16
|
end
|
11
17
|
|
12
18
|
def instrument(name:, level: :operation)
|
13
19
|
return yield if !instrumentation_enabled?
|
14
|
-
return yield if
|
20
|
+
return yield if !instrumentation_compatible?
|
15
21
|
|
16
|
-
instrumentation_class.
|
22
|
+
instrumentation_class.instrument(operation, name: name, level: level) do
|
17
23
|
yield
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
21
27
|
private
|
22
28
|
|
23
|
-
def
|
24
|
-
config
|
25
|
-
end
|
26
|
-
|
27
|
-
def instrumentation_method
|
28
|
-
config.instrumentation_method
|
29
|
+
def config
|
30
|
+
operation.config
|
29
31
|
end
|
30
32
|
|
31
33
|
def instrumentation_class
|
@@ -36,8 +38,8 @@ module Opera
|
|
36
38
|
!!config.instrumentation_class
|
37
39
|
end
|
38
40
|
|
39
|
-
def
|
40
|
-
|
41
|
+
def instrumentation_compatible?
|
42
|
+
config.instrumentation_class.ancestors.include?(Opera::Operation::Instrumentation::Base)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
data/lib/opera/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ProFinda Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-validation
|