appsignal 2.11.9-java → 3.0.0.beta.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.semaphore/semaphore.yml +0 -23
- data/CHANGELOG.md +5 -14
- data/build_matrix.yml +0 -4
- data/lib/appsignal.rb +1 -27
- data/lib/appsignal/auth_check.rb +2 -8
- data/lib/appsignal/cli.rb +1 -23
- data/lib/appsignal/config.rb +0 -24
- data/lib/appsignal/event_formatter.rb +0 -25
- data/lib/appsignal/hooks.rb +0 -23
- data/lib/appsignal/hooks/action_cable.rb +5 -44
- data/lib/appsignal/hooks/active_support_notifications.rb +7 -86
- data/lib/appsignal/hooks/celluloid.rb +5 -9
- data/lib/appsignal/hooks/net_http.rb +2 -12
- data/lib/appsignal/hooks/puma.rb +3 -5
- data/lib/appsignal/hooks/que.rb +1 -1
- data/lib/appsignal/hooks/rake.rb +2 -24
- data/lib/appsignal/hooks/redis.rb +2 -13
- data/lib/appsignal/hooks/resque.rb +2 -43
- data/lib/appsignal/hooks/sidekiq.rb +1 -5
- data/lib/appsignal/hooks/unicorn.rb +3 -24
- data/lib/appsignal/hooks/webmachine.rb +1 -7
- data/lib/appsignal/integrations/action_cable.rb +34 -0
- data/lib/appsignal/integrations/active_support_notifications.rb +77 -0
- data/lib/appsignal/integrations/net_http.rb +16 -0
- data/lib/appsignal/integrations/object.rb +61 -4
- data/lib/appsignal/integrations/padrino.rb +5 -7
- data/lib/appsignal/integrations/que.rb +26 -33
- data/lib/appsignal/integrations/railtie.rb +1 -4
- data/lib/appsignal/integrations/rake.rb +26 -2
- data/lib/appsignal/integrations/redis.rb +17 -0
- data/lib/appsignal/integrations/resque.rb +39 -10
- data/lib/appsignal/integrations/unicorn.rb +28 -0
- data/lib/appsignal/integrations/webmachine.rb +22 -24
- data/lib/appsignal/minutely.rb +0 -18
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +1 -24
- data/spec/lib/appsignal/cli_spec.rb +1 -1
- data/spec/lib/appsignal/config_spec.rb +0 -66
- data/spec/lib/appsignal/event_formatter_spec.rb +0 -37
- data/spec/lib/appsignal/hooks/action_cable_spec.rb +0 -88
- data/spec/lib/appsignal/hooks/celluloid_spec.rb +6 -1
- data/spec/lib/appsignal/hooks/rake_spec.rb +1 -2
- data/spec/lib/appsignal/hooks/redis_spec.rb +50 -15
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +7 -61
- data/spec/lib/appsignal/hooks/unicorn_spec.rb +14 -3
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +2 -13
- data/spec/lib/appsignal/hooks_spec.rb +0 -57
- data/spec/lib/appsignal/integrations/object_spec.rb +4 -95
- data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -3
- data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -45
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +26 -8
- data/spec/lib/appsignal/minutely_spec.rb +0 -19
- data/spec/lib/appsignal/transaction_spec.rb +1 -14
- data/spec/lib/appsignal/transmitter_spec.rb +1 -1
- data/spec/lib/appsignal_spec.rb +0 -69
- data/spec/lib/puma/appsignal_spec.rb +0 -28
- data/spec/spec_helper.rb +1 -15
- metadata +10 -23
- data/lib/appsignal/cli/notify_of_deploy.rb +0 -131
- data/lib/appsignal/integrations/object_ruby_19.rb +0 -37
- data/lib/appsignal/integrations/object_ruby_modern.rb +0 -41
- data/lib/appsignal/integrations/resque_active_job.rb +0 -19
- data/lib/appsignal/js_exception_transaction.rb +0 -56
- data/lib/appsignal/rack/js_exception_catcher.rb +0 -80
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +0 -180
- data/spec/lib/appsignal/integrations/object_19_spec.rb +0 -266
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +0 -28
- data/spec/lib/appsignal/integrations/resque_spec.rb +0 -28
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +0 -128
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +0 -170
@@ -3,12 +3,22 @@ describe Appsignal::Hooks::UnicornHook do
|
|
3
3
|
before :context do
|
4
4
|
module Unicorn
|
5
5
|
class HttpServer
|
6
|
-
def worker_loop(
|
6
|
+
def worker_loop(_worker)
|
7
|
+
@worker_loop = true
|
8
|
+
end
|
9
|
+
|
10
|
+
def worker_loop?
|
11
|
+
@worker_loop == true
|
7
12
|
end
|
8
13
|
end
|
9
14
|
|
10
15
|
class Worker
|
11
16
|
def close
|
17
|
+
@close = true
|
18
|
+
end
|
19
|
+
|
20
|
+
def close?
|
21
|
+
@close == true
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
@@ -27,18 +37,19 @@ describe Appsignal::Hooks::UnicornHook do
|
|
27
37
|
worker = double
|
28
38
|
|
29
39
|
expect(Appsignal).to receive(:forked)
|
30
|
-
expect(server).to receive(:worker_loop_without_appsignal).with(worker)
|
31
40
|
|
32
41
|
server.worker_loop(worker)
|
42
|
+
|
43
|
+
expect(server.worker_loop?).to be true
|
33
44
|
end
|
34
45
|
|
35
46
|
it "adds behavior to Unicorn::Worker#close" do
|
36
47
|
worker = Unicorn::Worker.new
|
37
48
|
|
38
49
|
expect(Appsignal).to receive(:stop)
|
39
|
-
expect(worker).to receive(:close_without_appsignal)
|
40
50
|
|
41
51
|
worker.close
|
52
|
+
expect(worker.close?).to be true
|
42
53
|
end
|
43
54
|
end
|
44
55
|
|
@@ -10,19 +10,8 @@ describe Appsignal::Hooks::WebmachineHook do
|
|
10
10
|
it { is_expected.to be_truthy }
|
11
11
|
end
|
12
12
|
|
13
|
-
it "
|
14
|
-
expect(fsm).to
|
15
|
-
expect(fsm).to respond_to(:run_without_appsignal)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should include the handle_exceptions alias methods" do
|
19
|
-
expect(
|
20
|
-
fsm.respond_to?(:handle_exceptions_with_appsignal, true)
|
21
|
-
).to be_truthy
|
22
|
-
|
23
|
-
expect(
|
24
|
-
fsm.respond_to?(:handle_exceptions_without_appsignal, true)
|
25
|
-
).to be_truthy
|
13
|
+
it "adds behavior to Webmachine::Decision::FSM" do
|
14
|
+
expect(fsm.class.ancestors.first).to eq(Appsignal::Integrations::WebmachineIntegration)
|
26
15
|
end
|
27
16
|
end
|
28
17
|
else
|
@@ -78,63 +78,6 @@ describe Appsignal::Hooks do
|
|
78
78
|
expect(Appsignal::Hooks.hooks[:mock_error_hook].installed?).to be_falsy
|
79
79
|
Appsignal::Hooks.hooks.delete(:mock_error_hook)
|
80
80
|
end
|
81
|
-
|
82
|
-
describe "missing constants" do
|
83
|
-
let(:err_stream) { std_stream }
|
84
|
-
let(:stderr) { err_stream.read }
|
85
|
-
let(:log_stream) { std_stream }
|
86
|
-
let(:log) { log_contents(log_stream) }
|
87
|
-
before do
|
88
|
-
Appsignal.logger = test_logger(log_stream)
|
89
|
-
end
|
90
|
-
|
91
|
-
def call_constant(&block)
|
92
|
-
capture_std_streams(std_stream, err_stream, &block)
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "SidekiqProbe" do
|
96
|
-
it "logs a deprecation message and returns the new constant" do
|
97
|
-
constant = call_constant { Appsignal::Hooks::SidekiqProbe }
|
98
|
-
|
99
|
-
expect(constant).to eql(Appsignal::Probes::SidekiqProbe)
|
100
|
-
expect(constant.name).to eql("Appsignal::Probes::SidekiqProbe")
|
101
|
-
|
102
|
-
deprecation_message =
|
103
|
-
"The constant Appsignal::Hooks::SidekiqProbe has been deprecated. " \
|
104
|
-
"Please update the constant name to Appsignal::Probes::SidekiqProbe " \
|
105
|
-
"in the following file to remove this message.\n#{__FILE__}:"
|
106
|
-
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
107
|
-
expect(log).to contains_log :warn, deprecation_message
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "PumaProbe" do
|
112
|
-
it "logs a deprecation message and returns the new constant" do
|
113
|
-
constant = call_constant { Appsignal::Hooks::PumaProbe }
|
114
|
-
|
115
|
-
expect(constant).to eql(Appsignal::Probes::PumaProbe)
|
116
|
-
expect(constant.name).to eql("Appsignal::Probes::PumaProbe")
|
117
|
-
|
118
|
-
deprecation_message =
|
119
|
-
"The constant Appsignal::Hooks::PumaProbe has been deprecated. " \
|
120
|
-
"Please update the constant name to Appsignal::Probes::PumaProbe " \
|
121
|
-
"in the following file to remove this message.\n#{__FILE__}:"
|
122
|
-
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
123
|
-
expect(log).to contains_log :warn, deprecation_message
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe "other constant" do
|
128
|
-
it "raises a NameError like Ruby normally does" do
|
129
|
-
expect do
|
130
|
-
call_constant { Appsignal::Hooks::Unknown }
|
131
|
-
end.to raise_error(NameError)
|
132
|
-
|
133
|
-
expect(stderr).to be_empty
|
134
|
-
expect(log).to be_empty
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
81
|
end
|
139
82
|
|
140
83
|
describe Appsignal::Hooks::Helpers do
|
@@ -1,9 +1,5 @@
|
|
1
1
|
require "appsignal/integrations/object"
|
2
2
|
|
3
|
-
def is_ruby_19
|
4
|
-
RUBY_VERSION < "2.0"
|
5
|
-
end
|
6
|
-
|
7
3
|
describe Object do
|
8
4
|
describe "#instrument_method" do
|
9
5
|
context "with instance method" do
|
@@ -30,57 +26,12 @@ describe Object do
|
|
30
26
|
before do
|
31
27
|
Appsignal.config = project_fixture_config
|
32
28
|
expect(Appsignal::Transaction).to receive(:current).at_least(:once).and_return(transaction)
|
33
|
-
expect(Appsignal.active?).to be_truthy
|
34
29
|
end
|
35
30
|
after { Appsignal.config = nil }
|
36
31
|
|
37
|
-
context "with different kind of arguments" do
|
38
|
-
let(:klass) do
|
39
|
-
Class.new do
|
40
|
-
def positional_arguments(param1, param2)
|
41
|
-
[param1, param2]
|
42
|
-
end
|
43
|
-
appsignal_instrument_method :positional_arguments
|
44
|
-
|
45
|
-
def positional_arguments_splat(*params)
|
46
|
-
params
|
47
|
-
end
|
48
|
-
appsignal_instrument_method :positional_arguments_splat
|
49
|
-
|
50
|
-
def keyword_arguments(a: nil, b: nil)
|
51
|
-
[a, b]
|
52
|
-
end
|
53
|
-
appsignal_instrument_method :keyword_arguments
|
54
|
-
|
55
|
-
def keyword_arguments_splat(**kwargs)
|
56
|
-
kwargs
|
57
|
-
end
|
58
|
-
appsignal_instrument_method :keyword_arguments_splat
|
59
|
-
|
60
|
-
def splat(*args, **kwargs)
|
61
|
-
[args, kwargs]
|
62
|
-
end
|
63
|
-
appsignal_instrument_method :splat
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
it "instruments the method and calls it" do
|
68
|
-
expect(instance.positional_arguments("abc", "def")).to eq(["abc", "def"])
|
69
|
-
expect(instance.positional_arguments_splat("abc", "def")).to eq(["abc", "def"])
|
70
|
-
expect(instance.keyword_arguments(:a => "a", :b => "b")).to eq(["a", "b"])
|
71
|
-
expect(instance.keyword_arguments_splat(:a => "a", :b => "b"))
|
72
|
-
.to eq(:a => "a", :b => "b")
|
73
|
-
|
74
|
-
expect(instance.splat).to eq([[], {}])
|
75
|
-
expect(instance.splat(:a => "a", :b => "b")).to eq([[], { :a => "a", :b => "b" }])
|
76
|
-
expect(instance.splat("abc", "def")).to eq([["abc", "def"], {}])
|
77
|
-
expect(instance.splat("abc", "def", :a => "a", :b => "b"))
|
78
|
-
.to eq([["abc", "def"], { :a => "a", :b => "b" }])
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
32
|
context "with anonymous class" do
|
83
33
|
it "instruments the method and calls it" do
|
34
|
+
expect(Appsignal.active?).to be_truthy
|
84
35
|
expect(transaction).to receive(:start_event)
|
85
36
|
expect(transaction).to receive(:finish_event).with \
|
86
37
|
"foo.AnonymousClass.other", nil, nil, Appsignal::EventFormatter::DEFAULT
|
@@ -101,6 +52,7 @@ describe Object do
|
|
101
52
|
let(:klass) { NamedClass }
|
102
53
|
|
103
54
|
it "instruments the method and calls it" do
|
55
|
+
expect(Appsignal.active?).to be_truthy
|
104
56
|
expect(transaction).to receive(:start_event)
|
105
57
|
expect(transaction).to receive(:finish_event).with \
|
106
58
|
"foo.NamedClass.other", nil, nil, Appsignal::EventFormatter::DEFAULT
|
@@ -125,6 +77,7 @@ describe Object do
|
|
125
77
|
let(:klass) { MyModule::NestedModule::NamedClass }
|
126
78
|
|
127
79
|
it "instruments the method and calls it" do
|
80
|
+
expect(Appsignal.active?).to be_truthy
|
128
81
|
expect(transaction).to receive(:start_event)
|
129
82
|
expect(transaction).to receive(:finish_event).with \
|
130
83
|
"bar.NamedClass.NestedModule.MyModule.other", nil, nil,
|
@@ -144,6 +97,7 @@ describe Object do
|
|
144
97
|
end
|
145
98
|
|
146
99
|
it "instruments with custom name" do
|
100
|
+
expect(Appsignal.active?).to be_truthy
|
147
101
|
expect(transaction).to receive(:start_event)
|
148
102
|
expect(transaction).to receive(:finish_event).with \
|
149
103
|
"my_method.group", nil, nil, Appsignal::EventFormatter::DEFAULT
|
@@ -204,51 +158,6 @@ describe Object do
|
|
204
158
|
end
|
205
159
|
after { Appsignal.config = nil }
|
206
160
|
|
207
|
-
context "with different kind of arguments" do
|
208
|
-
let(:klass) do
|
209
|
-
Class.new do
|
210
|
-
def self.positional_arguments(param1, param2)
|
211
|
-
[param1, param2]
|
212
|
-
end
|
213
|
-
appsignal_instrument_class_method :positional_arguments
|
214
|
-
|
215
|
-
def self.positional_arguments_splat(*params)
|
216
|
-
params
|
217
|
-
end
|
218
|
-
appsignal_instrument_class_method :positional_arguments_splat
|
219
|
-
|
220
|
-
def self.keyword_arguments(a: nil, b: nil)
|
221
|
-
[a, b]
|
222
|
-
end
|
223
|
-
appsignal_instrument_class_method :keyword_arguments
|
224
|
-
|
225
|
-
def self.keyword_arguments_splat(**kwargs)
|
226
|
-
kwargs
|
227
|
-
end
|
228
|
-
appsignal_instrument_class_method :keyword_arguments_splat
|
229
|
-
|
230
|
-
def self.splat(*args, **kwargs)
|
231
|
-
[args, kwargs]
|
232
|
-
end
|
233
|
-
appsignal_instrument_class_method :splat
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
it "instruments the method and calls it" do
|
238
|
-
expect(klass.positional_arguments("abc", "def")).to eq(["abc", "def"])
|
239
|
-
expect(klass.positional_arguments_splat("abc", "def")).to eq(["abc", "def"])
|
240
|
-
expect(klass.keyword_arguments(:a => "a", :b => "b")).to eq(["a", "b"])
|
241
|
-
expect(klass.keyword_arguments_splat(:a => "a", :b => "b"))
|
242
|
-
.to eq(:a => "a", :b => "b")
|
243
|
-
|
244
|
-
expect(klass.splat).to eq([[], {}])
|
245
|
-
expect(klass.splat(:a => "a", :b => "b")).to eq([[], { :a => "a", :b => "b" }])
|
246
|
-
expect(klass.splat("abc", "def")).to eq([["abc", "def"], {}])
|
247
|
-
expect(klass.splat("abc", "def", :a => "a", :b => "b"))
|
248
|
-
.to eq([["abc", "def"], { :a => "a", :b => "b" }])
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
161
|
context "with anonymous class" do
|
253
162
|
it "instruments the method and calls it" do
|
254
163
|
expect(Appsignal.active?).to be_truthy
|
@@ -150,10 +150,9 @@ if DependencyHelper.padrino_present?
|
|
150
150
|
let(:path) { "/static" }
|
151
151
|
before do
|
152
152
|
env["sinatra.static_file"] = true
|
153
|
-
|
154
|
-
.to receive(:route_without_appsignal).and_return([200, {}, ["foo"]])
|
153
|
+
app.controllers { get(:static) { "Static!" } }
|
155
154
|
end
|
156
|
-
after { expect(response).to match_response(200, "
|
155
|
+
after { expect(response).to match_response(200, "Static!") }
|
157
156
|
|
158
157
|
it "does not instrument the request" do
|
159
158
|
expect_no_transaction_to_be_created
|
@@ -79,51 +79,6 @@ if DependencyHelper.rails_present?
|
|
79
79
|
|
80
80
|
after { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
81
81
|
end
|
82
|
-
|
83
|
-
describe "frontend_error_catching middleware" do
|
84
|
-
let(:config) do
|
85
|
-
Appsignal::Config.new(
|
86
|
-
project_fixture_path,
|
87
|
-
"test",
|
88
|
-
:name => "MyApp",
|
89
|
-
:enable_frontend_error_catching => enable_frontend_error_catching
|
90
|
-
)
|
91
|
-
end
|
92
|
-
before { allow(Appsignal::Config).to receive(:new).and_return(config) }
|
93
|
-
after { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
94
|
-
|
95
|
-
context "when enabled" do
|
96
|
-
let(:enable_frontend_error_catching) { true }
|
97
|
-
|
98
|
-
it "adds the Rails and JSExceptionCatcher middleware" do
|
99
|
-
expect(app.middleware).to receive(:insert_after).with(
|
100
|
-
ActionDispatch::DebugExceptions,
|
101
|
-
Appsignal::Rack::RailsInstrumentation
|
102
|
-
)
|
103
|
-
|
104
|
-
expect(app.middleware).to receive(:insert_before).with(
|
105
|
-
Appsignal::Rack::RailsInstrumentation,
|
106
|
-
Appsignal::Rack::JSExceptionCatcher
|
107
|
-
)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
context "when not enabled" do
|
112
|
-
let(:enable_frontend_error_catching) { false }
|
113
|
-
|
114
|
-
it "adds the Rails middleware, but not the JSExceptionCatcher middleware" do
|
115
|
-
expect(app.middleware).to receive(:insert_after).with(
|
116
|
-
ActionDispatch::DebugExceptions,
|
117
|
-
Appsignal::Rack::RailsInstrumentation
|
118
|
-
)
|
119
|
-
|
120
|
-
expect(app.middleware).to_not receive(:insert_before).with(
|
121
|
-
Appsignal::Rack::RailsInstrumentation,
|
122
|
-
Appsignal::Rack::JSExceptionCatcher
|
123
|
-
)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
82
|
end
|
128
83
|
end
|
129
84
|
end
|
@@ -1,12 +1,24 @@
|
|
1
1
|
if DependencyHelper.webmachine_present?
|
2
2
|
require "appsignal/integrations/webmachine"
|
3
3
|
|
4
|
-
|
4
|
+
class Response
|
5
|
+
attr_accessor :code
|
6
|
+
|
7
|
+
def body
|
8
|
+
""
|
9
|
+
end
|
10
|
+
|
11
|
+
def headers
|
12
|
+
{}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe Appsignal::Integrations::WebmachineIntegration do
|
5
17
|
let(:request) do
|
6
18
|
Webmachine::Request.new("GET", "http://google.com:80/foo", {}, nil)
|
7
19
|
end
|
8
|
-
let(:resource) { double(:trace? => false, :handle_exception => true) }
|
9
|
-
let(:response) {
|
20
|
+
let(:resource) { double(:trace? => false, :handle_exception => true, :"code=" => nil) }
|
21
|
+
let(:response) { Response.new }
|
10
22
|
let(:transaction) { double(:set_action_if_nil => true) }
|
11
23
|
let(:fsm) { Webmachine::Decision::FSM.new(resource, request, response) }
|
12
24
|
before(:context) { start_agent }
|
@@ -18,10 +30,8 @@ if DependencyHelper.webmachine_present?
|
|
18
30
|
end
|
19
31
|
end
|
20
32
|
|
21
|
-
describe "#
|
33
|
+
describe "#run" do
|
22
34
|
before do
|
23
|
-
allow(fsm).to receive(:request).and_return(request)
|
24
|
-
allow(fsm).to receive(:run_without_appsignal).and_return(true)
|
25
35
|
allow(SecureRandom).to receive(:uuid).and_return("uuid")
|
26
36
|
allow(Appsignal::Transaction).to receive(:create).and_return(transaction)
|
27
37
|
end
|
@@ -40,7 +50,7 @@ if DependencyHelper.webmachine_present?
|
|
40
50
|
end
|
41
51
|
|
42
52
|
it "should call the original method" do
|
43
|
-
expect(fsm).to receive(:
|
53
|
+
expect(fsm).to receive(:run)
|
44
54
|
end
|
45
55
|
|
46
56
|
it "should instrument the original method" do
|
@@ -52,9 +62,17 @@ if DependencyHelper.webmachine_present?
|
|
52
62
|
end
|
53
63
|
|
54
64
|
after { fsm.run }
|
65
|
+
|
66
|
+
describe "concerning the response" do
|
67
|
+
it "sets a response code" do
|
68
|
+
expect(fsm.response.code).to be_nil
|
69
|
+
fsm.run
|
70
|
+
expect(fsm.response.code).not_to be_nil
|
71
|
+
end
|
72
|
+
end
|
55
73
|
end
|
56
74
|
|
57
|
-
describe "#
|
75
|
+
describe "#handle_exceptions" do
|
58
76
|
let(:error) { ExampleException }
|
59
77
|
|
60
78
|
it "should catch the error and send it to AppSignal" do
|
@@ -284,25 +284,6 @@ describe Appsignal::Minutely do
|
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
287
|
-
describe "#<<" do
|
288
|
-
let(:err_stream) { std_stream }
|
289
|
-
let(:stderr) { err_stream.read }
|
290
|
-
let(:log_stream) { std_stream }
|
291
|
-
let(:log) { log_contents(log_stream) }
|
292
|
-
before { Appsignal.logger = test_logger(log_stream) }
|
293
|
-
|
294
|
-
it "adds the probe, but prints a deprecation warning" do
|
295
|
-
probe = lambda {}
|
296
|
-
capture_std_streams(std_stream, err_stream) { collection << probe }
|
297
|
-
deprecation_message = "Deprecated " \
|
298
|
-
"`Appsignal::Minute.probes <<` call. Please use " \
|
299
|
-
"`Appsignal::Minutely.probes.register` instead."
|
300
|
-
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
301
|
-
expect(log).to contains_log :warn, deprecation_message
|
302
|
-
expect(collection[probe.object_id]).to eql(probe)
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
287
|
describe "#register" do
|
307
288
|
let(:log_stream) { std_stream }
|
308
289
|
let(:log) { log_contents(log_stream) }
|
@@ -640,7 +640,7 @@ describe Appsignal::Transaction do
|
|
640
640
|
end
|
641
641
|
|
642
642
|
context "when the data cannot be converted to JSON" do
|
643
|
-
it "does not update the sample data on the transaction"
|
643
|
+
it "does not update the sample data on the transaction" do
|
644
644
|
klass = Class.new do
|
645
645
|
def to_s
|
646
646
|
raise "foo" # Cause a deliberate error
|
@@ -652,19 +652,6 @@ describe Appsignal::Transaction do
|
|
652
652
|
expect(log_contents(log)).to contains_log :error,
|
653
653
|
"Error generating data (RuntimeError: foo) for"
|
654
654
|
end
|
655
|
-
|
656
|
-
it "does not update the sample data on the transaction", :only_ruby19 do
|
657
|
-
klass = Class.new do
|
658
|
-
def to_s
|
659
|
-
raise "foo" # Cause a deliberate error
|
660
|
-
end
|
661
|
-
end
|
662
|
-
transaction.set_sample_data("params", klass.new => 1)
|
663
|
-
|
664
|
-
expect(transaction.to_h["sample_data"]).to eq({})
|
665
|
-
expect(log_contents(log)).to contains_log :error,
|
666
|
-
"Error generating data (RuntimeError: foo). Can't inspect data."
|
667
|
-
end
|
668
655
|
end
|
669
656
|
end
|
670
657
|
|