[Groonga-commit] groonga/groonga-query-log at ea4bdb9 [master] replayer: add --target-command-names option

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Sep 24 12:03:03 JST 2013


Kouhei Sutou	2013-09-24 12:03:03 +0900 (Tue, 24 Sep 2013)

  New Revision: ea4bdb9f6d6ab39aff5cdbc53ccca63dbcc47a2e
  https://github.com/groonga/groonga-query-log/commit/ea4bdb9f6d6ab39aff5cdbc53ccca63dbcc47a2e

  Message:
    replayer: add --target-command-names option

  Modified files:
    lib/groonga/query-log/command/replay.rb
    lib/groonga/query-log/replayer.rb

  Modified: lib/groonga/query-log/command/replay.rb (+15 -0)
===================================================================
--- lib/groonga/query-log/command/replay.rb    2013-09-24 11:58:40 +0900 (71b76d2)
+++ lib/groonga/query-log/command/replay.rb    2013-09-24 12:03:03 +0900 (1ef237d)
@@ -84,6 +84,21 @@ module Groonga
             @options.disable_cache = true
           end
 
+          parser.on("--target-cmmand-name=NAME",
+                    "Add NAME to target command names",
+                    "You can specify this option zero or more times",
+                    "See also --target-command-names") do |name|
+            @options.target_command_names << name
+          end
+
+          target_command_names_label =****@optio*****_command_names.join(", ")
+          parser.on("--target-cmmand-names=NAME1,NAME2,...", Array
+                    "Replay only NAME1,NAME2,... commands",
+                    "You can use glob to choose command name",
+                    "[#{target_command_names_label}]") do |names|
+            @options.target_command_names = names
+          end
+
           parser.on("--output-requests=PATH",
                     "Output requests to PATH",
                     "[not output]") do |path|

  Modified: lib/groonga/query-log/replayer.rb (+5 -0)
===================================================================
--- lib/groonga/query-log/replayer.rb    2013-09-24 11:58:40 +0900 (fa063b1)
+++ lib/groonga/query-log/replayer.rb    2013-09-24 12:03:03 +0900 (8aad26e)
@@ -48,6 +48,7 @@ module Groonga
           id = 0
           @options.create_request_output do |output|
             parser.parse(input) do |statistic|
+              next unless target_command?(statistic.command)
               # TODO: validate orignal_source is one line
               output.puts(statistic.command.original_source)
               @queue.push([id, statistic])
@@ -112,6 +113,10 @@ module Groonga
         end
       end
 
+      def target_command?(command)
+        @options.target_command_name?(command.name)
+      end
+
       class NullOutput
         class << self
           def open
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index