Navigation Menu

Skip to content

Commit

Permalink
debugging in the process of adding preference
Browse files Browse the repository at this point in the history
  • Loading branch information
Missy authored and Missy committed May 2, 2013
1 parent f9e09f4 commit 4c982cd
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions squirrel/replay.rb
Expand Up @@ -120,10 +120,11 @@ def parse_logline(line, metaArray)
########################################################################################################################
class Replay

def initialize(logfile, host, port)
def initialize(logfile, host, port, preference)
@logfile = logfile
@host = host
@port = port
@preference = preference
end

def header()
Expand Down Expand Up @@ -151,6 +152,14 @@ def output(query, data, malformed=false)
end
end

def build_curl_command_string()
base_uri = "#{@host}:#{@port}/#{data['index']}/_search/"
if @preference[0]
base_uri.concat(@preference[1])
end
puts base_uri
end

########################################################################################################################
# Execute slow query from log #
########################################################################################################################
Expand All @@ -161,12 +170,13 @@ def execute_query(query, data)
data['new_timestamp'] = Time.now
data['new_start_time'] = Time.now.to_f * 1000
#puts "curl -s -XGET #{Settings.host}:#{Settings.port}/#{data['index']}/_search/ -d '#{query}'"
curl_result = `curl -s -XGET '#{@host}:#{@port}/#{data['index']}/_search/' -d '#{query}'`
data['new_end_time'] = Time.now.to_f * 1000
data['new_duration'] = data['new_end_time'] - data['new_start_time']
data['original_dur'] = data['took']
data = data.merge(JSON.parse(curl_result))
output(query, data)
build_curl_command_string
#curl_result = `curl -s -XGET '#{@host}:#{@port}/#{data['index']}/_search/' -d '#{query}'`
#data['new_end_time'] = Time.now.to_f * 1000
#data['new_duration'] = data['new_end_time'] - data['new_start_time']
#data['original_dur'] = data['took']
#data = data.merge(JSON.parse(curl_result))
#output(query, data)
else
puts "error don't know search type, please throw an exception here"
end
Expand Down

0 comments on commit 4c982cd

Please sign in to comment.