Class: Datadog::Statsd::ConnectionCfg
- Inherits:
-
Object
- Object
- Datadog::Statsd::ConnectionCfg
- Defined in:
- lib/datadog/statsd/connection_cfg.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#socket_path ⇒ Object
readonly
Returns the value of attribute socket_path.
-
#transport_type ⇒ Object
readonly
Returns the value of attribute transport_type.
Instance Method Summary collapse
-
#initialize(host: nil, port: nil, socket_path: nil) ⇒ ConnectionCfg
constructor
A new instance of ConnectionCfg.
- #make_connection(**params) ⇒ Object
Constructor Details
#initialize(host: nil, port: nil, socket_path: nil) ⇒ ConnectionCfg
Returns a new instance of ConnectionCfg.
9 10 11 12 13 |
# File 'lib/datadog/statsd/connection_cfg.rb', line 9 def initialize(host: nil, port: nil, socket_path: nil) initialize_with_constructor_args(host: host, port: port, socket_path: socket_path) || initialize_with_env_vars || initialize_with_defaults end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/datadog/statsd/connection_cfg.rb', line 4 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/datadog/statsd/connection_cfg.rb', line 5 def port @port end |
#socket_path ⇒ Object (readonly)
Returns the value of attribute socket_path.
6 7 8 |
# File 'lib/datadog/statsd/connection_cfg.rb', line 6 def socket_path @socket_path end |
#transport_type ⇒ Object (readonly)
Returns the value of attribute transport_type.
7 8 9 |
# File 'lib/datadog/statsd/connection_cfg.rb', line 7 def transport_type @transport_type end |
Instance Method Details
#make_connection(**params) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/datadog/statsd/connection_cfg.rb', line 15 def make_connection(**params) case @transport_type when :udp UDPConnection.new(@host, @port, **params) when :uds UDSConnection.new(@socket_path, **params) end end |