sidekiq-haron 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/sidekiq/haron/exception_logger.rb +1 -7
- data/lib/sidekiq/haron/formatter.rb +4 -4
- data/lib/sidekiq/haron/job_logger.rb +2 -2
- data/lib/sidekiq/haron/storage.rb +3 -3
- data/lib/sidekiq/haron/transmitter.rb +2 -2
- data/lib/sidekiq/haron/version.rb +1 -1
- data/lib/sidekiq/haron.rb +7 -5
- data/sidekiq-haron.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d3333333dc4a17fed71b555a3d39dabe3d6486a477fa8e4f0cdd0a34e5f3ff
|
4
|
+
data.tar.gz: eccedd18665a12f4d714549f1fcccdec0dd391751a8b57005f5a727b3819d8f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a535916068755b1e71faeb264ad8852bade96e7f0f2de18f69e169e61d1e1eb46b1972ed37120b06e5dea7a0ac9450f76fb0086396dbbaa37c3cb6611037b7ea
|
7
|
+
data.tar.gz: 7dbb770b1b2d2b233dc0ef5126ee806c34294e59334de7e5a7fb6503033a53ec21b23cf2dbb0f3e1ef08e55119d6adc055c9329bb8735e0ab6c86426652247d8
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
Аdd to project class
|
23
|
+
Аdd to project class inheriting from `Sidekiq::Haron::Transmitter` like this:
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
class HaronTransmitter < Sidekiq::Haron::Transmitter
|
@@ -53,9 +53,9 @@ Sidekiq::Haron.install(HaronTransmitter)
|
|
53
53
|
Now all your sidekiq log have `Current.parent_request_id` value as tag and log job args too:
|
54
54
|
|
55
55
|
```
|
56
|
-
2020-01-14T14:22:09.035Z
|
57
|
-
2020-01-14T14:22:09.035Z
|
58
|
-
2020-01-14T14:22:09.041Z
|
56
|
+
2020-01-14T14:22:09.035Z class=TestWorker jid=940645f14b345b3b4031d1cc I: [4f445354] with args [1, {"q"=>2}]
|
57
|
+
2020-01-14T14:22:09.035Z class=TestWorker jid=940645f14b345b3b4031d1cc I: [4f445354] start
|
58
|
+
2020-01-14T14:22:09.041Z class=TestWorker jid=940645f14b345b3b4031d1cc elapsed=0.006 I: [4f445354] done
|
59
59
|
```
|
60
60
|
|
61
61
|
## Development
|
@@ -1,12 +1,6 @@
|
|
1
|
-
require 'sidekiq/exception_handler'
|
2
1
|
module Sidekiq
|
3
2
|
module Haron
|
4
|
-
class ExceptionLogger
|
5
|
-
|
6
|
-
def self.install
|
7
|
-
Sidekiq.error_handlers.delete_if{|eh| eh.is_a? Sidekiq::ExceptionHandler::Logger }
|
8
|
-
Sidekiq.error_handlers.unshift Sidekiq::Haron::ExceptionLogger.new
|
9
|
-
end
|
3
|
+
class ExceptionLogger
|
10
4
|
|
11
5
|
def call(ex, ctxHash)
|
12
6
|
jid = ctxHash.present? && ctxHash[:job]['jid']
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Sidekiq
|
2
2
|
module Haron
|
3
|
-
class Formatter < Sidekiq::
|
4
|
-
|
3
|
+
class Formatter < Sidekiq::Logger::Formatters::Pretty
|
4
|
+
|
5
5
|
def call(severity, time, program_name, message)
|
6
|
-
result = "#{
|
6
|
+
result = "#{format_context} #{severity.to_s[0]}: #{message}\n"
|
7
7
|
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
8
8
|
result
|
9
9
|
else
|
10
10
|
"#{time.utc.iso8601(3)} #{result}"
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -5,12 +5,12 @@ module Sidekiq
|
|
5
5
|
|
6
6
|
def call(item, queue)
|
7
7
|
Sidekiq::Haron.transmitter.load(item['jid'])
|
8
|
-
Sidekiq::Haron.transmitter.tagged do
|
8
|
+
Sidekiq::Haron.transmitter.tagged do
|
9
9
|
Sidekiq.logger.info("with args #{item['args'].inspect}")
|
10
10
|
super
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -8,9 +8,9 @@ module Sidekiq
|
|
8
8
|
|
9
9
|
def store_for_id(id, data, redis_pool=nil)
|
10
10
|
redis_connection(redis_pool) do |conn|
|
11
|
-
conn.multi do
|
12
|
-
|
13
|
-
|
11
|
+
conn.multi do |pipeline|
|
12
|
+
pipeline.hmset key(id), *(data.to_a.flatten(1))
|
13
|
+
pipeline.expire key(id), DEFAULT_EXPIRY
|
14
14
|
end[0]
|
15
15
|
end
|
16
16
|
end
|
data/lib/sidekiq/haron.rb
CHANGED
@@ -12,11 +12,11 @@ module Sidekiq
|
|
12
12
|
module Haron
|
13
13
|
|
14
14
|
def self.transmitter
|
15
|
-
Sidekiq
|
15
|
+
Sidekiq[:transmitter]
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.transmitter= v
|
19
|
-
Sidekiq
|
19
|
+
Sidekiq[:transmitter] = v
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.install transmitter_class
|
@@ -32,10 +32,12 @@ module Sidekiq
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.set_loggers
|
35
|
-
Sidekiq.
|
36
|
-
|
35
|
+
Sidekiq.configure_server do |config|
|
36
|
+
config.log_formatter = Sidekiq::Haron::Formatter.new
|
37
|
+
end
|
38
|
+
Sidekiq[:job_logger] = Sidekiq::Haron::JobLogger
|
39
|
+
Sidekiq[:error_handlers] << Sidekiq::Haron::ExceptionLogger.new
|
37
40
|
Sidekiq.logger = ActiveSupport::TaggedLogging.new(Sidekiq.logger)
|
38
|
-
Sidekiq::Haron::ExceptionLogger.install
|
39
41
|
end
|
40
42
|
|
41
43
|
def self.configure_client_middleware(sidekiq_config)
|
data/sidekiq-haron.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_dependency "sidekiq", "~> 5.
|
26
|
+
spec.add_dependency "sidekiq", "~> 6.5.12"
|
27
27
|
spec.add_dependency "rails"
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.17"
|
29
29
|
spec.add_development_dependency "rake", "~> 12.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-haron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serg F
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.5.12
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.5.12
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +124,7 @@ homepage: https://github.com/Rnd-Soft/sidekiq-haron
|
|
124
124
|
licenses:
|
125
125
|
- MIT
|
126
126
|
metadata: {}
|
127
|
-
post_install_message:
|
127
|
+
post_install_message:
|
128
128
|
rdoc_options: []
|
129
129
|
require_paths:
|
130
130
|
- lib
|
@@ -139,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
143
|
-
signing_key:
|
142
|
+
rubygems_version: 3.3.26
|
143
|
+
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Transfer some data to sidekiq job and can tag sidekiq logs
|
146
146
|
test_files: []
|