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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 756c150a23728cec1d98ae30f303bdd73380a35c
4
- data.tar.gz: bca41b183baf6e32283dca4873131c543667e0dc
3
+ metadata.gz: b534937f18014e6942e96590872f412395b628c7
4
+ data.tar.gz: 59e4b4d4ad5bb0eec58a9814a26680cb055966e9
5
5
  SHA512:
6
- metadata.gz: e2143e8018f3b30037001e3a97a14872eda5f3477e20e943cf203cb110e9b9d7ffc74ef032260a69508dd99e08d4f52df96e00d2eb4da6023cdc0979872959d3
7
- data.tar.gz: 57dc1ab983670990a8d4d19b33a84bedf694f3bc3170754bd3fe80c540cef5b34a344e42d619e752bf859aa4a2c0f98dee559fee571910728ca3233460a1aa14
6
+ metadata.gz: 5345239997a144a05a572da7744cb3eb3c405931c3b3b37b0a4c1fcc1e49db7778abc22d39733ad711dd28ed1e535197ec9f0aa0dd1e5c346cd0db326a03bb0a
7
+ data.tar.gz: b144ad46eba9528a1d98c08dd6ba6fd701e443ae7425a8a34390bde2dfd20bf88204430d7d4c6a57ec98c6965e2dcc87cf04b847d82b65f686a877f5a9a3bbb9
data/.gitignore CHANGED
@@ -2,7 +2,6 @@
2
2
  *.sassc
3
3
  .sass-cache
4
4
  capybara-*.html
5
- .rspec
6
5
  *.log
7
6
  /.bundle
8
7
  /vendor/bundle
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --order default
@@ -1,3 +1,7 @@
1
+ # 0.10.5
2
+ * Don't shutdown in `at_exit`
3
+ * Debug log about missing name in config
4
+
1
5
  # 0.10.4
2
6
  * Add REQUEST_URI and PATH_INFO to env params whitelist
3
7
 
@@ -52,7 +52,7 @@ module Appsignal
52
52
  @agent = Appsignal::Agent.new
53
53
  at_exit do
54
54
  logger.debug('Running at_exit block')
55
- @agent.shutdown(true, 'ran at_exit')
55
+ @agent.send_queue
56
56
  end
57
57
  else
58
58
  logger.info("Not starting, not active for #{config.env}")
@@ -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 && @aggregator.has_transactions?
144
+ send_queue if send_current_queue
144
145
  end
145
146
 
146
147
  protected
@@ -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?
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.10.4'
2
+ VERSION = '0.10.5'
3
3
  end
@@ -250,49 +250,61 @@ describe Appsignal::Agent do
250
250
  end
251
251
 
252
252
  describe "#send_queue" do
253
- it "transmits" do
254
- subject.aggregator.stub(:post_processed_queue! => :foo)
255
- subject.transmitter.should_receive(:transmit).with(:foo)
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
- it "handles the return code" do
259
- subject.transmitter.stub(:transmit => '200')
260
- subject.should_receive(:handle_result).with('200')
261
- end
259
+ context "with transactions" do
260
+ before do
261
+ subject.aggregator.stub(:has_transactions? => true)
262
+ end
262
263
 
263
- it "handle exceptions in post processing" do
264
- subject.aggregator.stub(:post_processed_queue!).and_raise(
265
- PostProcessingException.new('Message')
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
- it "handles exceptions in transmit" do
277
- subject.transmitter.stub(:transmit).and_raise(
278
- Exception.new('Message')
279
- )
280
-
281
- Appsignal.logger.should_receive(:error).
282
- with('Exception while sending queue: Message').
283
- once
284
- Appsignal.logger.should_receive(:error).
285
- with(kind_of(String)).
286
- once
287
- end
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
- it "handles an OpenSSL error in transmit" do
290
- subject.transmitter.stub(:transmit).and_raise(
291
- OpenSSL::SSL::SSLError.new('Message')
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
- Appsignal.logger.should_receive(:error).
295
- with('OpenSSL::SSL::SSLError: Message').once
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
- context "when not sending the current queue" do
346
- it "should log the reason for shutting down" do
347
- Appsignal.logger.should_receive(:info).with('Shutting down agent (shutting down)')
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
- context "when the queue is to be sent" do
368
- context "with an empty queue" do
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
- subject.shutdown(true, nil)
373
- end
374
- end
365
+ subject.shutdown(true, nil)
366
+ end
375
367
 
376
- context "with a queue with transactions" do
377
- it "should send the queue and shutdown" do
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
- subject.shutdown(true, nil)
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 and fill the config hash" do
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
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-04 00:00:00.000000000 Z
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