instrumental_agent 0.13.3 → 0.13.4
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 +3 -0
- data/lib/instrumental/agent.rb +1 -1
- data/lib/instrumental/version.rb +1 -1
- data/spec/agent_spec.rb +51 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e7ed24aefecf9dcaafe0e844de778dbffcdee97
|
4
|
+
data.tar.gz: 0e02a6016b87304d08510dec4018d589b9b58b19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc097c786b1b97206883cc0049f2841b1a9913a4364597ed0200f9ccb13fe91be118a1dbab1d90c774c0e014c11905b1f1da2d8a571669386c2b634b08273856
|
7
|
+
data.tar.gz: 05e415812768a7bc6df4095d7a0ad820c8ca8061a8a817e06fcab18490451e3be107c31602703da8b5217339a0dbb7a53724aa60f84d1256763baf6452ba7b83
|
data/CHANGELOG.md
CHANGED
data/lib/instrumental/agent.rb
CHANGED
@@ -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
|
data/lib/instrumental/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|