sidekiq-logstash 2.0.3 → 3.0.0

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: d03d5f447dd18e3fc0989f94b3b79f74cd73a7ec671bafa8655660e90b8ad11b
4
- data.tar.gz: c413e9d405d115d5731190e96dc35eaa853f32a19bf28f32c6556c301333d5d6
3
+ metadata.gz: de10e32b59ccde04045df621855e1257e4290003c08686be06ac2691ff3eadce
4
+ data.tar.gz: 2ae07b48658b5f72bef3fa621eef3f57eac826fbd976dcadd3ec2df6e4c74549
5
5
  SHA512:
6
- metadata.gz: 2e793efdad13027f544ca878392232c26db9f599f32f1d2aaf7c59ba60e94db318923bd6b754d35b0ff098ab748bba9a0a33a8e28c02895d849a76804bed047c
7
- data.tar.gz: 93a5f3dc665067f09615d3958dfd69c192ca743d07fe444aec389859f72eae6229f60f60ced92799962bfdbabba917d8c2c63d5c8f8bec5dcbc9ce583d40b172
6
+ metadata.gz: 85183e59824a52c5f8394ba5d45e0ca7a8df48dc6b1f668c2c0e880102713a3f7678e19f141172a78909bf030186210d644101b93684edf2f513ef31dceee3e0
7
+ data.tar.gz: a56567d1a6715345e11bc5292188bf20a7c3db4b11f433071def26f9a39e95a366e14ffbceaf537f56021211c0dc2607fc275b6bcf0a46da5fdef2a6154449ae
@@ -19,7 +19,7 @@ jobs:
19
19
  - uses: ruby/setup-ruby@v1
20
20
  with:
21
21
  ruby-version: 2.7
22
- bundler-cache: true
22
+ bundler-cache: true
23
23
  - name: Run rubocop
24
24
  run: bundle exec rubocop --format progress
25
25
  build:
@@ -27,7 +27,7 @@ jobs:
27
27
  runs-on: ubuntu-latest
28
28
  strategy:
29
29
  matrix:
30
- ruby: ['2.6', '2.7', '3.0', '3.1']
30
+ ruby: ['2.7', '3.0', '3.1']
31
31
 
32
32
  steps:
33
33
  - uses: actions/checkout@v2
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@ AllCops:
7
7
  DisplayCopNames: true
8
8
  DisplayStyleGuide: true
9
9
  NewCops: enable
10
- TargetRubyVersion: 2.5
10
+ TargetRubyVersion: 2.7
11
11
 
12
12
  Metrics/BlockLength:
13
13
  Exclude:
data/Gemfile CHANGED
@@ -3,6 +3,3 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
-
7
- gem 'rubocop-rake'
8
- gem 'rubocop-rspec'
data/README.md CHANGED
@@ -78,6 +78,10 @@ Sidekiq::Logstash.configure do |config|
78
78
  config.custom_options = lambda do |payload|
79
79
  payload['my_custom_field'] = 'my_custom_value'
80
80
  end
81
+
82
+ # by default, sidekiq-logstash removes the default error handler
83
+ # to keep it, simply set this to true
84
+ config.keep_default_error_handler = true
81
85
  end
82
86
  ```
83
87
 
@@ -130,7 +130,7 @@ module Sidekiq
130
130
  def deep_stringify!(args)
131
131
  case args
132
132
  when Hash
133
- args.map { |key, value| [deep_stringify!(key), deep_stringify!(value)] }.to_h
133
+ args.to_h { |key, value| [deep_stringify!(key), deep_stringify!(value)] }
134
134
  when Array
135
135
  args.map! { |val| deep_stringify!(val) }
136
136
  else
@@ -4,7 +4,7 @@ module Sidekiq
4
4
  module Logstash
5
5
  # Class that allows to configure the gem behaviour.
6
6
  class Configuration
7
- attr_accessor :custom_options, :filter_args, :job_start_log
7
+ attr_accessor :custom_options, :filter_args, :job_start_log, :keep_default_error_handler
8
8
 
9
9
  def initialize
10
10
  @filter_args = []
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Logstash
5
- VERSION = '2.0.3'
5
+ VERSION = '3.0.0'
6
6
  end
7
7
  end
@@ -22,21 +22,18 @@ module Sidekiq
22
22
  def self.setup(_opts = {})
23
23
  # Calls Sidekiq.configure_server to inject logics
24
24
  Sidekiq.configure_server do |config|
25
- if defined?(Sidekiq::ExceptionHandler::Logger)
26
- # Remove default Sidekiq error_handler that logs errors
27
- # NOTE: this only exists up until Sidekiq 6.4.x
28
- config.error_handlers.delete_if { |h| h.is_a?(Sidekiq::ExceptionHandler::Logger) }
25
+ # Remove default, noisy error handler,
26
+ # unless LogStash.configuration.keep_default_error_handler is set to true
27
+ unless configuration.keep_default_error_handler
28
+ config.error_handlers.delete(Sidekiq::Config::ERROR_HANDLER)
29
+ # Insert a no-op error handler to prevent Sidekiq from logging to STDOUT
30
+ # because of empty error_handlers (see link).
31
+ # https://github.com/mperham/sidekiq/blob/02153c17360e712d9a94c08406fe7c057c4d7635/lib/sidekiq/config.rb#L258
32
+ config.error_handlers << proc {}
29
33
  end
30
34
 
31
35
  # Add logstash support
32
- if config.respond_to?(:[]=)
33
- # Only available from Sidekiq 6.5
34
- config[:job_logger] = Sidekiq::LogstashJobLogger
35
- else
36
- # This is deprecated and will be removed in Sidekiq 7.0
37
- config.options[:job_logger] = Sidekiq::LogstashJobLogger
38
- end
39
-
36
+ config[:job_logger] = Sidekiq::LogstashJobLogger
40
37
  # Set custom formatter for Sidekiq logger
41
38
  config.logger.formatter = Sidekiq::Logging::LogstashFormatter.new
42
39
  end
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
21
  spec.require_paths = ['lib']
22
- spec.required_ruby_version = '>= 2.5.0'
22
+ spec.required_ruby_version = '>= 2.7.0'
23
23
 
24
24
  spec.add_dependency 'logstash-event', '~> 1.2'
25
- spec.add_runtime_dependency 'sidekiq', '>= 6.0', '<7'
25
+ spec.add_dependency 'sidekiq', '~> 7.0'
26
26
 
27
27
  spec.add_development_dependency 'factory_bot', '~> 6.1'
28
28
  spec.add_development_dependency 'rake', '>= 10'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-logstash
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Giuffrida
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-12 00:00:00.000000000 Z
11
+ date: 2022-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-event
@@ -28,22 +28,16 @@ dependencies:
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '6.0'
34
- - - "<"
31
+ - - "~>"
35
32
  - !ruby/object:Gem::Version
36
- version: '7'
33
+ version: '7.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '6.0'
44
- - - "<"
38
+ - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '7'
40
+ version: '7.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: factory_bot
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -157,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
151
  requirements:
158
152
  - - ">="
159
153
  - !ruby/object:Gem::Version
160
- version: 2.5.0
154
+ version: 2.7.0
161
155
  required_rubygems_version: !ruby/object:Gem::Requirement
162
156
  requirements:
163
157
  - - ">="