Method: Sensu::Client::Socket#process_data
- Defined in:
- lib/sensu/client/socket.rb
#process_data(data) ⇒ Object
Process the data received. This method validates the data encoding, provides ping/pong functionality, and passes potential check results on for further processing.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/sensu/client/socket.rb', line 144 def process_data(data) if data.strip == PING_REQUEST @logger.debug("socket received ping") respond("pong") else @logger.debug("socket received data", :data => data) unless valid_utf8?(data) @logger.warn("data from socket is not a valid UTF-8 sequence, processing it anyways", :data => data) end begin parse_check_result(data) rescue => error @logger.error("failed to process check result from socket", { :data => data, :error => error.to_s }) respond("invalid") end end end |