opentracing-instrumentation 0.2.0 → 0.2.1

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: 8879aaa3c59021d2ca28453df552f98e0d15b6770c12cf16aea578438e332013
4
- data.tar.gz: '087834496d2097fe029aa460470651447f9d2bba325e95b3fd3a8cc873d137d4'
3
+ metadata.gz: 2f1bf3278054a44d66c91a009850b1fc7f7386285ca95158743fc16e79669ae3
4
+ data.tar.gz: 2f45d267611e2d6a4c376c1955a8010d7f9f6830ec1679c63b8a4fc7bb627a0e
5
5
  SHA512:
6
- metadata.gz: c5c204ba373e323a0ac3ba96d1ba81a4be53ef537890304a30cb7f701ffc5ce0a989f5ac7eeb2b5c1850908d606d090dc61bff08f3ee49090a6d656b3071597d
7
- data.tar.gz: fa54f0a639bf05536ba3d0fd0771c75497ba619dde142c8e1d5575fd5a782f0eb7ff0e33cc5148cd4338d6a526dc9893ade3d13c95e0f45455a00f93c0786862
6
+ metadata.gz: 9dc425554c43ee11d6f54d40831260a30925ba4c6b28c317c84e69873932ed34119f570698892f4239b847708209e0b82ee497e4a70dd44e859bbae87865576a
7
+ data.tar.gz: bd5ab5e2025f81c62b303915d272c29ab9260fc7ecfcf74abbbb2db3f2e49f12ea52f3876b7a81c3e132c3bc934baad6de01a1d221502e76ea78beac418dbee1
data/.BUNDLER_VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.2.15
data/.gitlab-ci.yml CHANGED
@@ -4,6 +4,8 @@ stages:
4
4
 
5
5
  .test_shared: &test_shared
6
6
  before_script:
7
+ # check version should be called before any bundle calls
8
+ - ./bin/check_gemfile_lock
7
9
  - apk add --update
8
10
  git
9
11
  ruby-dev
@@ -14,7 +16,6 @@ stages:
14
16
 
15
17
  - export BUNDLE_PATH=vendor/
16
18
  - bundler install --jobs $(nproc)
17
- - bundler update
18
19
 
19
20
  - ruby --version
20
21
  - gem --version
@@ -71,7 +72,7 @@ publish:
71
72
  - export SOURCE_GEM_VERSION=$(cat GEM_VERSION)
72
73
  - test ${CI_COMMIT_TAG} == v${SOURCE_GEM_VERSION}
73
74
 
74
- - export GEM_FILE_NAME="multiprotocol_thrift_rack_app-${CI_COMMIT_TAG}.gem"
75
+ - export GEM_FILE_NAME="opentracing-instrumentation-${CI_COMMIT_TAG}.gem"
75
76
  - export GEM_FILE_PATH="pkg/${GEM_FILE_NAME}"
76
77
 
77
78
  - mkdir -p pkg/
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  require:
2
+ - rubocop-rake
2
3
  - rubocop-rspec
3
4
  - rubocop-performance
4
5
  - rubocop-thread_safety
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.2.1
2
+ - Truncate arrays into mongo command sanitazer
3
+
1
4
  ## 0.2.0
2
5
  - Drop support ruby 2.4
3
6
  - Support ruby 3.0
data/GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/Gemfile.lock CHANGED
@@ -18,72 +18,83 @@ GIT
18
18
  PATH
19
19
  remote: .
20
20
  specs:
21
- opentracing-instrumentation (0.1.18)
21
+ opentracing-instrumentation (0.2.1)
22
22
  json
23
23
  opentracing (~> 0.5.0)
24
24
 
25
25
  GEM
26
26
  remote: https://rubygems.org/
27
27
  specs:
28
- activesupport (5.2.4.2)
28
+ activesupport (5.2.6)
29
29
  concurrent-ruby (~> 1.0, >= 1.0.2)
30
30
  i18n (>= 0.7, < 2)
31
31
  minitest (~> 5.1)
32
32
  tzinfo (~> 1.1)
33
- amq-protocol (2.3.0)
33
+ amq-protocol (2.3.2)
34
34
  ast (2.4.2)
35
- bson (4.8.0)
35
+ bson (4.12.0)
36
36
  bunny (2.14.4)
37
37
  amq-protocol (~> 2.3, >= 2.3.0)
38
- byebug (11.1.1)
38
+ byebug (11.1.3)
39
39
  carrot-top (0.0.7)
