appsignal 0.10.4 → 0.10.5
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/.gitignore +0 -1
- data/.rspec +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/appsignal.rb +1 -1
- data/lib/appsignal/agent.rb +2 -1
- data/lib/appsignal/config.rb +6 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/agent_spec.rb +60 -72
- data/spec/lib/appsignal/config_spec.rb +7 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b534937f18014e6942e96590872f412395b628c7
|
4
|
+
data.tar.gz: 59e4b4d4ad5bb0eec58a9814a26680cb055966e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5345239997a144a05a572da7744cb3eb3c405931c3b3b37b0a4c1fcc1e49db7778abc22d39733ad711dd28ed1e535197ec9f0aa0dd1e5c346cd0db326a03bb0a
|
7
|
+
data.tar.gz: b144ad46eba9528a1d98c08dd6ba6fd701e443ae7425a8a34390bde2dfd20bf88204430d7d4c6a57ec98c6965e2dcc87cf04b847d82b65f686a877f5a9a3bbb9
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--order default
|
data/CHANGELOG.md
CHANGED
data/lib/appsignal.rb
CHANGED
data/lib/appsignal/agent.rb
CHANGED
@@ -104,6 +104,7 @@ module Appsignal
|
|
104
104
|
end
|
105
105
|
|
106
106
|
begin
|
107
|
+
return unless aggregator_to_be_sent.has_transactions?
|
107
108
|
handle_result(
|
108
109
|
transmitter.transmit(aggregator_to_be_sent.post_processed_queue!)
|
109
110
|
)
|
@@ -140,7 +141,7 @@ module Appsignal
|
|
140
141
|
@active = false
|
141
142
|
unsubscribe
|
142
143
|
stop_thread
|
143
|
-
send_queue if send_current_queue
|
144
|
+
send_queue if send_current_queue
|
144
145
|
end
|
145
146
|
|
146
147
|
protected
|
data/lib/appsignal/config.rb
CHANGED
@@ -43,6 +43,12 @@ module Appsignal
|
|
43
43
|
"and no APPSIGNAL_PUSH_API_KEY env var present"
|
44
44
|
)
|
45
45
|
end
|
46
|
+
if config_hash && !config_hash[:name]
|
47
|
+
@logger.debug(
|
48
|
+
"There's no name defined in the config, " \
|
49
|
+
"unless you're using the Heroku add-on you probably want to do this."
|
50
|
+
)
|
51
|
+
end
|
46
52
|
end
|
47
53
|
|
48
54
|
def loaded?
|
data/lib/appsignal/version.rb
CHANGED
@@ -250,49 +250,61 @@ describe Appsignal::Agent do
|
|
250
250
|
end
|
251
251
|
|
252
252
|
describe "#send_queue" do
|
253
|
-
|
254
|
-
|
255
|
-
|
253
|
+
context "without transactions" do
|
254
|
+
it "does not transmit" do
|
255
|
+
subject.should_not_receive(:handle_result)
|
256
|
+
end
|
256
257
|
end
|
257
258
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
259
|
+
context "with transactions" do
|
260
|
+
before do
|
261
|
+
subject.aggregator.stub(:has_transactions? => true)
|
262
|
+
end
|
262
263
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
Appsignal.logger.should_receive(:error).
|
269
|
-
with('PostProcessingException while sending queue: Message').
|
270
|
-
once
|
271
|
-
Appsignal.logger.should_receive(:error).
|
272
|
-
with(kind_of(String)).
|
273
|
-
once
|
274
|
-
end
|
264
|
+
it "transmits" do
|
265
|
+
subject.aggregator.stub(:post_processed_queue! => :foo)
|
266
|
+
subject.transmitter.should_receive(:transmit).with(:foo)
|
267
|
+
end
|
275
268
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
269
|
+
it "handles the return code" do
|
270
|
+
subject.transmitter.stub(:transmit => '200')
|
271
|
+
subject.should_receive(:handle_result).with('200')
|
272
|
+
end
|
273
|
+
|
274
|
+
it "handle exceptions in post processing" do
|
275
|
+
subject.aggregator.stub(:post_processed_queue!).and_raise(
|
276
|
+
PostProcessingException.new('Message')
|
277
|
+
)
|
278
|
+
|
279
|
+
Appsignal.logger.should_receive(:error).
|
280
|
+
with('PostProcessingException while sending queue: Message').
|
281
|
+
once
|
282
|
+
Appsignal.logger.should_receive(:error).
|
283
|
+
with(kind_of(String)).
|
284
|
+
once
|
285
|
+
end
|
286
|
+
|
287
|
+
it "handles exceptions in transmit" do
|
288
|
+
subject.transmitter.stub(:transmit).and_raise(
|
289
|
+
Exception.new('Message')
|
290
|
+
)
|
291
|
+
|
292
|
+
Appsignal.logger.should_receive(:error).
|
293
|
+
with('Exception while sending queue: Message').
|
294
|
+
once
|
295
|
+
Appsignal.logger.should_receive(:error).
|
296
|
+
with(kind_of(String)).
|
297
|
+
once
|
298
|
+
end
|
288
299
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
300
|
+
it "handles an OpenSSL error in transmit" do
|
301
|
+
subject.transmitter.stub(:transmit).and_raise(
|
302
|
+
OpenSSL::SSL::SSLError.new('Message')
|
303
|
+
)
|
293
304
|
|
294
|
-
|
295
|
-
|
305
|
+
Appsignal.logger.should_receive(:error).
|
306
|
+
with('OpenSSL::SSL::SSLError: Message').once
|
307
|
+
end
|
296
308
|
end
|
297
309
|
|
298
310
|
after { subject.send_queue }
|
@@ -337,50 +349,26 @@ describe Appsignal::Agent do
|
|
337
349
|
Thread.should_receive(:kill).with(subject.thread)
|
338
350
|
end
|
339
351
|
|
340
|
-
it "should not be active anymore" do
|
352
|
+
it "should not be active anymore after shutting down" do
|
341
353
|
subject.shutdown
|
342
354
|
subject.active?.should be_false
|
343
355
|
end
|
344
356
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
subject.shutdown(false, 'shutting down')
|
349
|
-
end
|
350
|
-
|
351
|
-
context "with an empty queue" do
|
352
|
-
it "should shutdown" do
|
353
|
-
subject.shutdown
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
context "with a queue with transactions" do
|
358
|
-
it "should shutdown" do
|
359
|
-
subject.enqueue(slow_transaction)
|
360
|
-
subject.should_not_receive(:send_queue)
|
361
|
-
|
362
|
-
subject.shutdown
|
363
|
-
end
|
364
|
-
end
|
357
|
+
it "should log the reason for shutting down" do
|
358
|
+
Appsignal.logger.should_receive(:info).with('Shutting down agent (shutting down)')
|
359
|
+
subject.shutdown(false, 'shutting down')
|
365
360
|
end
|
366
361
|
|
367
|
-
|
368
|
-
|
369
|
-
it "should shutdown" do
|
370
|
-
subject.should_not_receive(:send_queue)
|
362
|
+
it "should send the queue and shut down if the queue is to be sent" do
|
363
|
+
subject.should_receive(:send_queue)
|
371
364
|
|
372
|
-
|
373
|
-
|
374
|
-
end
|
365
|
+
subject.shutdown(true, nil)
|
366
|
+
end
|
375
367
|
|
376
|
-
|
377
|
-
|
378
|
-
subject.enqueue(slow_transaction)
|
379
|
-
subject.should_receive(:send_queue)
|
368
|
+
it "should only shutdown if the queue is not be sent" do
|
369
|
+
subject.should_not_receive(:send_queue)
|
380
370
|
|
381
|
-
|
382
|
-
end
|
383
|
-
end
|
371
|
+
subject.shutdown(false, nil)
|
384
372
|
end
|
385
373
|
end
|
386
374
|
|
@@ -120,7 +120,11 @@ describe Appsignal::Config do
|
|
120
120
|
its(:loaded?) { should be_true }
|
121
121
|
its(:active?) { should be_true }
|
122
122
|
|
123
|
-
it "should merge with the default config
|
123
|
+
it "should merge with the default config, fill the config hash and log about the missing name" do
|
124
|
+
Appsignal.logger.should_receive(:debug).with(
|
125
|
+
"There's no name defined in the config, unless you're using the Heroku add-on you probably want to do this."
|
126
|
+
)
|
127
|
+
|
124
128
|
subject.config_hash.should == {
|
125
129
|
:push_api_key => 'push_api_key',
|
126
130
|
:ignore_exceptions => [],
|
@@ -133,10 +137,11 @@ describe Appsignal::Config do
|
|
133
137
|
}
|
134
138
|
end
|
135
139
|
|
136
|
-
context "and an initial config is present" do
|
140
|
+
context "and an initial config with a name is present" do
|
137
141
|
let(:initial_config) { {:name => 'Initial Name'} }
|
138
142
|
|
139
143
|
it "should merge with the config" do
|
144
|
+
Appsignal.logger.should_not_receive(:debug)
|
140
145
|
subject[:name].should == 'Initial Name'
|
141
146
|
end
|
142
147
|
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: 0.10.
|
4
|
+
version: 0.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-09-
|
15
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -121,6 +121,7 @@ extensions: []
|
|
121
121
|
extra_rdoc_files: []
|
122
122
|
files:
|
123
123
|
- ".gitignore"
|
124
|
+
- ".rspec"
|
124
125
|
- ".travis.yml"
|
125
126
|
- CHANGELOG.md
|
126
127
|
- Gemfile
|