sidekiq-logstash 2.0.3 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +10 -5
- data/.github/workflows/publish.yml +3 -5
- data/.rubocop.yml +1 -1
- data/Gemfile +5 -2
- data/README.md +5 -0
- data/lib/sidekiq/logging/argument_filter.rb +1 -1
- data/lib/sidekiq/logging/shared.rb +1 -1
- data/lib/sidekiq/logstash/configuration.rb +1 -1
- data/lib/sidekiq/logstash/version.rb +1 -1
- data/lib/sidekiq/logstash.rb +11 -13
- data/sidekiq-logstash.gemspec +2 -7
- metadata +7 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09e505554a5ed16d442f68da725e3647a2cd77d12f36897a657d54ff8a3cb8b8'
|
4
|
+
data.tar.gz: 917723b1952886cfd29070668209e254198d2d9f3d2807aabbd10af0a5b46608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f168b77deb49ef0eab0ff308ddfc8539d2b9cf6e1756373ed82301b5a7d5ac063ebefb16fd8a9941b4f0995066b5afcae54b8c9abf6caa1eea190841ca192c15
|
7
|
+
data.tar.gz: ad292af73bb01ef763a1e171d1e960c345775db0128f2d904f32ee7166a654a33c065f2d0838c766e2f4057d5a84c054051c21e1945e1728ebb92bfbbb7018ce
|
data/.github/workflows/ci.yml
CHANGED
@@ -10,16 +10,20 @@ env:
|
|
10
10
|
GIT_COMMIT_SHA: ${{ github.sha }}
|
11
11
|
GIT_BRANCH: ${{ github.ref }}
|
12
12
|
|
13
|
+
permissions:
|
14
|
+
contents: read # to fetch code (actions/checkout)
|
15
|
+
|
13
16
|
jobs:
|
14
17
|
linting:
|
15
18
|
runs-on: ubuntu-latest
|
16
19
|
|
17
20
|
steps:
|
18
|
-
- uses: actions/checkout@
|
21
|
+
- uses: actions/checkout@v4
|
19
22
|
- uses: ruby/setup-ruby@v1
|
20
23
|
with:
|
21
|
-
ruby-version:
|
22
|
-
bundler-cache: true
|
24
|
+
ruby-version: 3
|
25
|
+
bundler-cache: true
|
26
|
+
|
23
27
|
- name: Run rubocop
|
24
28
|
run: bundle exec rubocop --format progress
|
25
29
|
build:
|
@@ -27,13 +31,14 @@ jobs:
|
|
27
31
|
runs-on: ubuntu-latest
|
28
32
|
strategy:
|
29
33
|
matrix:
|
30
|
-
ruby: ['
|
34
|
+
ruby: ['3.0', '3.1', '3.2', '3.3']
|
31
35
|
|
32
36
|
steps:
|
33
|
-
- uses: actions/checkout@
|
37
|
+
- uses: actions/checkout@v4
|
34
38
|
- uses: ruby/setup-ruby@v1
|
35
39
|
with:
|
36
40
|
ruby-version: ${{ matrix.ruby }}
|
37
41
|
bundler-cache: true
|
42
|
+
|
38
43
|
- name: Run tests
|
39
44
|
run: bundle exec rake
|
@@ -10,12 +10,10 @@ jobs:
|
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
|
12
12
|
steps:
|
13
|
-
- uses: actions/checkout@
|
14
|
-
|
15
|
-
- name: Set up Ruby 2.7
|
16
|
-
uses: actions/setup-ruby@v1
|
13
|
+
- uses: actions/checkout@v4
|
14
|
+
- uses: actions/setup-ruby@v1
|
17
15
|
with:
|
18
|
-
ruby-version:
|
16
|
+
ruby-version: 3
|
19
17
|
|
20
18
|
- name: Publish to RubyGems
|
21
19
|
run: |
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -33,6 +33,7 @@ Sidekiq::Logstash turns your [Sidekiq](https://github.com/mperham/sidekiq) log i
|
|
33
33
|
Add one of the following lines to your application's Gemfile:
|
34
34
|
|
35
35
|
```ruby
|
36
|
+
gem 'sidekiq-logstash', '~> 3.0' # Sidekiq 7
|
36
37
|
gem 'sidekiq-logstash', '~> 2.0' # Sidekiq 6
|
37
38
|
gem 'sidekiq-logstash', '< 2' # Sidekiq 5 or older
|
38
39
|
```
|
@@ -78,6 +79,10 @@ Sidekiq::Logstash.configure do |config|
|
|
78
79
|
config.custom_options = lambda do |payload|
|
79
80
|
payload['my_custom_field'] = 'my_custom_value'
|
80
81
|
end
|
82
|
+
|
83
|
+
# by default, sidekiq-logstash removes the default error handler
|
84
|
+
# to keep it, simply set this to true
|
85
|
+
config.keep_default_error_handler = true
|
81
86
|
end
|
82
87
|
```
|
83
88
|
|
@@ -130,7 +130,7 @@ module Sidekiq
|
|
130
130
|
def deep_stringify!(args)
|
131
131
|
case args
|
132
132
|
when Hash
|
133
|
-
args.
|
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 = []
|
data/lib/sidekiq/logstash.rb
CHANGED
@@ -4,7 +4,6 @@ require 'sidekiq/logstash/configuration'
|
|
4
4
|
require 'sidekiq/logstash/version'
|
5
5
|
require 'sidekiq/logging/logstash_formatter'
|
6
6
|
require 'sidekiq/logging/argument_filter'
|
7
|
-
require 'sidekiq/logstash_job_logger'
|
8
7
|
|
9
8
|
module Sidekiq
|
10
9
|
# Main level module for Sidekiq::Logstash.
|
@@ -22,21 +21,20 @@ module Sidekiq
|
|
22
21
|
def self.setup(_opts = {})
|
23
22
|
# Calls Sidekiq.configure_server to inject logics
|
24
23
|
Sidekiq.configure_server do |config|
|
25
|
-
|
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) }
|
29
|
-
end
|
24
|
+
require 'sidekiq/logstash_job_logger'
|
30
25
|
|
31
|
-
#
|
32
|
-
|
33
|
-
|
34
|
-
config
|
35
|
-
|
36
|
-
#
|
37
|
-
config.
|
26
|
+
# Remove default, noisy error handler,
|
27
|
+
# unless LogStash.configuration.keep_default_error_handler is set to true
|
28
|
+
unless configuration.keep_default_error_handler
|
29
|
+
config.error_handlers.delete(Sidekiq::Config::ERROR_HANDLER)
|
30
|
+
# Insert a no-op error handler to prevent Sidekiq from logging to STDOUT
|
31
|
+
# because of empty error_handlers (see link).
|
32
|
+
# https://github.com/mperham/sidekiq/blob/02153c17360e712d9a94c08406fe7c057c4d7635/lib/sidekiq/config.rb#L258
|
33
|
+
config.error_handlers << proc {}
|
38
34
|
end
|
39
35
|
|
36
|
+
# Add logstash support
|
37
|
+
config[:job_logger] = Sidekiq::LogstashJobLogger
|
40
38
|
# Set custom formatter for Sidekiq logger
|
41
39
|
config.logger.formatter = Sidekiq::Logging::LogstashFormatter.new
|
42
40
|
end
|
data/sidekiq-logstash.gemspec
CHANGED
@@ -19,15 +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 = '>=
|
22
|
+
spec.required_ruby_version = '>= 3.0.0'
|
23
23
|
|
24
24
|
spec.add_dependency 'logstash-event', '~> 1.2'
|
25
|
-
spec.
|
25
|
+
spec.add_dependency 'sidekiq', '~> 7.0'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'factory_bot', '~> 6.1'
|
28
|
-
spec.add_development_dependency 'rake', '>= 10'
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
-
spec.add_development_dependency 'rspec-json_expectations', '~> 2.1.0'
|
31
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
|
32
27
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
33
28
|
end
|
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:
|
4
|
+
version: 3.1.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:
|
11
|
+
date: 2024-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-event
|
@@ -26,94 +26,18 @@ dependencies:
|
|
26
26
|
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sidekiq
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '6.0'
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '7'
|
37
|
-
type: :runtime
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '6.0'
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '7'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: factory_bot
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '6.1'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '6.1'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: rake
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '10'
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '10'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rspec
|
77
29
|
requirement: !ruby/object:Gem::Requirement
|
78
30
|
requirements:
|
79
31
|
- - "~>"
|
80
32
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
82
|
-
type: :
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '3.0'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: rspec-json_expectations
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 2.1.0
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 2.1.0
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: rubocop-performance
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '1.5'
|
110
|
-
type: :development
|
33
|
+
version: '7.0'
|
34
|
+
type: :runtime
|
111
35
|
prerelease: false
|
112
36
|
version_requirements: !ruby/object:Gem::Requirement
|
113
37
|
requirements:
|
114
38
|
- - "~>"
|
115
39
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
40
|
+
version: '7.0'
|
117
41
|
description: 'Sidekiq::Logstash turns your Sidekiq log into an organised, aggregated,
|
118
42
|
JSON-syntax log ready to be sent to a logstash server.
|
119
43
|
|
@@ -157,14 +81,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
81
|
requirements:
|
158
82
|
- - ">="
|
159
83
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
84
|
+
version: 3.0.0
|
161
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
86
|
requirements:
|
163
87
|
- - ">="
|
164
88
|
- !ruby/object:Gem::Version
|
165
89
|
version: '0'
|
166
90
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
91
|
+
rubygems_version: 3.4.19
|
168
92
|
signing_key:
|
169
93
|
specification_version: 4
|
170
94
|
summary: Logstash plugin for Sidekiq
|