40
40
  json
41
- coderay (1.1.2)
42
- concurrent-ruby (1.1.6)
43
- diff-lcs (1.3)
44
- faraday (1.0.1)
41
+ coderay (1.1.3)
42
+ concurrent-ruby (1.1.8)
43
+ diff-lcs (1.4.4)
44
+ faraday (1.4.2)
45
+ faraday-em_http (~> 1.0)
46
+ faraday-em_synchrony (~> 1.0)
47
+ faraday-excon (~> 1.1)
48
+ faraday-net_http (~> 1.0)
49
+ faraday-net_http_persistent (~> 1.1)
45
50
  multipart-post (>= 1.2, < 3)
51
+ ruby2_keywords (>= 0.0.4)
52
+ faraday-em_http (1.0.0)
53
+ faraday-em_synchrony (1.0.0)
54
+ faraday-excon (1.1.0)
55
+ faraday-net_http (1.0.1)
56
+ faraday-net_http_persistent (1.1.0)
46
57
  hutch (0.26.0)
47
58
  activesupport (>= 4.2, < 6)
48
59
  bunny (>= 2.12, < 2.15)
49
60
  carrot-top (~> 0.0.7)
50
61
  multi_json (~> 1.12)
51
- i18n (1.8.2)
62
+ i18n (1.8.10)
52
63
  concurrent-ruby (~> 1.0)
53
- json (2.3.0)
54
- method_source (0.9.2)
64
+ json (2.5.1)
65
+ method_source (1.0.0)
55
66
  minitest (5.14.4)
56
- multi_json (1.14.1)
67
+ multi_json (1.15.0)
57
68
  multipart-post (2.1.1)
58
69
  opentracing (0.5.0)
59
70
  parallel (1.20.1)
60
71
  parser (3.0.1.1)
61
72
  ast (~> 2.4.1)
62
- pry (0.12.2)
63
- coderay (~> 1.1.0)
64
- method_source (~> 0.9.0)
65
- pry-byebug (3.8.0)
73
+ pry (0.13.1)
74
+ coderay (~> 1.1)
75
+ method_source (~> 1.0)
76
+ pry-byebug (3.9.0)
66
77
  byebug (~> 11.0)
67
- pry (~> 0.10)
68
- rack (2.2.2)
78
+ pry (~> 0.13.0)
79
+ rack (2.2.3)
69
80
  rainbow (3.0.0)
70
- rake (13.0.1)
81
+ rake (13.0.3)
71
82
  redis (3.3.5)
72
83
  regexp_parser (2.1.1)
73
84
  rexml (3.2.5)
74
- rspec (3.9.0)
75
- rspec-core (~> 3.9.0)
76
- rspec-expectations (~> 3.9.0)
77
- rspec-mocks (~> 3.9.0)
78
- rspec-core (3.9.1)
79
- rspec-support (~> 3.9.1)
80
- rspec-expectations (3.9.0)
85
+ rspec (3.10.0)
86
+ rspec-core (~> 3.10.0)
87
+ rspec-expectations (~> 3.10.0)
88
+ rspec-mocks (~> 3.10.0)
89
+ rspec-core (3.10.1)
90
+ rspec-support (~> 3.10.0)
91
+ rspec-expectations (3.10.1)
81
92
  diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.9.0)
83
- rspec-mocks (3.9.1)
93
+ rspec-support (~> 3.10.0)
94
+ rspec-mocks (3.10.2)
84
95
  diff-lcs (>= 1.2.0, < 2.0)
85
- rspec-support (~> 3.9.0)
86
- rspec-support (3.9.2)
96
+ rspec-support (~> 3.10.0)
97
+ rspec-support (3.10.2)
87
98
  rubocop (1.15.0)
88
99
  parallel (~> 1.10)
89
100
  parser (>= 3.0.0.0)
@@ -98,15 +109,18 @@ GEM
98
109
  rubocop-performance (1.11.3)
99
110
  rubocop (>= 1.7.0, < 2.0)
100
111
  rubocop-ast (>= 0.4.0)
112
+ rubocop-rake (0.5.1)
113
+ rubocop
101
114
  rubocop-rspec (2.3.0)
102
115
  rubocop (~> 1.0)
103
116
  rubocop-ast (>= 1.1.0)
104
117
  rubocop-thread_safety (0.4.2)
105
118
  rubocop (>= 0.53.0)
106
119
  ruby-progressbar (1.11.0)
