raygun-apm-sidekiq 1.0.21 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/lib/raygun/apm/sidekiq/{hook.rb → middleware.rb} +19 -10
- data/lib/raygun/apm/sidekiq/railtie.rb +1 -1
- data/lib/raygun/apm/sidekiq/version.rb +1 -1
- data/lib/raygun/apm/sidekiq.rb +8 -1
- data/raygun-apm-sidekiq.gemspec +5 -5
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb60a5d5debbf6e3bdde1ca25277c32a3c4c73338534b286f8454ef1710123e
|
4
|
+
data.tar.gz: 7d5332c206419c65d64350b4c96ad9b036ee700e3545135013c1e25eb4125252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63827daad6dfae46726984fcea163ab7fbc93b69e26fe4dad55e33983dbcc9964de5f38a98a4f1048263a538f8bf8926af40c77c9318e8e61420523f96e8b2cd
|
7
|
+
data.tar.gz: 7bf386f072d834afb4fe51c112b95f601e435133b607f192b5b8cfeb909698e4cb42077fc4baf53badbf1eed2054eb8e6d7a9a042b11fa5648bbb4b35fa8e337
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Raygun Limited
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -4,22 +4,18 @@ require 'sidekiq/processor'
|
|
4
4
|
module Raygun
|
5
5
|
module Apm
|
6
6
|
module Sidekiq
|
7
|
-
|
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
|
-
|
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
|
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,9 +24,10 @@ module Raygun
|
|
28
24
|
exception = nil
|
29
25
|
Ruby_APM_profiler_trace do
|
30
26
|
begin
|
31
|
-
|
27
|
+
yield
|
32
28
|
fake_http_in_handler(@tracer, @worker_started, job_hash, queue, nil) if @tracer
|
33
29
|
rescue => e
|
30
|
+
crash_report_exception(e)
|
34
31
|
fake_http_in_handler(@tracer, @worker_started, job_hash, queue, e) if @tracer
|
35
32
|
exception = e
|
36
33
|
end
|
@@ -50,7 +47,7 @@ module Raygun
|
|
50
47
|
def init_tracer
|
51
48
|
tracer = Raygun::Apm::Tracer.new
|
52
49
|
tracer.udp_sink!
|
53
|
-
ObjectSpace.define_finalizer(self,
|
50
|
+
ObjectSpace.define_finalizer(self, Middleware.finalize(tracer))
|
54
51
|
|
55
52
|
ActiveSupport::Notifications.unsubscribe(@sql_subscriber) if @sql_subscriber
|
56
53
|
@sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
@@ -72,6 +69,7 @@ module Raygun
|
|
72
69
|
# Let the GC clean up the sink thread through the finalizer below
|
73
70
|
@tracer = nil
|
74
71
|
Raygun::Apm::Tracer.instance = nil
|
72
|
+
crash_report_exception(exception)
|
75
73
|
raise(exception) unless (Raygun::Apm::FatalError === exception)
|
76
74
|
end
|
77
75
|
|
@@ -133,9 +131,20 @@ module Raygun
|
|
133
131
|
def Ruby_APM_profiler_trace
|
134
132
|
yield
|
135
133
|
end
|
134
|
+
|
135
|
+
def crash_report_exception(exception, env = {})
|
136
|
+
if Raygun::Apm::Sidekiq.raygun4ruby?
|
137
|
+
env.merge!(correlation_id: exception.instance_variable_get(:@__raygun_correlation_id))
|
138
|
+
Raygun.track_exception(exception, env)
|
139
|
+
end
|
140
|
+
end
|
136
141
|
end
|
137
142
|
end
|
138
143
|
end
|
139
144
|
end
|
140
145
|
|
141
|
-
Sidekiq
|
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/
|
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"
|
data/lib/raygun/apm/sidekiq.rb
CHANGED
@@ -7,9 +7,16 @@ module Raygun
|
|
7
7
|
|
8
8
|
BLACKLIST = %w{
|
9
9
|
Sidekiq
|
10
|
-
+Raygun::Apm::Sidekiq::
|
10
|
+
+Raygun::Apm::Sidekiq::Middleware#Ruby_APM_profiler_trace
|
11
11
|
}
|
12
12
|
|
13
|
+
def self.raygun4ruby?(configured = true)
|
14
|
+
if configured
|
15
|
+
defined?(Raygun) && Raygun.respond_to?(:configured?) && Raygun.configured?
|
16
|
+
else
|
17
|
+
defined?(Raygun) && Raygun.respond_to?(:configured?)
|
18
|
+
end
|
19
|
+
end
|
13
20
|
end
|
14
21
|
end
|
15
22
|
end
|
data/raygun-apm-sidekiq.gemspec
CHANGED
@@ -6,19 +6,19 @@ require "raygun/apm/sidekiq/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "raygun-apm-sidekiq"
|
8
8
|
spec.version = Raygun::Apm::Sidekiq::VERSION
|
9
|
-
spec.authors = ["Raygun
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Raygun Limited"]
|
10
|
+
spec.email = ["ruby-apm@raygun.io", "support@raygun.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Raygun application performance monitoring for Sidekiq}
|
13
13
|
spec.homepage = "https://raygun.com/platform/apm"
|
14
|
-
|
14
|
+
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.files = Dir['README.rdoc', 'raygun-apm-sidekiq.gemspec', 'lib/**/*', 'bin/**/*']
|
16
|
+
spec.files = Dir['README.rdoc', 'LICENSE', 'raygun-apm-sidekiq.gemspec', 'lib/**/*', 'bin/**/*']
|
17
17
|
spec.bindir = "exe"
|
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", "~> 1.
|
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,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun-apm-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Raygun
|
8
|
-
- Erkki Eilonen
|
7
|
+
- Raygun Limited
|
9
8
|
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: raygun-apm
|
@@ -17,14 +16,14 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
19
|
+
version: 1.1.10
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - "~>"
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
26
|
+
version: 1.1.10
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
28
|
name: bundler
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,22 +68,24 @@ dependencies:
|
|
69
68
|
version: '5.0'
|
70
69
|
description:
|
71
70
|
email:
|
71
|
+
- ruby-apm@raygun.io
|
72
72
|
- support@raygun.com
|
73
|
-
- info@bearmetal.eu
|
74
73
|
executables: []
|
75
74
|
extensions: []
|
76
75
|
extra_rdoc_files: []
|
77
76
|
files:
|
77
|
+
- LICENSE
|
78
78
|
- README.rdoc
|
79
79
|
- bin/console
|
80
80
|
- bin/setup
|
81
81
|
- lib/raygun/apm/sidekiq.rb
|
82
|
-
- lib/raygun/apm/sidekiq/
|
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
|
86
86
|
homepage: https://raygun.com/platform/apm
|
87
|
-
licenses:
|
87
|
+
licenses:
|
88
|
+
- MIT
|
88
89
|
metadata: {}
|
89
90
|
post_install_message:
|
90
91
|
rdoc_options: []
|