class ElasticAPM::Transport::Connection::ProxyPipe::Write
@api private
def bytes_sent
def bytes_sent @bytes_sent.value end
def close(reason = nil)
def close(reason = nil) debug("Closing writer with reason #{reason}") io.close end
def closed?
def closed? io.closed? end
def enable_compression!
def enable_compression! io.binmode @io = Zlib::GzipWriter.new(io) end
def initialize(io, compress: true)
def initialize(io, compress: true) @io = io @compress = compress @bytes_sent = Concurrent::AtomicFixnum.new(0) @config = ElasticAPM.agent&.config # this is silly, fix Logging return unless compress enable_compression! end
def write(str)
def write(str) io.puts(str).tap do @bytes_sent.update do |curr| @compress ? io.tell : curr + str.bytesize end end end