Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

debugging in the process of adding preference

  • Loading branch information...
commit 4c982cdee625bbaff218b2e8f5baddc554ea8a0f 1 parent f9e09f4
Missy authored
Showing with 17 additions and 7 deletions.
  1. +17 −7 squirrel/replay.rb
View
24 squirrel/replay.rb
@@ -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()
@@ -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 #
########################################################################################################################
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.