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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5923fbd63614f0aa5187a2f36b9f41672ca2187fd5d88bf65a88d62e6327ab04
4
- data.tar.gz: 3764c82c4b824bfdd88b4c8f294183de5d6d44a77649eb03bce8fbfb2088a3c2
3
+ metadata.gz: 60d3333333dc4a17fed71b555a3d39dabe3d6486a477fa8e4f0cdd0a34e5f3ff
4
+ data.tar.gz: eccedd18665a12f4d714549f1fcccdec0dd391751a8b57005f5a727b3819d8f8
5
5
  SHA512:
6
- metadata.gz: 38d80470789efa5020c68231b285fe4e980ab53ff6eee82b638b3183c7eef5dc887e924da63ddd86c4db317f1d1c564bc25b085e7b521f6ed820637badfa99c8
7
- data.tar.gz: 9a35b3807b96f9d5e40a04d4441a4dbf00630399401d90794c88670fe53a01f9b7d7a673dfd443756e24241a29c3955b245672154c1b740eb4289944ecd6a4aa
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 inheriting from `Sidekiq::Haron::Transmitter` like this:
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 TestWorker JID-940645f14b345b3b4031d1cc I: [4f445354] with args [1, {"q"=>2}]
57
- 2020-01-14T14:22:09.035Z TestWorker JID-940645f14b345b3b4031d1cc I: [4f445354] start
58
- 2020-01-14T14:22:09.041Z TestWorker JID-940645f14b345b3b4031d1cc I: [4f445354] done: 0.006 sec
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 < Sidekiq::ExceptionHandler::Logger
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::Logging::Pretty
4
-
3
+ class Formatter < Sidekiq::Logger::Formatters::Pretty
4
+
5
5
  def call(severity, time, program_name, message)
6
- result = "#{context} #{severity.to_s[0]}: #{message}\n"
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
- conn.hmset key(id), *(data.to_a.flatten(1))
13
- conn.expire key(id), DEFAULT_EXPIRY
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
@@ -23,8 +23,8 @@ module Sidekiq
23
23
  end
24
24
 
25
25
  def tagged
26
- ::Rails.logger.tagged(tags) do
27
- Sidekiq.logger.tagged(tags) do
26
+ ::Rails.logger.tagged(tags) do
27
+ Sidekiq.logger.tagged(tags) do
28
28
  yield
29
29
  end
30
30
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Haron
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  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.options[:transmitter]
15
+ Sidekiq[:transmitter]
16
16
  end
17
17
 
18
18
  def self.transmitter= v
19
- Sidekiq.options[:transmitter] = v
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.options[:job_logger] = Sidekiq::Haron::JobLogger
36
- Sidekiq.logger.formatter = Sidekiq::Haron::Formatter.new
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)
@@ -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.2"
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.6
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: 2020-07-28 00:00:00.000000000 Z
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: '5.2'
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: '5.2'
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.0.8
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: []