appsignal 0.11.13.beta.0 → 0.11.13.beta.1

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.
@@ -1,6 +1,7 @@
1
1
  # 0.11.13
2
2
  * Configure Net::HTTP to only use TLS
3
3
  * Add http proxy support
4
+ * Don't send queue if there is no content
4
5
 
5
6
  # 0.11.12
6
7
  * Sanitizer will no longer inspect unknown objects, since implementations of inspect sometimes trigger unexpected behavior.
@@ -103,6 +103,9 @@ module Appsignal
103
103
 
104
104
  def send_queue
105
105
  Appsignal.logger.debug('Sending queue')
106
+ unless aggregator.has_transactions? || aggregator_queue.any?
107
+ return
108
+ end
106
109
  # Replace aggregator while making sure no thread
107
110
  # is adding to it's queue
108
111
  aggregator_to_be_sent = nil
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.11.13.beta.0'
2
+ VERSION = '0.11.13.beta.1'
3
3
  end
@@ -271,39 +271,61 @@ describe Appsignal::Agent do
271
271
  describe "#send_queue" do
272
272
  let(:zipped_payload) { double(:body => :zip) }
273
273
 
274
- it "adds Zipped Payload to queue" do
275
- subject.aggregator.stub(:post_processed_queue! => :foo)
274
+ context "with something in the aggregator" do
275
+ before do
276
+ subject.aggregator.stub(:has_transactions? => true)
277
+ end
276
278
 
277
- Appsignal::ZippedPayload
278
- .should_receive(:new)
279
- .with(:foo)
280
- .and_return(zipped_payload)
279
+ it "adds Zipped Payload to queue" do
280
+ subject.aggregator.stub(:post_processed_queue! => :foo)
281
281
 
282
- subject.should_receive(:add_to_aggregator_queue).with(zipped_payload)
283
- end
282
+ Appsignal::ZippedPayload
283
+ .should_receive(:new)
284
+ .with(:foo)
285
+ .and_return(zipped_payload)
284
286
 
285
- it "sends aggregators" do
286
- subject.should_receive(:send_aggregators)
287
- end
287
+ subject.should_receive(:add_to_aggregator_queue).with(zipped_payload)
288
+ end
288
289
 
289
- it "handle exceptions in post processing" do
290
- subject.aggregator.stub(:post_processed_queue!).and_raise(
291
- PostProcessingException.new('Message')
292
- )
290
+ it "sends aggregators" do
291
+ subject.should_receive(:send_aggregators)
292
+ end
293
293
 
294
- Appsignal.logger.should_receive(:error).
295
- with(kind_of(String)).
296
- once
294
+ it "handle exceptions in post processing" do
295
+ subject.aggregator.stub(:post_processed_queue!).and_raise(
296
+ PostProcessingException.new('Message')
297
+ )
298
+
299
+ Appsignal.logger.should_receive(:error).
300
+ with(kind_of(String)).
301
+ once
302
+ end
303
+
304
+ it "handles exceptions in transmit" do
305
+ subject.stub(:send_aggregators).and_raise(
306
+ Exception.new('Message')
307
+ )
308
+
309
+ Appsignal.logger.should_receive(:error).
310
+ with(kind_of(String)).
311
+ once
312
+ end
297
313
  end
298
314
 
299
- it "handles exceptions in transmit" do
300
- subject.stub(:send_aggregators).and_raise(
301
- Exception.new('Message')
302
- )
315
+ context "with something in the aggregator queue" do
316
+ before do
317
+ subject.aggregator_queue.stub(:any? => true)
318
+ end
303
319
 
304
- Appsignal.logger.should_receive(:error).
305
- with(kind_of(String)).
306
- once
320
+ it "sends aggregators" do
321
+ subject.should_receive(:send_aggregators)
322
+ end
323
+ end
324
+
325
+ context "with empty aggregator and aggregator queue" do
326
+ it "does not send aggregators" do
327
+ subject.should_not_receive(:send_aggregators)
328
+ end
307
329
  end
308
330
 
309
331
  after { subject.send_queue }
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.11.13.beta.0
4
+ version: 0.11.13.beta.1
5
5
  prerelease: 8
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-07-08 00:00:00.000000000 Z
16
+ date: 2015-07-09 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rack