opentracing-instrumentation 0.1.17 → 0.1.18
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27eec95422a0be40785c0b5369e6a40a5de45399b263577824159b33fc681e1e
|
4
|
+
data.tar.gz: 8ad8c27eca4ba30b3995b771322904b9d11d034e2e07b4571d989042a51ef927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adbff7a43740935e4c5f6286f8ea1be501b6b6c9f8dce9b9cdc320da329b3c7bc29bb5697fed07ab178d28f2d8e85125474081dd8e1ecb0cf8562dc73fbfde58
|
7
|
+
data.tar.gz: 38618d53fc21fca58c21e9bee8b1fad7620f94604bab2470bb9d6df3dfdbdff56d89c335ab1b402f9ac8a3472dbf75b989548f07d2395a0e316ca04c0b537d6b
|
data/GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.18
|
data/Gemfile.lock
CHANGED
@@ -9,6 +9,8 @@ module OpenTracing
|
|
9
9
|
'opentracing/instrumentation/mongo/operation_name_builder'
|
10
10
|
autoload :TraceSubscriber, 'opentracing/instrumentation/mongo/trace_subscriber'
|
11
11
|
autoload :QuerySanitazer, 'opentracing/instrumentation/mongo/query_sanitazer'
|
12
|
+
autoload :SampleSafetyArgumentChecker,
|
13
|
+
'opentracing/instrumentation/mongo/sample_safety_argument_checker'
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -19,9 +19,11 @@ module OpenTracing
|
|
19
19
|
DEFAULT_EXCLUDE_KEYS = %w[lsid].freeze
|
20
20
|
|
21
21
|
def initialize(
|
22
|
+
safety_argument_checker: SampleSafetyArgumentChecker.new,
|
22
23
|
safe_classes: DEFAULT_SAFE_CLASSES,
|
23
24
|
exclude_keys: DEFAULT_EXCLUDE_KEYS
|
24
25
|
)
|
26
|
+
@safety_argument_checker = safety_argument_checker
|
25
27
|
@safe_classes = safe_classes
|
26
28
|
@exclude_keys = exclude_keys
|
27
29
|
end
|
@@ -38,6 +40,7 @@ module OpenTracing
|
|
38
40
|
|
39
41
|
attr_reader :safe_classes
|
40
42
|
attr_reader :exclude_keys
|
43
|
+
attr_reader :safety_argument_checker
|
41
44
|
|
42
45
|
OBJECT_ID_PLACEHOLDER = '$oid'
|
43
46
|
STRING_PLACEHOLDER = '$string'
|
@@ -68,9 +71,18 @@ module OpenTracing
|
|
68
71
|
end
|
69
72
|
|
70
73
|
def sanitaze_hash(hash)
|
71
|
-
hash.
|
72
|
-
|
73
|
-
|
74
|
+
hash.map do |(key, value)|
|
75
|
+
# TODO: pass command name.
|
76
|
+
# TODO: recursive build path to key
|
77
|
+
safe_value =
|
78
|
+
if safety_argument_checker.argument_safe?(nil, key, value)
|
79
|
+
value
|
80
|
+
else
|
81
|
+
sanitaze_value(value)
|
82
|
+
end
|
83
|
+
|
84
|
+
[key, safe_value]
|
85
|
+
end.to_h
|
74
86
|
end
|
75
87
|
|
76
88
|
def sanitaze_array(array)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenTracing
|
4
|
+
module Instrumentation
|
5
|
+
module Mongo
|
6
|
+
# SampleSafetyArgumentChecker check argument to safety
|
7
|
+
# Draft implementation
|
8
|
+
class SampleSafetyArgumentChecker
|
9
|
+
DEFAULT_SAFE_ARGUMENTS = [
|
10
|
+
'$readPreference',
|
11
|
+
'$clusterTime',
|
12
|
+
].freeze
|
13
|
+
|
14
|
+
attr_reader :safe_arguments
|
15
|
+
|
16
|
+
def initialize(safe_arguments: DEFAULT_SAFE_ARGUMENTS)
|
17
|
+
@safe_arguments = safe_arguments
|
18
|
+
end
|
19
|
+
|
20
|
+
# check
|
21
|
+
#
|
22
|
+
# @return (TrueClass, FalseClass) `true`, if argument safe and not
|
23
|
+
# not should be cleaned. Otherwise return `false``.
|
24
|
+
def argument_safe?(_command_name, argument_path, _argument_value)
|
25
|
+
safe_arguments.include?(argument_path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentracing-instrumentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fedorenko Dmitrij
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -299,6 +299,7 @@ files:
|
|
299
299
|
- lib/opentracing/instrumentation/mongo/direct_sanitazer.rb
|
300
300
|
- lib/opentracing/instrumentation/mongo/operation_name_builder.rb
|
301
301
|
- lib/opentracing/instrumentation/mongo/query_sanitazer.rb
|
302
|
+
- lib/opentracing/instrumentation/mongo/sample_safety_argument_checker.rb
|
302
303
|
- lib/opentracing/instrumentation/mongo/trace_subscriber.rb
|
303
304
|
- lib/opentracing/instrumentation/object_wrapper.rb
|
304
305
|
- lib/opentracing/instrumentation/rack.rb
|