-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Hello,
First of all, thank you so much for this gem.
Unfortunately, we recently had some hiccups where our requests were blocked by the socket connection.
We have a pod running fluentd in our k8s cluster. sometimes this pod gets restarted. This caused our App to hang for minutes because of the TCP connection.
My current fix is a monkey patch for create_socket!
# frozen_string_literal: true
require 'fluent/logger/fluent_logger'
require 'socket'
module Logging
class NonBlockingFluentLogger < Fluent::Logger::FluentLogger
private
def create_socket!
addr_info = Socket.getaddrinfo(@host, @port, nil, :STREAM)
addr = addr_info[0]
@con = Socket.tcp(addr[3], @port.to_i, connect_timeout: 1.0)
rescue StandardError => e
@log.write "NonBlockingFluentLogger: Connect failed #{@host}:#{@port} - #{e.class}: #{e.message}\n"
nil
end
end
end
This seems to work for us. But I did not adapt it for SSL and older ruby versions (We use 3.4.4 btw).
Is there any way we could get this in Upstream?
Metadata
Metadata
Assignees
Labels
No labels