appsignal 3.6.1-java → 3.6.3-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/CHANGELOG.md +27 -4
- data/Rakefile +1 -1
- data/ext/agent.rb +27 -27
- data/lib/appsignal/auth_check.rb +1 -1
- data/lib/appsignal/config.rb +14 -1
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +1 -1
- data/lib/appsignal/integrations/railtie.rb +14 -2
- data/lib/appsignal/logger.rb +5 -5
- data/lib/appsignal/rack/generic_instrumentation.rb +4 -17
- data/lib/appsignal/rack/rails_instrumentation.rb +3 -15
- data/lib/appsignal/rack/sinatra_instrumentation.rb +3 -15
- data/lib/appsignal/rack/streaming_listener.rb +35 -26
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +0 -1
- data/lib/puma/plugin/appsignal.rb +1 -1
- data/spec/lib/appsignal/capistrano2_spec.rb +2 -2
- data/spec/lib/appsignal/capistrano3_spec.rb +2 -2
- data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
- data/spec/lib/appsignal/config_spec.rb +10 -5
- data/spec/lib/appsignal/environment_spec.rb +3 -3
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/resque_spec.rb +1 -1
- data/spec/lib/appsignal/hooks_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/railtie_spec.rb +27 -2
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +1 -1
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -3
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -4
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +1 -3
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +53 -9
- data/spec/lib/appsignal/transaction_spec.rb +2 -2
- data/spec/lib/appsignal_spec.rb +1 -1
- data/spec/lib/puma/appsignal_spec.rb +1 -1
- metadata +3 -5
- data/lib/appsignal/rack/body_wrapper.rb +0 -161
- data/spec/lib/appsignal/rack/body_wrapper_spec.rb +0 -220
@@ -1,220 +0,0 @@
|
|
1
|
-
describe Appsignal::Rack::BodyWrapper do
|
2
|
-
let(:nil_txn) { Appsignal::Transaction::NilTransaction.new }
|
3
|
-
|
4
|
-
describe "with a body that supports all possible features" do
|
5
|
-
it "reduces the supported methods to just each()" do
|
6
|
-
# which is the safest thing to do, since the body is likely broken
|
7
|
-
fake_body = double(:each => nil, :call => nil, :to_ary => [], :to_path => "/tmp/foo.bin",
|
8
|
-
:close => nil)
|
9
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
10
|
-
expect(wrapped).to respond_to(:each)
|
11
|
-
expect(wrapped).not_to respond_to(:to_ary)
|
12
|
-
expect(wrapped).not_to respond_to(:call)
|
13
|
-
expect(wrapped).to respond_to(:close)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "with a body only supporting each()" do
|
18
|
-
it "wraps with appropriate class" do
|
19
|
-
fake_body = double
|
20
|
-
allow(fake_body).to receive(:each)
|
21
|
-
|
22
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
23
|
-
expect(wrapped).to respond_to(:each)
|
24
|
-
expect(wrapped).not_to respond_to(:to_ary)
|
25
|
-
expect(wrapped).not_to respond_to(:call)
|
26
|
-
expect(wrapped).to respond_to(:close)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "reads out the body in full using each" do
|
30
|
-
fake_body = double
|
31
|
-
expect(fake_body).to receive(:each).once.and_yield("a").and_yield("b").and_yield("c")
|
32
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
33
|
-
expect { |b| wrapped.each(&b) }.to yield_successive_args("a", "b", "c")
|
34
|
-
end
|
35
|
-
|
36
|
-
it "returns an Enumerator if each() gets called without a block" do
|
37
|
-
fake_body = double
|
38
|
-
expect(fake_body).to receive(:each).once.and_yield("a").and_yield("b").and_yield("c")
|
39
|
-
|
40
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
41
|
-
enum = wrapped.each
|
42
|
-
expect(enum).to be_kind_of(Enumerator)
|
43
|
-
expect { |b| enum.each(&b) }.to yield_successive_args("a", "b", "c")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "sets the exception raised inside each() into the Appsignal transaction" do
|
47
|
-
fake_body = double
|
48
|
-
expect(fake_body).to receive(:each).once.and_raise(Exception.new("Oops"))
|
49
|
-
|
50
|
-
txn = double("Appsignal transaction", "nil_transaction?" => false)
|
51
|
-
expect(txn).to receive(:set_error).once.with(instance_of(Exception))
|
52
|
-
|
53
|
-
wrapped = described_class.wrap(fake_body, txn)
|
54
|
-
expect do
|
55
|
-
expect { |b| wrapped.each(&b) }.to yield_control
|
56
|
-
end.to raise_error(/Oops/)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "closes the body and the transaction when it gets closed" do
|
60
|
-
fake_body = double
|
61
|
-
expect(fake_body).to receive(:each).once.and_yield("a").and_yield("b").and_yield("c")
|
62
|
-
|
63
|
-
txn = double("Appsignal transaction", "nil_transaction?" => false)
|
64
|
-
expect(Appsignal::Transaction).to receive(:complete_current!).once
|
65
|
-
|
66
|
-
wrapped = described_class.wrap(fake_body, txn)
|
67
|
-
expect { |b| wrapped.each(&b) }.to yield_successive_args("a", "b", "c")
|
68
|
-
expect { wrapped.close }.not_to raise_error
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "with a body supporting both each() and call" do
|
73
|
-
it "wraps with the wrapper that conceals call() and exposes each" do
|
74
|
-
fake_body = double
|
75
|
-
allow(fake_body).to receive(:each)
|
76
|
-
allow(fake_body).to receive(:call)
|
77
|
-
|
78
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
79
|
-
expect(wrapped).to respond_to(:each)
|
80
|
-
expect(wrapped).not_to respond_to(:to_ary)
|
81
|
-
expect(wrapped).not_to respond_to(:call)
|
82
|
-
expect(wrapped).not_to respond_to(:to_path)
|
83
|
-
expect(wrapped).to respond_to(:close)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe "with a body supporting both to_ary and each" do
|
88
|
-
let(:fake_body) { double(:each => nil, :to_ary => []) }
|
89
|
-
it "wraps with appropriate class" do
|
90
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
91
|
-
expect(wrapped).to respond_to(:each)
|
92
|
-
expect(wrapped).to respond_to(:to_ary)
|
93
|
-
expect(wrapped).not_to respond_to(:call)
|
94
|
-
expect(wrapped).not_to respond_to(:to_path)
|
95
|
-
expect(wrapped).to respond_to(:close)
|
96
|
-
end
|
97
|
-
|
98
|
-
it "reads out the body in full using each" do
|
99
|
-
expect(fake_body).to receive(:each).once.and_yield("a").and_yield("b").and_yield("c")
|
100
|
-
|
101
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
102
|
-
expect { |b| wrapped.each(&b) }.to yield_successive_args("a", "b", "c")
|
103
|
-
end
|
104
|
-
|
105
|
-
it "sets the exception raised inside each() into the Appsignal transaction" do
|
106
|
-
expect(fake_body).to receive(:each).once.and_raise(Exception.new("Oops"))
|
107
|
-
|
108
|
-
txn = double("Appsignal transaction", "nil_transaction?" => false)
|
109
|
-
expect(txn).to receive(:set_error).once.with(instance_of(Exception))
|
110
|
-
|
111
|
-
wrapped = described_class.wrap(fake_body, txn)
|
112
|
-
expect do
|
113
|
-
expect { |b| wrapped.each(&b) }.to yield_control
|
114
|
-
end.to raise_error(/Oops/)
|
115
|
-
end
|
116
|
-
|
117
|
-
it "reads out the body in full using to_ary" do
|
118
|
-
expect(fake_body).to receive(:to_ary).and_return(["one", "two", "three"])
|
119
|
-
|
120
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
121
|
-
expect(wrapped.to_ary).to eq(["one", "two", "three"])
|
122
|
-
end
|
123
|
-
|
124
|
-
it "sends the exception raised inside to_ary() into the Appsignal and closes txn" do
|
125
|
-
fake_body = double
|
126
|
-
allow(fake_body).to receive(:each)
|
127
|
-
expect(fake_body).to receive(:to_ary).once.and_raise(Exception.new("Oops"))
|
128
|
-
expect(fake_body).not_to receive(:close) # Per spec we expect the body has closed itself
|
129
|
-
|
130
|
-
txn = double("Appsignal transaction", "nil_transaction?" => false)
|
131
|
-
expect(txn).to receive(:set_error).once.with(instance_of(Exception))
|
132
|
-
expect(Appsignal::Transaction).to receive(:complete_current!).once
|
133
|
-
|
134
|
-
wrapped = described_class.wrap(fake_body, txn)
|
135
|
-
expect { wrapped.to_ary }.to raise_error(/Oops/)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe "with a body supporting both to_path and each" do
|
140
|
-
let(:fake_body) { double(:each => nil, :to_path => nil) }
|
141
|
-
|
142
|
-
it "wraps with appropriate class" do
|
143
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
144
|
-
expect(wrapped).to respond_to(:each)
|
145
|
-
expect(wrapped).not_to respond_to(:to_ary)
|
146
|
-
expect(wrapped).not_to respond_to(:call)
|
147
|
-
expect(wrapped).to respond_to(:to_path)
|
148
|
-
expect(wrapped).to respond_to(:close)
|
149
|
-
end
|
150
|
-
|
151
|
-
it "reads out the body in full using each()" do
|
152
|
-
expect(fake_body).to receive(:each).once.and_yield("a").and_yield("b").and_yield("c")
|
153
|
-
|
154
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
155
|
-
expect { |b| wrapped.each(&b) }.to yield_successive_args("a", "b", "c")
|
156
|
-
end
|
157
|
-
|
158
|
-
it "sets the exception raised inside each() into the Appsignal transaction" do
|
159
|
-
expect(fake_body).to receive(:each).once.and_raise(Exception.new("Oops"))
|
160
|
-
|
161
|
-
txn = double("Appsignal transaction", "nil_transaction?" => false)
|
162
|
-
expect(txn).to receive(:set_error).once.with(instance_of(Exception))
|
163
|
-
|
164
|
-
wrapped = described_class.wrap(fake_body, txn)
|
165
|
-
expect do
|
166
|
-
expect { |b| wrapped.each(&b) }.to yield_control
|
167
|
-
end.to raise_error(/Oops/)
|
168
|
-
end
|
169
|
-
|
170
|
-
it "sets the exception raised inside to_path() into the Appsignal transaction" do
|
171
|
-
allow(fake_body).to receive(:to_path).once.and_raise(Exception.new("Oops"))
|
172
|
-
|
173
|
-
txn = double("Appsignal transaction", "nil_transaction?" => false)
|
174
|
-
expect(txn).to receive(:set_error).once.with(instance_of(Exception))
|
175
|
-
expect(txn).not_to receive(:complete) # gets called by the caller via close()
|
176
|
-
|
177
|
-
wrapped = described_class.wrap(fake_body, txn)
|
178
|
-
expect { wrapped.to_path }.to raise_error(/Oops/)
|
179
|
-
end
|
180
|
-
|
181
|
-
it "exposes to_path to the sender" do
|
182
|
-
allow(fake_body).to receive(:to_path).and_return("/tmp/file.bin")
|
183
|
-
|
184
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
185
|
-
expect(wrapped.to_path).to eq("/tmp/file.bin")
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
describe "with a body only supporting call()" do
|
190
|
-
let(:fake_body) { double(:call => nil) }
|
191
|
-
it "wraps with appropriate class" do
|
192
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
193
|
-
expect(wrapped).not_to respond_to(:each)
|
194
|
-
expect(wrapped).not_to respond_to(:to_ary)
|
195
|
-
expect(wrapped).to respond_to(:call)
|
196
|
-
expect(wrapped).not_to respond_to(:to_path)
|
197
|
-
expect(wrapped).to respond_to(:close)
|
198
|
-
end
|
199
|
-
|
200
|
-
it "passes the stream into the call() of the body" do
|
201
|
-
fake_rack_stream = double("stream")
|
202
|
-
expect(fake_body).to receive(:call).with(fake_rack_stream)
|
203
|
-
|
204
|
-
wrapped = described_class.wrap(fake_body, nil_txn)
|
205
|
-
expect { wrapped.call(fake_rack_stream) }.not_to raise_error
|
206
|
-
end
|
207
|
-
|
208
|
-
it "sets the exception raised inside call() into the Appsignal transaction" do
|
209
|
-
fake_rack_stream = double
|
210
|
-
allow(fake_body).to receive(:call).with(fake_rack_stream).and_raise(Exception.new("Oopsie"))
|
211
|
-
|
212
|
-
txn = double("Appsignal transaction", "nil_transaction?" => false)
|
213
|
-
expect(txn).to receive(:set_error).once.with(instance_of(Exception))
|
214
|
-
expect(txn).not_to receive(:complete) # gets called by the caller via close()
|
215
|
-
wrapped = described_class.wrap(fake_body, txn)
|
216
|
-
|
217
|
-
expect { wrapped.call(fake_rack_stream) }.to raise_error(/Oopsie/)
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|