Class: XRay::DaemonConfig
- Inherits:
-
Object
- Object
- XRay::DaemonConfig
- Defined in:
- lib/aws-xray-sdk/daemon_config.rb
Overview
The class that stores X-Ray daemon configuration about the ip address and
port for UDP and TCP port. It gets the address string from
AWS_XRAY_DAEMON_ADDRESS
and then from recorder's
configuration for daemon_address
. A notation of
127.0.0.1:2000
or tcp:127.0.0.1:2000
udp:127.0.0.2:2001
are both acceptable. The former one means UDP and
TCP are running at the same address. By default it assumes a X-Ray daemon
running at 127.0.0.1:2000
listening to both UDP and TCP
traffic.
Constant Summary collapse
- DAEMON_ADDRESS_KEY =
'AWS_XRAY_DAEMON_ADDRESS'.freeze
- @@dafault_addr =
'127.0.0.1:2000'
Instance Attribute Summary collapse
-
#tcp_ip ⇒ Object
readonly
Returns the value of attribute tcp_ip.
-
#tcp_port ⇒ Object
readonly
Returns the value of attribute tcp_port.
-
#udp_ip ⇒ Object
readonly
Returns the value of attribute udp_ip.
-
#udp_port ⇒ Object
readonly
Returns the value of attribute udp_port.
Instance Method Summary collapse
-
#initialize(addr: @@dafault_addr) ⇒ DaemonConfig
constructor
A new instance of DaemonConfig.
- #update_address(v) ⇒ Object
Constructor Details
#initialize(addr: @@dafault_addr) ⇒ DaemonConfig
Returns a new instance of DaemonConfig
17 18 19 |
# File 'lib/aws-xray-sdk/daemon_config.rb', line 17 def initialize(addr: @@dafault_addr) update_address(addr) end |
Instance Attribute Details
#tcp_ip ⇒ Object (readonly)
Returns the value of attribute tcp_ip
14 15 16 |
# File 'lib/aws-xray-sdk/daemon_config.rb', line 14 def tcp_ip @tcp_ip end |
#tcp_port ⇒ Object (readonly)
Returns the value of attribute tcp_port
14 15 16 |
# File 'lib/aws-xray-sdk/daemon_config.rb', line 14 def tcp_port @tcp_port end |
#udp_ip ⇒ Object (readonly)
Returns the value of attribute udp_ip
14 15 16 |
# File 'lib/aws-xray-sdk/daemon_config.rb', line 14 def udp_ip @udp_ip end |
#udp_port ⇒ Object (readonly)
Returns the value of attribute udp_port
14 15 16 |
# File 'lib/aws-xray-sdk/daemon_config.rb', line 14 def udp_port @udp_port end |
Instance Method Details
#update_address(v) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/aws-xray-sdk/daemon_config.rb', line 21 def update_address(v) v = ENV[DAEMON_ADDRESS_KEY] || v update_addr(v) rescue StandardError raise InvalidDaemonAddressError, %(Invalid X-Ray daemon address specified: #{v}.) end |