appsignal 2.11.5-java → 2.11.6-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/appsignal/hooks/sidekiq.rb +5 -1
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +61 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98537d0865014abcba17744b865f00ce320f9049e9a4397f5c688547595779a5
|
4
|
+
data.tar.gz: cd0dc3ea721e2f52445b9097bc09c31245729519a970d14c7a105ee455c67524
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 679d1d72f5eeb7cf00fbabb334ae85471808541a74c96c70de8964ea4d630690c3f9a851a78bf7879782b53e0753862e866bb337b2553e3ed989599778a6666d
|
7
|
+
data.tar.gz: 5d0bb9342599fbbea0e2e1f2f9f4347dcdaa91929a33b4cf85a39533fa34d6c820c3081f6118607081161e8ef65d48696cfa00b7a9f5147e98948b63ab034109
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 2.11.6
|
4
|
+
- Prepend Sidekiq middleware to wrap all Sidekiq middleware. Catches more
|
5
|
+
errors and provide more complete performance measurements. PR #698
|
6
|
+
|
3
7
|
# 2.11.5
|
4
8
|
- Add more detailed logging to finish_event calls when the event is unknown, so
|
5
9
|
we know what event is being tried to finish. Commit
|
@@ -16,7 +16,11 @@ module Appsignal
|
|
16
16
|
|
17
17
|
::Sidekiq.configure_server do |config|
|
18
18
|
config.server_middleware do |chain|
|
19
|
-
chain.
|
19
|
+
if chain.respond_to? :prepend
|
20
|
+
chain.prepend Appsignal::Hooks::SidekiqPlugin
|
21
|
+
else
|
22
|
+
chain.add Appsignal::Hooks::SidekiqPlugin
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/appsignal/version.rb
CHANGED
@@ -16,14 +16,31 @@ describe Appsignal::Hooks::SidekiqHook do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "#install" do
|
19
|
-
class
|
20
|
-
|
21
|
-
|
19
|
+
class SidekiqMiddlewareMockWithPrepend < Array
|
20
|
+
alias add <<
|
21
|
+
alias exists? include?
|
22
|
+
|
23
|
+
unless method_defined? :prepend
|
24
|
+
def prepend(middleware) # For Ruby < 2.5
|
25
|
+
insert(0, middleware)
|
26
|
+
end
|
22
27
|
end
|
23
28
|
end
|
29
|
+
|
30
|
+
class SidekiqMiddlewareMockWithoutPrepend < Array
|
31
|
+
alias add <<
|
32
|
+
alias exists? include?
|
33
|
+
|
34
|
+
undef_method :prepend if method_defined? :prepend # For Ruby >= 2.5
|
35
|
+
end
|
36
|
+
|
24
37
|
module SidekiqMock
|
38
|
+
def self.middleware_mock=(mock)
|
39
|
+
@middlewares = mock.new
|
40
|
+
end
|
41
|
+
|
25
42
|
def self.middlewares
|
26
|
-
@middlewares
|
43
|
+
@middlewares
|
27
44
|
end
|
28
45
|
|
29
46
|
def self.configure_server
|
@@ -36,15 +53,52 @@ describe Appsignal::Hooks::SidekiqHook do
|
|
36
53
|
end
|
37
54
|
end
|
38
55
|
|
56
|
+
def add_middleware(middleware)
|
57
|
+
Sidekiq.configure_server do |sidekiq_config|
|
58
|
+
sidekiq_config.middlewares.add(middleware)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
39
62
|
before do
|
40
63
|
Appsignal.config = project_fixture_config
|
41
64
|
stub_const "Sidekiq", SidekiqMock
|
42
65
|
end
|
43
66
|
|
44
|
-
|
45
|
-
|
67
|
+
context "when Sidekiq middleware responds to prepend method" do # Sidekiq 3.3.0 and newer
|
68
|
+
before { Sidekiq.middleware_mock = SidekiqMiddlewareMockWithPrepend }
|
69
|
+
|
70
|
+
it "adds the AppSignal SidekiqPlugin to the Sidekiq middleware chain in the first position" do
|
71
|
+
user_middleware1 = proc {}
|
72
|
+
add_middleware(user_middleware1)
|
73
|
+
described_class.new.install
|
74
|
+
user_middleware2 = proc {}
|
75
|
+
add_middleware(user_middleware2)
|
46
76
|
|
47
|
-
|
77
|
+
expect(Sidekiq.server_middleware).to eql([
|
78
|
+
Appsignal::Hooks::SidekiqPlugin, # Prepend makes it the first entry
|
79
|
+
user_middleware1,
|
80
|
+
user_middleware2
|
81
|
+
])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "when Sidekiq middleware does not respond to prepend method" do
|
86
|
+
before { Sidekiq.middleware_mock = SidekiqMiddlewareMockWithoutPrepend }
|
87
|
+
|
88
|
+
it "adds the AppSignal SidekiqPlugin to the Sidekiq middleware chain" do
|
89
|
+
user_middleware1 = proc {}
|
90
|
+
add_middleware(user_middleware1)
|
91
|
+
described_class.new.install
|
92
|
+
user_middleware2 = proc {}
|
93
|
+
add_middleware(user_middleware2)
|
94
|
+
|
95
|
+
# Add middlewares in whatever order they were added
|
96
|
+
expect(Sidekiq.server_middleware).to eql([
|
97
|
+
user_middleware1,
|
98
|
+
Appsignal::Hooks::SidekiqPlugin,
|
99
|
+
user_middleware2
|
100
|
+
])
|
101
|
+
end
|
48
102
|
end
|
49
103
|
end
|
50
104
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.6
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|