logjam_agent 0.19.3 → 0.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logjam_agent/railtie.rb +3 -0
- data/lib/logjam_agent/version.rb +1 -1
- data/lib/logjam_agent/zmq_forwarder.rb +14 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bffe54ae7a2f79b516804c95ecf2a2272d3b1b7
|
4
|
+
data.tar.gz: 280a394d54ecf5d7fcb84dd78c15222746b77d2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00581356bef24ce775b29f9a201f2635909fb0fd36f73c9f0db2a741d40b3224d8557c2a7d57c17f964e4cffd2c213d78fa2c3a484fccdc4a5650cab6988362b
|
7
|
+
data.tar.gz: be04344959f08f5ee808e12f0c8450984e2d02f7ffddef88ba62c65f8c1b38fa63d74aa2b9fcd73e1cb3fcffd08de3212daebc64a81266392d7b270bb2efcab6
|
data/lib/logjam_agent/railtie.rb
CHANGED
@@ -72,6 +72,9 @@ module LogjamAgent
|
|
72
72
|
|
73
73
|
LogjamAgent.application_revision = `git rev-parse HEAD 2>/dev/null`.chomp rescue ""
|
74
74
|
|
75
|
+
# disable logjam request forwarding by default in test environment
|
76
|
+
LogjamAgent.disable! if Rails.env.test?
|
77
|
+
|
75
78
|
# patch controller testing to create a logjam request, because middlewares aren't executed
|
76
79
|
if Rails.env.test?
|
77
80
|
ActiveSupport.on_load(:action_controller) do
|
data/lib/logjam_agent/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module LogjamAgent
|
2
2
|
class ZMQForwarder
|
3
|
-
attr_reader :app, :env
|
3
|
+
attr_reader :app, :env, :connection_specs
|
4
4
|
|
5
5
|
include Util
|
6
6
|
|
@@ -10,24 +10,21 @@ module LogjamAgent
|
|
10
10
|
@env = args[1] || LogjamAgent.environment_name
|
11
11
|
@app_env = "#{@app}-#{@env}"
|
12
12
|
@config = default_options.merge!(opts)
|
13
|
+
@config[:host] = "localhost" if @config[:host].blank?
|
14
|
+
@connection_specs = @config[:host].split(',').map do |host|
|
15
|
+
augment_connection_spec(host, @config[:port])
|
16
|
+
end
|
13
17
|
@sequence = 0
|
14
18
|
end
|
15
19
|
|
16
20
|
def default_options
|
17
21
|
{
|
18
|
-
:host => "localhost",
|
19
22
|
:port => 9605,
|
20
23
|
:linger => 100,
|
21
24
|
:snd_hwm => 100,
|
22
25
|
}
|
23
26
|
end
|
24
27
|
|
25
|
-
def connection_specs
|
26
|
-
@connection_specs ||= @config[:host].split(',').map do |host|
|
27
|
-
augment_connection_spec(host, @config[:port])
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
28
|
@@mutex = Mutex.new
|
32
29
|
@@zmq_context = nil
|
33
30
|
|
@@ -44,17 +41,15 @@ module LogjamAgent
|
|
44
41
|
end
|
45
42
|
|
46
43
|
def socket
|
47
|
-
@socket
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
socket
|
57
|
-
end
|
44
|
+
return @socket if @socket
|
45
|
+
@socket = self.class.context.socket(ZMQ::PUSH)
|
46
|
+
at_exit { reset }
|
47
|
+
@socket.setsockopt(ZMQ::LINGER, @config[:linger])
|
48
|
+
@socket.setsockopt(ZMQ::SNDHWM, @config[:snd_hwm])
|
49
|
+
@connection_specs.each do |spec|
|
50
|
+
@socket.connect(spec)
|
51
|
+
end
|
52
|
+
@socket
|
58
53
|
end
|
59
54
|
|
60
55
|
def reset
|