rack-logstash 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/logstash.rb +9 -4
- data/lib/rack/logstash/transport.rb +17 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c1754225ede7a3f169dbd9df3f2c4c3e91ee014
|
4
|
+
data.tar.gz: 54b08203e18a32428929e01dc0093fb63cbdd00d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 569bdaf5fc7e02735ee6549388af45cadb0e1403f05f7af12223926065148bef741bde60de85ca3f59b30b98ffccc22a5f2e38c457a9e5c5b3dfaa784bf4b1fc
|
7
|
+
data.tar.gz: e83ea0a8bcb28dfca1ff4ceeaed27d2a24d797cef847ca55303a3b2dcc1da52d22d42ca9e2ab0b751475c3ad221db9f18f3c80a2958fffdd4cf7624b2baa6e32
|
data/lib/rack/logstash.rb
CHANGED
@@ -17,7 +17,12 @@ module Rack
|
|
17
17
|
|
18
18
|
begin
|
19
19
|
@app.call(env).tap do |response|
|
20
|
-
|
20
|
+
begin
|
21
|
+
log_request(env, response)
|
22
|
+
rescue StandardError => ex
|
23
|
+
$stderr.puts "Failed to log request: #{ex.message} (#{ex.class})"
|
24
|
+
$stderr.puts ex.backtrace.map { |l| " #{l}" }
|
25
|
+
end
|
21
26
|
end
|
22
27
|
rescue StandardError => ex
|
23
28
|
log_exception(env, ex)
|
@@ -131,9 +136,9 @@ module Rack
|
|
131
136
|
Hash[
|
132
137
|
env.map do |k, v|
|
133
138
|
unless v.is_a? Hash or
|
134
|
-
|
135
|
-
|
136
|
-
|
139
|
+
v.is_a? Array or
|
140
|
+
v.is_a? String or
|
141
|
+
v.is_a? Numeric
|
137
142
|
next nil
|
138
143
|
end
|
139
144
|
|
@@ -13,8 +13,13 @@ module Rack
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def send(s)
|
16
|
-
|
17
|
-
|
16
|
+
begin
|
17
|
+
@blmutex.synchronize { @backlog << s }
|
18
|
+
@sender.run
|
19
|
+
rescue StandardError => ex
|
20
|
+
$stderr.puts "Failed to send message: #{ex.message} (#{ex.class})"
|
21
|
+
$stderr.puts ex.backtrace.map { |l| " #{l}" }
|
22
|
+
end
|
18
23
|
end
|
19
24
|
|
20
25
|
def drain
|
@@ -40,9 +45,14 @@ module Rack
|
|
40
45
|
end
|
41
46
|
end
|
42
47
|
Thread.stop
|
43
|
-
rescue
|
44
|
-
|
48
|
+
rescue StandardError => ex
|
49
|
+
$stderr.puts "sender_thread crashed! #{ex.message} (#{ex.class})"
|
45
50
|
$stderr.puts ex.backtrace.map { |l| " #{l}" }
|
51
|
+
sleep 0.1
|
52
|
+
rescue Exception => ex
|
53
|
+
$stderr.puts "sender_thread is being killed by #{ex.class}"
|
54
|
+
@sender = nil
|
55
|
+
raise
|
46
56
|
end
|
47
57
|
end
|
48
58
|
end
|
@@ -70,9 +80,9 @@ module Rack
|
|
70
80
|
@parsed_url ||= URI(@url).tap do |url|
|
71
81
|
if url.scheme != "tcp"
|
72
82
|
raise ArgumentError,
|
73
|
-
|
74
|
-
|
75
|
-
|
83
|
+
"Unknown scheme for Logstash server URL: " +
|
84
|
+
url.scheme.inspect +
|
85
|
+
" (we only accept 'tcp')"
|
76
86
|
end
|
77
87
|
end
|
78
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-logstash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|