Class: Datadog::Transport::HTTP::Adapters::UnixSocket::HTTP
- Inherits:
-
Net::HTTP
- Object
- Net::HTTP
- Datadog::Transport::HTTP::Adapters::UnixSocket::HTTP
- Defined in:
- lib/ddtrace/transport/http/adapters/unix_socket.rb
Overview
Re-implements Net:HTTP with underlying Unix socket
Constant Summary collapse
- DEFAULT_TIMEOUT =
1
Instance Attribute Summary collapse
-
#filepath ⇒ Object
(also: #uds_path)
readonly
Returns the value of attribute filepath.
-
#unix_socket ⇒ Object
readonly
Returns the value of attribute unix_socket.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(uds_path, options = {}) ⇒ HTTP
constructor
A new instance of HTTP.
Constructor Details
#initialize(uds_path, options = {}) ⇒ HTTP
Returns a new instance of HTTP.
56 57 58 59 60 61 62 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 56 def initialize(uds_path, = {}) super('localhost', 80) @filepath = uds_path @read_timeout = .fetch(:read_timeout, DEFAULT_TIMEOUT) @continue_timeout = .fetch(:continue_timeout, DEFAULT_TIMEOUT) @debug_output = [:debug_output] if .key?(:debug_output) end |
Instance Attribute Details
#filepath ⇒ Object (readonly) Also known as: uds_path
Returns the value of attribute filepath.
50 51 52 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 50 def filepath @filepath end |
#unix_socket ⇒ Object (readonly)
Returns the value of attribute unix_socket.
50 51 52 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 50 def unix_socket @unix_socket end |
Instance Method Details
#connect ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 64 def connect @unix_socket = UNIXSocket.open(uds_path) @socket = ::Net::BufferedIO.new(@unix_socket).tap do |socket| socket.read_timeout = @read_timeout socket.continue_timeout = @continue_timeout socket.debug_output = @debug_output end on_connect end |