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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6194bf38754cc2bd1e2a4f710f849062700bbef
4
- data.tar.gz: caa4203aefbdd9693a534c699d5cad7663455df8
3
+ metadata.gz: 6c1754225ede7a3f169dbd9df3f2c4c3e91ee014
4
+ data.tar.gz: 54b08203e18a32428929e01dc0093fb63cbdd00d
5
5
  SHA512:
6
- metadata.gz: 8cf5e13fa9c69cce9f5047d7b7cc7b0a753cfb4a1af861c1061bbb046d3683b13a2f4ee5dd862b1ebb365cc0f05caa2e69d2863e90a2d674172c3abd28cca6b3
7
- data.tar.gz: e7381665d393fd83333cc7b612ee76b9cc912daa4db3eb9b01f5826ad3945cc3b1af503a5a1bae914234d6bd18c176bcd1b6069428baa01205e6c678bb9585a2
6
+ metadata.gz: 569bdaf5fc7e02735ee6549388af45cadb0e1403f05f7af12223926065148bef741bde60de85ca3f59b30b98ffccc22a5f2e38c457a9e5c5b3dfaa784bf4b1fc
7
+ data.tar.gz: e83ea0a8bcb28dfca1ff4ceeaed27d2a24d797cef847ca55303a3b2dcc1da52d22d42ca9e2ab0b751475c3ad221db9f18f3c80a2958fffdd4cf7624b2baa6e32
@@ -17,7 +17,12 @@ module Rack
17
17
 
18
18
  begin
19
19
  @app.call(env).tap do |response|
20
- log_request(env, response)
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
- v.is_a? Array or
135
- v.is_a? String or
136
- v.is_a? Numeric
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
- @blmutex.synchronize { @backlog << s }
17
- @sender.run
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 Exception => ex
44
- @stderr.puts "sender_thread died! #{ex.message} (#{ex.class})"
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
- "Unknown scheme for Logstash server URL: " +
74
- url.scheme.inspect +
75
- " (we only accept 'tcp')"
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.1
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-04-12 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler