raygun-apm-sidekiq 1.1.2 → 1.1.3

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: 983d18c44dad05861403a92a3bdea42df25f39e312cd4a441137a2cdee76c1f2
4
- data.tar.gz: 8f706e3487836cd6a8953f5c6c8fa436fafba79ff9297ede0af20d85db9c6b95
3
+ metadata.gz: 8eb60a5d5debbf6e3bdde1ca25277c32a3c4c73338534b286f8454ef1710123e
4
+ data.tar.gz: 7d5332c206419c65d64350b4c96ad9b036ee700e3545135013c1e25eb4125252
5
5
  SHA512:
6
- metadata.gz: 1e5822a24b86b23059fceb1c8053f47b218f35cef606cf748b6eb747a98ad55f6c684292912bd72e51e9165d5ae6334637e94f335d5dec860814d354edbb1140
7
- data.tar.gz: f59cd1281bea3d057668cf710576438e5f8f17ac3621b646521534430bd81ba1d1d9d85a84ca87886a5a347f73772b5c4eb53d9b62b2fe9ce48831a023c0e12a
6
+ metadata.gz: 63827daad6dfae46726984fcea163ab7fbc93b69e26fe4dad55e33983dbcc9964de5f38a98a4f1048263a538f8bf8926af40c77c9318e8e61420523f96e8b2cd
7
+ data.tar.gz: 7bf386f072d834afb4fe51c112b95f601e435133b607f192b5b8cfeb909698e4cb42077fc4baf53badbf1eed2054eb8e6d7a9a042b11fa5648bbb4b35fa8e337
@@ -4,22 +4,18 @@ require 'sidekiq/processor'
4
4
  module Raygun
5
5
  module Apm
6
6
  module Sidekiq
7
- module Hook
7
+ class Middleware
8
8
  def self.finalize(tracer)
9
9
  proc {tracer.process_ended}
10
10
  end
11
11
 
12
12
  def initialize(*args)
13
- super
14
- @mutex = Mutex.new
15
- @mutex.synchronize do
13
+ Raygun::Apm::Tracer.synchronize do
16
14
  @tracer = Raygun::Apm::Tracer.instance || init_tracer
17
15
  end
18
16
  end
19
17
 
20
- def process(work)
21
- job_hash = ::Sidekiq.load_json(work.job)
22
- queue = work.queue_name
18
+ def call(worker, job_hash, queue)
23
19
  # Can be nil if we had a fatal error
24
20
  if @tracer
25
21
  @worker_started = @tracer.now
@@ -28,7 +24,7 @@ module Raygun
28
24
  exception = nil
29
25
  Ruby_APM_profiler_trace do
30
26
  begin
31
- super
27
+ yield
32
28
  fake_http_in_handler(@tracer, @worker_started, job_hash, queue, nil) if @tracer
33
29
  rescue => e
34
30
  crash_report_exception(e)
@@ -51,7 +47,7 @@ module Raygun
51
47
  def init_tracer
52
48
  tracer = Raygun::Apm::Tracer.new
53
49
  tracer.udp_sink!
54
- ObjectSpace.define_finalizer(self, Hook.finalize(tracer))
50
+ ObjectSpace.define_finalizer(self, Middleware.finalize(tracer))
55
51
 
56
52
  ActiveSupport::Notifications.unsubscribe(@sql_subscriber) if @sql_subscriber
57
53
  @sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
@@ -147,4 +143,8 @@ module Raygun
147
143
  end
148
144
  end
149
145
 
150
- Sidekiq::Processor.prepend Raygun::Apm::Sidekiq::Hook
146
+ Sidekiq.configure_server do |config|
147
+ config.server_middleware do |chain|
148
+ chain.add Raygun::Apm::Sidekiq::Middleware
149
+ end
150
+ end
@@ -4,7 +4,7 @@ module Raygun
4
4
  class Railtie < ::Rails::Railtie
5
5
  initializer "raygun.apm.sidekiq" do |app|
6
6
  require "raygun/apm"
7
- require "raygun/apm/sidekiq/hook"
7
+ require "raygun/apm/sidekiq/middleware"
8
8
  Raygun::Apm::Blacklist.extend_with Raygun::Apm::Sidekiq::BLACKLIST
9
9
  # Explictly enable instrumenting HTTP until a good control API is figured out
10
10
  require "raygun/apm/hooks/net_http"
@@ -1,7 +1,7 @@
1
1
  module Raygun
2
2
  module Apm
3
3
  module Sidekiq
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.3"
5
5
  end
6
6
  end
7
7
  end
@@ -7,7 +7,7 @@ module Raygun
7
7
 
8
8
  BLACKLIST = %w{
9
9
  Sidekiq
10
- +Raygun::Apm::Sidekiq::Hook#Ruby_APM_profiler_trace
10
+ +Raygun::Apm::Sidekiq::Middleware#Ruby_APM_profiler_trace
11
11
  }
12
12
 
13
13
  def self.raygun4ruby?(configured = true)
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "raygun-apm"
21
+ spec.add_dependency "raygun-apm", "~> 1.1.10"
22
22
  spec.add_development_dependency "bundler"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  spec.add_development_dependency "minitest", "~> 5.0"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raygun-apm-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raygun Limited
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-13 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raygun-apm
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.1.10
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: '0'
26
+ version: 1.1.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,7 @@ files:
79
79
  - bin/console
80
80
  - bin/setup
81
81
  - lib/raygun/apm/sidekiq.rb
82
- - lib/raygun/apm/sidekiq/hook.rb
82
+ - lib/raygun/apm/sidekiq/middleware.rb
83
83
  - lib/raygun/apm/sidekiq/railtie.rb
84
84
  - lib/raygun/apm/sidekiq/version.rb
85
85
  - raygun-apm-sidekiq.gemspec