class Aws::ClientSideMonitoring::Publisher
@api private
Attributes
agent_host[R]
agent_port[R]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/aws-sdk-core/client_side_monitoring/publisher.rb, line 13 def initialize(opts = {}) @agent_host = opts[:agent_host] || "127.0.0.1" @agent_port = opts[:agent_port] @mutex = Mutex.new end
Public Instance Methods
agent_host=(value)
click to toggle source
# File lib/aws-sdk-core/client_side_monitoring/publisher.rb, line 25 def agent_host=(value) @mutex.synchronize do @agent_host = value end end
agent_port=(value)
click to toggle source
# File lib/aws-sdk-core/client_side_monitoring/publisher.rb, line 19 def agent_port=(value) @mutex.synchronize do @agent_port = value end end
publish(request_metrics)
click to toggle source
# File lib/aws-sdk-core/client_side_monitoring/publisher.rb, line 31 def publish(request_metrics) send_datagram(request_metrics.api_call.to_json) request_metrics.api_call_attempts.each do |attempt| send_datagram(attempt.to_json) end end
send_datagram(msg)
click to toggle source
# File lib/aws-sdk-core/client_side_monitoring/publisher.rb, line 38 def send_datagram(msg) if @agent_port socket = UDPSocket.new begin socket.connect(@agent_host, @agent_port) socket.send(msg, 0) rescue Errno::ECONNREFUSED # Drop on the floor end end end