Class: Datadog::Transport::HTTP::Adapters::UnixSocket
- Defined in:
- lib/ddtrace/transport/http/adapters/unix_socket.rb
Overview
Adapter for Unix sockets
Defined Under Namespace
Classes: HTTP
Constant Summary
Constants inherited from Net
Instance Attribute Summary collapse
-
#filepath ⇒ Object
(also: #uds_path)
readonly
Returns the value of attribute filepath.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Attributes inherited from Net
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uds_path = nil, **options) ⇒ UnixSocket
constructor
deprecated
Deprecated.
Positional parameters are deprecated. Use named parameters instead.
- #open(&block) ⇒ Object
- #url ⇒ Object
Methods inherited from Net
Constructor Details
#initialize(uds_path = nil, **options) ⇒ UnixSocket
Deprecated.
Positional parameters are deprecated. Use named parameters instead.
Returns a new instance of UnixSocket.
19 20 21 22 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 19 def initialize(uds_path = nil, **) @filepath = uds_path || .fetch(:uds_path) @timeout = [:timeout] || Ext::Transport::UnixSocket::DEFAULT_TIMEOUT_SECONDS end |
Instance Attribute Details
#filepath ⇒ Object (readonly) Also known as: uds_path
Returns the value of attribute filepath.
12 13 14 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 12 def filepath @filepath end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
12 13 14 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 12 def timeout @timeout end |
Class Method Details
.build(agent_settings) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 24 def self.build(agent_settings) new( uds_path: agent_settings.uds_path, timeout: agent_settings.timeout_seconds, ) end |
Instance Method Details
#open(&block) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 31 def open(&block) # Open connection connection = HTTP.new( uds_path, read_timeout: timeout, continue_timeout: timeout ) connection.start(&block) end |
#url ⇒ Object
42 43 44 |
# File 'lib/ddtrace/transport/http/adapters/unix_socket.rb', line 42 def url "http+unix://#{uds_path}?timeout=#{timeout}" end |