120
+ ruby2_keywords (0.0.4)
107
121
  thread_safe (0.3.6)
108
- thrift (0.11.0.0)
109
- tzinfo (1.2.6)
122
+ thrift (0.14.1)
123
+ tzinfo (1.2.9)
110
124
  thread_safe (~> 0.1)
111
125
  unicode-display_width (2.0.0)
112
126
 
@@ -116,9 +130,9 @@ PLATFORMS
116
130
  DEPENDENCIES
117
131
  activesupport (~> 5.2)
118
132
  bson (~> 4.0)
119
- bundler (= 2.1.4)
133
+ bundler (= 2.2.15)
120
134
  bunny (~> 2.0)
121
- faraday (~> 1.0.1)
135
+ faraday (~> 1.0)
122
136
  hutch (~> 0.26.0)
123
137
  opentracing-instrumentation!
124
138
  pry-byebug (~> 3.8)
@@ -128,11 +142,12 @@ DEPENDENCIES
128
142
  rspec (~> 3.0)
129
143
  rubocop (~> 1.15.0)
130
144
  rubocop-performance (~> 1.11.3)
145
+ rubocop-rake (~> 0.5.1)
131
146
  rubocop-rspec (~> 2.3.0)
132
147
  rubocop-thread_safety (~> 0.4.2)
133
148
  test-tracer!
134
- thrift (~> 0.11.0)
149
+ thrift (~> 0.14.1)
135
150
  tracing-matchers!
136
151
 
137
152
  BUNDLED WITH
138
- 2.1.4
153
+ 2.2.15
@@ -0,0 +1,18 @@
1
+ #!/bin/sh
2
+
3
+ GEMFILE_LOCK_PATH=Gemfile.lock
4
+ GEM_VERSION_PATH=GEM_VERSION
5
+
6
+ gem_versio=$(cat "${GEM_VERSION_PATH}")
7
+
8
+ expected_line="opentracing-instrumentation (${gem_versio})"
9
+
10
+ grep "${expected_line}" "${GEMFILE_LOCK_PATH}" > /dev/null
11
+ exit_code=$?
12
+
13
+ if [ $exit_code != 0 ]; then
14
+ echo "Update gem version ${GEMFILE_LOCK_PATH} and commit it" > /dev/stderr
15
+ exit 1
16
+ else
17
+ echo "Gem version into ${GEMFILE_LOCK_PATH} valid" > /dev/stdout
18
+ fi
@@ -21,11 +21,13 @@ module OpenTracing
21
21
  def initialize(
22
22
  safety_argument_checker: SampleSafetyArgumentChecker.new,
23
23
  safe_classes: DEFAULT_SAFE_CLASSES,
24
+ max_array_size: 4,
24
25
  exclude_keys: DEFAULT_EXCLUDE_KEYS
25
26
  )
26
27
  super()
27
28
  @safety_argument_checker = safety_argument_checker
28
29
  @safe_classes = safe_classes
30
+ @max_array_size = max_array_size
29
31
  @exclude_keys = exclude_keys
30
32
  end
31
33
 
@@ -41,6 +43,7 @@ module OpenTracing
41
43
 
42
44
  attr_reader :safe_classes,
43
45
  :exclude_keys,
46
+ :max_array_size,
44
47
  :safety_argument_checker
45
48
 
46
49
  OBJECT_ID_PLACEHOLDER = '$oid'
@@ -58,18 +61,22 @@ module OpenTracing
58
61
  end
59
62
  end
60
63
 
64
+ # rubocop:disable Metrics/MethodLength
61
65
  def sanitaze_simple(value)
62
66
  case value
63
67
  when BSON::ObjectId
64
68
  OBJECT_ID_PLACEHOLDER
65
69
  when String
66
70
  STRING_PLACEHOLDER
71
+ when ArrayItemPlaceholder
72
+ value.to_s
67
73
  when *safe_classes
68
74
  value
69
75
  else
70
76
  PLACEHOLDER
71
77
  end
72
78
  end
79
+ # rubocop:enable Metrics/MethodLength
73
80
 
74
81
  def sanitaze_hash(hash)
75
82
  hash.map do |(key, value)|
@@ -86,11 +93,34 @@ module OpenTracing
86
93
  end.to_h
87
94
  end
88
95
 
