Class: Datadog::Core::Transport::HTTP::Adapters::UnixSocket
- Defined in:
- lib/datadog/core/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
-
.build(agent_settings) ⇒ Object
rubocop:enable Lint/MissingSuper.
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.
rubocop:disable Lint/MissingSuper
22 23 24 25 |
# File 'lib/datadog/core/transport/http/adapters/unix_socket.rb', line 22 def initialize(uds_path = nil, **) @filepath = uds_path || .fetch(:uds_path) @timeout = [:timeout] || Datadog::Core::Transport::Ext::UnixSocket::DEFAULT_TIMEOUT_SECONDS end |
Instance Attribute Details
#filepath ⇒ Object (readonly) Also known as: uds_path
Returns the value of attribute filepath.
14 15 16 |
# File 'lib/datadog/core/transport/http/adapters/unix_socket.rb', line 14 def filepath @filepath end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
14 15 16 |
# File 'lib/datadog/core/transport/http/adapters/unix_socket.rb', line 14 def timeout @timeout end |
Class Method Details
.build(agent_settings) ⇒ Object
rubocop:enable Lint/MissingSuper
28 29 30 31 32 33 |
# File 'lib/datadog/core/transport/http/adapters/unix_socket.rb', line 28 def self.build(agent_settings) new( uds_path: agent_settings.uds_path, timeout: agent_settings.timeout_seconds, ) end |
Instance Method Details
#open(&block) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/datadog/core/transport/http/adapters/unix_socket.rb', line 35 def open(&block) # Open connection connection = HTTP.new( uds_path, read_timeout: timeout, continue_timeout: timeout ) connection.start(&block) end |
#url ⇒ Object
46 47 48 |
# File 'lib/datadog/core/transport/http/adapters/unix_socket.rb', line 46 def url "http+unix://#{uds_path}?timeout=#{timeout}" end |