instrumental_agent 0.13.3 → 0.13.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5548f3026bc66fb92979da6fd2dd015caa6463f
4
- data.tar.gz: 542eb17f2e0b42163df6025a2183cd081eec3877
3
+ metadata.gz: 1e7ed24aefecf9dcaafe0e844de778dbffcdee97
4
+ data.tar.gz: 0e02a6016b87304d08510dec4018d589b9b58b19
5
5
  SHA512:
6
- metadata.gz: f112f43c1f9a13162ad72d2a57ab0fde0b3f83943c6e7f0a924677b127e22593685d363e5df4611cdd0e8a4afbd15836f3f563646731aa20b767d48bcbb454fe
7
- data.tar.gz: 85e72c43f368d72510f53b8f3bfeea6c0a4ec85db2b900b17bccf5fc673974ef81645b30501a079b2f4beb765a7032f9f5a8ae57499f731acaf0478d5076cfb7
6
+ metadata.gz: cc097c786b1b97206883cc0049f2841b1a9913a4364597ed0200f9ccb13fe91be118a1dbab1d90c774c0e014c11905b1f1da2d8a571669386c2b634b08273856
7
+ data.tar.gz: 05e415812768a7bc6df4095d7a0ad820c8ca8061a8a817e06fcab18490451e3be107c31602703da8b5217339a0dbb7a53724aa60f84d1256763baf6452ba7b83
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### 0.13.4 [October 6, 2015]
2
+ * Fixes for when agent times out communicating with server
3
+
1
4
  ### 0.13.3 [August 18, 2015]
2
5
  * Fixes for when agent is disconnected from server
3
6
 
@@ -458,7 +458,7 @@ module Instrumental
458
458
  case err
459
459
  when EOFError
460
460
  # nop
461
- when Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRINUSE
461
+ when Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRINUSE, Timeout::Error
462
462
  # If the connection has been refused by Instrumental
463
463
  # or we cannot reach the server
464
464
  # or the connection state of this socket is in a race
@@ -1,3 +1,3 @@
1
1
  module Instrumental
2
- VERSION = "0.13.3"
2
+ VERSION = "0.13.4"
3
3
  end
data/spec/agent_spec.rb CHANGED
@@ -534,6 +534,57 @@ shared_examples "Instrumental Agent" do
534
534
  attempted_resolutions.should == 2
535
535
  end
536
536
  end
537
+
538
+ it "should attempt to resolve DNS after a connection timeout" do
539
+ with_constants('Instrumental::Agent::CONNECT_TIMEOUT' => 1) do
540
+ attempted_opens = 0
541
+ open_sleep = 0
542
+ os = agent.method(:open_socket)
543
+ agent.stub(:open_socket) { |*args, &block| attempted_opens +=1 ; sleep(open_sleep) && os.call(*args) }
544
+
545
+ # Connect normally and start running worker loop
546
+ attempted_resolutions = 0
547
+ ga = Resolv.method(:getaddresses)
548
+ Resolv.stub(:getaddresses) { |*args, &block| attempted_resolutions +=1 ; ga.call(*args) }
549
+ agent.gauge('test', 1)
550
+ wait 2
551
+ attempted_resolutions.should == 1
552
+ attempted_opens.should == 1
553
+ agent.should be_running
554
+
555
+ # Setup a failure for the next command so we'll break out of the inner
556
+ # loop in run_worker_loop causing another call to open_socket
557
+ test_connection_fail = true
558
+ tc = agent.method(:test_connection)
559
+ agent.stub(:test_connection) { |*args, &block| test_connection_fail ? raise("fail") : tc.call(*args) }
560
+
561
+ # Setup a timeout failure in open_socket for the next command
562
+ open_sleep = 5
563
+
564
+ # 1. test_connection fails, triggering a retry, which hits open_socket
565
+ # 2. we hit open_socket, it times out causing worker thread to end
566
+ agent.gauge('test', 1)
567
+ wait 5
568
+ # On retry we attempt to open_socket, but this times out
569
+ attempted_opens.should == 2
570
+ # We don't resolve again yet, we just disconnect
571
+ attempted_resolutions.should == 1
572
+ agent.should_not be_running
573
+
574
+ # Make test_connection succeed on the next command
575
+ test_connection_fail = false
576
+ # Make open_socket succeed again
577
+ open_sleep = 0
578
+
579
+ # We reconnect on the next command
580
+ # The reconnect causes a new DNS resolution
581
+ agent.gauge('test', 1)
582
+ wait 5
583
+ attempted_resolutions.should == 2
584
+ attempted_opens.should == 3
585
+ agent.should be_running
586
+ end
587
+ end
537
588
  end
538
589
 
539
590
  describe Instrumental::Agent, "enabled with sync option" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instrumental_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elijah Miller
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-08-20 00:00:00.000000000 Z
14
+ date: 2015-10-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.4.8
109
+ rubygems_version: 2.4.5.1
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Agent for reporting data to instrumentalapp.com