96
+ # Placehoder for skipped array items
97
+ class ArrayItemPlaceholder
98
+ def initialize(skipped_items)
99
+ @skipped_items = skipped_items
100
+ end
101
+
102
+ def to_s
103
+ "SKIPPED #{@skipped_items} ITEMS"
104
+ end
105
+ end
106
+
89
107
  def sanitaze_array(array)
90
- array.map do |value|
108
+ if max_array_size&.positive? && array.size > max_array_size
109
+ array_with_placeholder(array)
110
+ else
111
+ array
112
+ end.map do |value|
91
113
  sanitaze_value(value)
92
114
  end
93
115
  end
116
+
117
+ def array_with_placeholder(array)
118
+ prefix_size = (max_array_size / 2).ceil
119
+ suffix_size = max_array_size - prefix_size
120
+ array[0...prefix_size] \
121
+ + [ArrayItemPlaceholder.new(array.size - max_array_size)] \
122
+ + array[-suffix_size..-1]
123
+ end
94
124
  end
95
125
  end
96
126
  end
@@ -11,7 +11,8 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ['job@fedorenko-d.ru']
12
12
 
13
13
  spec.summary = 'OpenTracing instrumentation for popular ruby libraries'
14
- spec.description = 'OpenTracing instrumentation for Mongo, Faraday, Rack and PORO'
14
+ spec.description = 'OpenTracing instrumentation for Bunny, Faraday, Hutch, Mongo, PORO, ' \
15
+ 'Rack, Sidekiq, Sinatra, Thrift'
15
16
  spec.homepage = 'https://gitlab.com/c0va23/ruby-opentracing-instrumentation.'
16
17
  spec.license = 'MIT'
17
18
 
@@ -33,7 +34,7 @@ Gem::Specification.new do |spec|
33
34
  spec.add_development_dependency 'bson', '~> 4.0'
34
35
  spec.add_development_dependency 'bundler', File.read('.BUNDLER_VERSION').strip
35
36
  spec.add_development_dependency 'bunny', '~> 2.0'
36
- spec.add_development_dependency 'faraday', '~> 1.0.1'
37
+ spec.add_development_dependency 'faraday', '~> 1.0'
37
38
  spec.add_development_dependency 'hutch', '~> 0.26.0'
38
39
  spec.add_development_dependency 'rack', '~> 2.2.2'
39
40
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -41,7 +42,8 @@ Gem::Specification.new do |spec|
41
42
  spec.add_development_dependency 'rspec', '~> 3.0'
42
43
  spec.add_development_dependency 'rubocop', '~> 1.15.0'
43
44
  spec.add_development_dependency 'rubocop-performance', '~> 1.11.3'
45
+ spec.add_development_dependency 'rubocop-rake', '~> 0.5.1'
44
46
  spec.add_development_dependency 'rubocop-rspec', '~> 2.3.0'
45
47
  spec.add_development_dependency 'rubocop-thread_safety', '~> 0.4.2'
46
- spec.add_development_dependency 'thrift', '~> 0.11.0'
48
+ spec.add_development_dependency 'thrift', '~> 0.14.1'
47
49
  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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fedorenko Dmitrij
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-22 00:00:00.000000000 Z
11
+ date: 2021-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 2.1.4
75
+ version: 2.2.15
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: 2.1.4
82
+ version: 2.2.15
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bunny
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.1
103
+ version: '1.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.1
110
+ version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: hutch
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 1.11.3
209
+ - !ruby/object:Gem::Dependency
210
+ name: rubocop-rake
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 0.5.1
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 0.5.1
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: rubocop-rspec
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -240,15 +254,16 @@ dependencies:
240
254
  requirements:
241
255
  - - "~>"
242
256
  - !ruby/object:Gem::Version
243
- version: 0.11.0
257
+ version: 0.14.1
244
258
  type: :development
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
262
  - - "~>"
249
263
  - !ruby/object:Gem::Version
250
- version: 0.11.0
251
- description: OpenTracing instrumentation for Mongo, Faraday, Rack and PORO
264
+ version: 0.14.1
265
+ description: OpenTracing instrumentation for Bunny, Faraday, Hutch, Mongo, PORO, Rack,
266
+ Sidekiq, Sinatra, Thrift
252
267
  email:
253
268
  - job@fedorenko-d.ru
254
269
  executables: []
@@ -268,6 +283,7 @@ files:
268
283
  - LICENSE.txt
269
284
  - README.md
270
285
  - Rakefile
286
+ - bin/check_gemfile_lock
271
287
  - bin/console
272
288
  - bin/setup
273
289
  - lib/opentracing/instrumentation.rb