jcw 0.2.3 → 0.2.4

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: 2b1e12954a296bbc3e7413110a7b151fe38c0d422e156cebbd5ae7157bbe111b
4
- data.tar.gz: '00488dffa129ca3c4a2b45fb3f8f947f1dec9b4310b8a900813426afa397fc92'
3
+ metadata.gz: e7f97935444bb8d0285e96565c731f99e65df848573cc0257eb041dc90d3bf8b
4
+ data.tar.gz: a119efdd207f9ebf9965cb8a62fab5c8e3541db7535e5649a14808f02a0683f9
5
5
  SHA512:
6
- metadata.gz: 61b7221435873848d3bb19e0e9ca30157c127601633fb4ca129fbc150fe5da98f2013bdc334139c455801fcb7fe90db8fb47809a4b1bba86f4e58d8ab1034162
7
- data.tar.gz: 1140c437317341c6836f196711496f9dedb0e0959571d7f882c9750f6c690ca3026dd807916fd958c7a7628587cea5e985da1b55631f9b4fcbc15691a8cf7e49
6
+ metadata.gz: b70cfaecfca2e89dda7c95eb471d0169afc9deb286fb42481f36663db89c07850ef8c7d5185b7cb47658313e812d01328f95d8f68a88a8e4db6b0b37007f5a2f
7
+ data.tar.gz: 14ca08c194b0c3c710670f7b9e77f6584a269366167a3ec4bfadaf042c7fa0e60776981af46b2dff7af69ed0a96fafd116585fbfa1a2721624225d9aeec399c1
data/.rubocop.yml CHANGED
@@ -11,6 +11,9 @@ RSpec/EmptyLineAfterHook:
11
11
  Naming/RescuedExceptionsVariableName:
12
12
  Enabled: false
13
13
 
14
+ Style/CaseEquality:
15
+ Enabled: false
16
+
14
17
  Style/HashConversion:
15
18
  Exclude:
16
19
  - spec/**/*_spec.rb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jcw (0.2.3)
4
+ jcw (0.2.4)
5
5
  activesupport (>= 5.0, < 7.0.0)
6
6
  gruf (~> 2.10)
7
7
  httprb-opentracing (~> 0.4.0)
@@ -49,7 +49,7 @@ GEM
49
49
  ffi-compiler (1.0.1)
50
50
  ffi (>= 1.0.0)
51
51
  rake
52
- google-protobuf (3.19.2)
52
+ google-protobuf (3.19.3)
53
53
  googleapis-common-protos-types (1.3.0)
54
54
  google-protobuf (~> 3.14)
55
55
  grpc (1.41.0)
@@ -215,4 +215,4 @@ DEPENDENCIES
215
215
  simplecov-lcov
216
216
 
217
217
  BUNDLED WITH
218
- 2.2.15
218
+ 2.2.27
data/README.md CHANGED
@@ -42,7 +42,7 @@ UDP Sender(default):
42
42
  hostname: "custom-hostname",
43
43
  custom_tag: "custom-tag-value",
44
44
  }
45
- config.rack_ignore_paths = %w[/api/test]
45
+ config.rack_ignore_path_patterns = ["/api/test", %r{/sidekiq}]
46
46
  end
47
47
 
48
48
  # Set middleware for wrapping all requests
@@ -60,7 +60,7 @@ TCP Sender:
60
60
  hostname: "custom-hostname",
61
61
  custom_tag: "custom-tag-value",
62
62
  }
63
- config.rack_ignore_paths = %w[/api/test]
63
+ config.rack_ignore_path_patterns = ["/api/test", %r{/sidekiq}]
64
64
  end
65
65
 
66
66
  # Set middleware for wrapping all requests
data/lib/jcw/config.rb CHANGED
@@ -9,7 +9,7 @@ module JCW
9
9
  :flush_interval,
10
10
  :tags,
11
11
  :grpc_ignore_methods,
12
- :rack_ignore_paths
12
+ :rack_ignore_path_patterns
13
13
 
14
14
  def enabled
15
15
  @enabled ||= false
@@ -41,8 +41,8 @@ module JCW
41
41
  @grpc_ignore_methods ||= []
42
42
  end
43
43
 
44
- def rack_ignore_paths
45
- @rack_ignore_paths ||= []
44
+ def rack_ignore_path_patterns
45
+ @rack_ignore_path_patterns ||= []
46
46
  end
47
47
  end
48
48
  end
@@ -15,7 +15,7 @@ module JCW
15
15
  # is called.
16
16
  # @param on_start_span [Proc, nil] A callback evaluated after a new span is created.
17
17
  # @param on_finish_span [Proc, nil] A callback evaluated after a span is finished.
18
- # @param ignore_paths [Array<Class>] An array of paths to be skiped by the tracer.
18
+ # @param ignore_path_patterns [Array<Class>] An array of paths to be skiped by the tracer.
19
19
  # @param errors [Array<Class>] An array of error classes to be captured by the tracer
20
20
  # as errors. Errors are **not** muted by the middleware, they're re-raised afterwards.
21
21
  def initialize(app, # rubocop:disable Metrics/ParameterLists
@@ -23,7 +23,7 @@ module JCW
23
23
  on_start_span: nil,
24
24
  on_finish_span: nil,
25
25
  trust_incoming_span: true,
26
- ignore_paths: Wrapper.config.rack_ignore_paths,
26
+ ignore_path_patterns: Wrapper.config.rack_ignore_path_patterns,
27
27
  errors: [StandardError])
28
28
  @app = app
29
29
  @tracer = tracer
@@ -31,14 +31,15 @@ module JCW
31
31
  @on_finish_span = on_finish_span
32
32
  @trust_incoming_span = trust_incoming_span
33
33
  @errors = errors
34
- @ignore_paths = ignore_paths
34
+ @ignore_path_patterns = ignore_path_patterns
35
35
  end
36
36
 
37
37
  def call(env)
38
38
  method = env[REQUEST_METHOD]
39
39
  path = env[REQUEST_PATH]
40
40
  url = env[REQUEST_URI]
41
- return @app.call(env) if @ignore_paths.include?(path)
41
+
42
+ return @app.call(env) if @ignore_path_patterns.find { |pattern| pattern === path }
42
43
 
43
44
  set_extract_env(env)
44
45
  context = @tracer.extract(OpenTracing::FORMAT_TEXT_MAP, env) if @trust_incoming_span
data/lib/jcw/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JCW
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jcw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Starovojtov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-11 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport