def send_entity(entity:)
      return nil unless entity.sampled
      begin
        payload = %(#{@@protocol_header}#{@@protocol_delimiter}#{entity.to_json})
        logger.debug %(sending payload #{payload} to daemon at #{@address}.)
        @socket.send payload, 0
      rescue StandardError => e
        logger.warn %(failed to send payload due to #{e.message})
      end
    end
def send_entity(entity:)
      return nil unless entity.sampled
      begin
        payload = %(#{@@protocol_header}#{@@protocol_delimiter}#{entity.to_json})
        logger.debug %(sending payload #{payload} to daemon at #{@address}.)
        @socket.send payload, 0
      rescue StandardError => e
        logger.warn %(failed to send payload due to #{e.message})
      end
    end
Serializes a segment/subsegment and sends it to the X-Ray daemon
 over UDP. It is no-op for non-sampled entity.
 @param [Entity] entity The entity to send