logstash_writer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash_writer.rb +11 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9254bae4e4a6f114fd683a3509b576d272256e162ecc5722c8d1c7a78a3e25e3
|
4
|
+
data.tar.gz: 9e61badc96a9bc3028a15311117eb95b6d3f37c7c59d950d66fe76d223160363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97ebc1f452ecc063b81e534ffb87e62ac4f225101454494ad8058abc18cef6427986b93a8643bc87631fdbde9d629dbebb35a51936f403a20e2d84b5517086b5
|
7
|
+
data.tar.gz: 01f8be94cee73a68b228e69f55f4f2d8e6448f8d37d885427a741cb8786f4c8fc37e1a99567ee92c8133f27e3faded0f6b3b1ca19cfe0bc382696682b281b6c7
|
data/lib/logstash_writer.rb
CHANGED
@@ -121,7 +121,7 @@ class LogstashWriter
|
|
121
121
|
end
|
122
122
|
|
123
123
|
if e.has_key?("@metadata")
|
124
|
-
e[:@metadata] = (e[:@metadata] || {}).merge(e
|
124
|
+
e[:@metadata] = (e[:@metadata] || {}).merge(e.delete("@metadata"))
|
125
125
|
end
|
126
126
|
|
127
127
|
unless e.has_key?(:@metadata)
|
@@ -285,16 +285,20 @@ class LogstashWriter
|
|
285
285
|
@socket_mutex.synchronize do
|
286
286
|
if @current_target
|
287
287
|
begin
|
288
|
-
# Check that our socket is still good to go; if we don't do
|
289
|
-
# the other end can disconnect, and because we're never
|
290
|
-
# reading from the socket, we never get the EOFError
|
291
|
-
# results, and so the socket remains in CLOSE_WAIT
|
292
|
-
|
288
|
+
# Check that our socket is still good to go; if we don't do
|
289
|
+
# this, the other end can disconnect, and because we're never
|
290
|
+
# normally reading from the socket, we never get the EOFError
|
291
|
+
# that normally results, and so the socket remains in CLOSE_WAIT
|
292
|
+
# state *forever*. raising an ENOTCONN gets us into the
|
293
|
+
# SystemCallError rescue, which is where we want to be, and
|
294
|
+
# "Transport endpoint is not connected" seems like a suitably
|
295
|
+
# appropriate error to me under the circumstances.
|
296
|
+
raise Errno::ENOTCONN unless IO.select([@current_target.socket], [], [], 0).nil?
|
293
297
|
|
294
298
|
yield @current_target
|
295
299
|
@metrics[:connected].set({ server: @current_target.describe_peer }, 1)
|
296
300
|
done = true
|
297
|
-
rescue SystemCallError
|
301
|
+
rescue SystemCallError => ex
|
298
302
|
# Something went wrong during the send; disconnect from this
|
299
303
|
# server and recycle
|
300
304
|
@metrics[:write_exception].increment(server: @current_target.describe_peer, class: ex.class.to_s)
|