groonga-query-log 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19db4dbc5d30a42ab59bcf8f53ac7a0979868eec
4
- data.tar.gz: c5246d85603fff8aef80ddc32bae71ecdde03572
3
+ metadata.gz: ef3fb91d35e9b109dbe0ed81c97ecb0c375bd2a0
4
+ data.tar.gz: 11e6b3884e5562bd6c48a43d00ad7412b70c110b
5
5
  SHA512:
6
- metadata.gz: b96e3b574555936adb3d828abf724ed058e3235c52752b2448af96039882c472691c7437a133833a4f06936d6be77e8a7c028eb89e588cbddd548c3740b802dc
7
- data.tar.gz: 086037f92e27646a62f7f488ec3fa36cb5b49b909d29b63c3603422a62abfbd76aaf85aa68205b3a6a619b82444e773ba9790763af2e32c99dec9365f581390a
6
+ metadata.gz: 58de76b440c6422371b5d7c07af81739761326d31de648bcb305635e7d8a7a9b96efac1c43b29875fb89e1602641e49b51412712cf59a024e277071fcd75ec2d
7
+ data.tar.gz: b666945ee6ca3c20222af9289b95f5b18afe0671164d35479c70c5253fcd32f9aaa422ef9506726cc43c15ac6cf594a56fd601fa6a0cc634c71a3d553424acdc
@@ -1,5 +1,31 @@
1
1
  # News
2
2
 
3
+ ## 1.2.0: 2016-05-27
4
+
5
+ ### Improvements
6
+
7
+ * groonga-query-log-verify-server: Added `normalize` command to the
8
+ default check target commands.
9
+
10
+ * groonga-query-log-verify-server: Added `logical_shard_list`
11
+ command to the default check target commands.
12
+
13
+ * groonga-query-log-verify-server: Added `io_flush` command to the
14
+ default check target commands.
15
+
16
+ * groonga-query-log-verify-server: Added `object_exist` command to the
17
+ default check target commands.
18
+
19
+ * groonga-query-log-analyzer: Added `--target-commands` option.
20
+
21
+ * groonga-query-log-analyzer: Added `--target-tables` option.
22
+
23
+ ### Fixes
24
+
25
+ * Fixed undefined variable name error.
26
+
27
+ * groonga-query-log-analyzer: Fixed console output format
28
+
3
29
  ## 1.1.9: 2016-01-22
4
30
 
5
31
  ### Fixes
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2011-2016 Kouhei Sutou <kou@clear-code.com>
4
2
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
5
3
  #
6
4
  # This library is free software; you can redistribute it and/or
@@ -115,6 +113,8 @@ module Groonga
115
113
  @options[:output] = "-"
116
114
  @options[:slow_operation_threshold] = 0.1
117
115
  @options[:slow_response_threshold] = 0.2
116
+ @options[:target_commands] = nil
117
+ @options[:target_tables] = nil
118
118
  @options[:reporter] = "console"
119
119
  @options[:dynamic_sort] = true
120
120
  @options[:stream] = false
@@ -181,6 +181,22 @@ module Groonga
181
181
  @options[:slow_response_threshold] = threshold
182
182
  end
183
183
 
184
+ parser.on("--target-commands=COMMAND1,COMMAND2,...",
185
+ Array,
186
+ "Process only COMMANDS.",
187
+ "Example: --target-commands=select,logical_select",
188
+ "Process all commands by default") do |commands|
189
+ @options[:target_commands] = commands
190
+ end
191
+
192
+ parser.on("--target-tables=TABLE1,TABLE2,...",
193
+ Array,
194
+ "Process only TABLES.",
195
+ "Example: --target-tables=Items,Users",
196
+ "Process all tables by default") do |tables|
197
+ @options[:target_tables] = tables
198
+ end
199
+
184
200
  available_reporters = ["console", "json", "json-stream", "html"]
185
201
  parser.on("--reporter=REPORTER",
186
202
  available_reporters,
@@ -148,7 +148,7 @@ module Groonga
148
148
 
149
149
  def report_statistic(statistic)
150
150
  @index += 1
151
- write("%*d) %s" % [@digit, @index, format_heading(statistic)])
151
+ write("%*d) %s\n" % [@digit, @index, format_heading(statistic)])
152
152
  report_parameters(statistic)
153
153
  report_operations(statistic)
154
154
  end
@@ -92,7 +92,7 @@ module Groonga
92
92
  rescue JSON::ParserError
93
93
  puts(command)
94
94
  puts("failed to parse old response: #{$!.message}")
95
- puts(response1)
95
+ puts(response_old)
96
96
  valid = false
97
97
  end
98
98
 
@@ -101,7 +101,7 @@ module Groonga
101
101
  rescue JSON::ParserError
102
102
  puts(command)
103
103
  puts("failed to parse new response: #{$!.message}")
104
- puts(response2)
104
+ puts(response_new)
105
105
  valid = false
106
106
  end
107
107
 
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2011-2016 Kouhei Sutou <kou@clear-code.com>
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
6
4
  # modify it under the terms of the GNU Lesser General Public
@@ -27,6 +25,8 @@ module Groonga
27
25
  @options = options
28
26
  @slow_operation_threshold = options[:slow_operation_threshold]
29
27
  @slow_response_threshold = options[:slow_response_threshold]
28
+ @target_commands = options[:target_commands]
29
+ @target_tables = options[:target_tables]
30
30
  @parsing_statistics = {}
31
31
  end
32
32
 
@@ -84,6 +84,7 @@ module Groonga
84
84
  statistic = @parsing_statistics.delete(context_id)
85
85
  return if statistic.nil?
86
86
  statistic.finish(elapsed.to_i, return_code.to_i)
87
+ return unless target_statistic?(statistic)
87
88
  block.call(statistic)
88
89
  end
89
90
  end
@@ -98,6 +99,25 @@ module Groonga
98
99
  end
99
100
  statistic
100
101
  end
102
+
103
+ def target_statistic?(statistic)
104
+ if @target_commands
105
+ unless @target_commands.include?(statistic.command.name)
106
+ return false
107
+ end
108
+ end
109
+
110
+ if @target_tables
111
+ table = statistic.command["table"]
112
+ return false if table.nil?
113
+
114
+ unless @target_tables.include?(table)
115
+ return false
116
+ end
117
+ end
118
+
119
+ true
120
+ end
101
121
  end
102
122
  end
103
123
  end
@@ -154,9 +154,13 @@ module Groonga
154
154
  @disable_cache = false
155
155
  @output_path = nil
156
156
  @target_command_names = [
157
+ "io_flush",
157
158
  "logical_count",
158
159
  "logical_range_filter",
160
+ "logical_shard_list",
159
161
  "logical_select",
162
+ "normalize",
163
+ "object_exist",
160
164
  "select",
161
165
  ]
162
166
  @care_order = true
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Groonga
18
18
  module QueryLog
19
- VERSION = "1.1.9"
19
+ VERSION = "1.2.0"
20
20
  end
21
21
  end
@@ -13,24 +13,28 @@ Summary:
13
13
  Slow Operations:
14
14
 
15
15
  Slow Queries:
16
- 1) [2012-12-17 15:00:10.1-2012-12-17 15:00:10.1 (0.05231682)](0): table_create --name Comments --flags TABLE_HASH_KEY --key_type UInt32 name: <table_create>
16
+ 1) [2012-12-17 15:00:10.1-2012-12-17 15:00:10.1 (0.05231682)](0): table_create --name Comments --flags TABLE_HASH_KEY --key_type UInt32
17
+ name: <table_create>
17
18
  parameters:
18
19
  <name>: <Comments>
19
20
  <flags>: <TABLE_HASH_KEY>
20
21
  <key_type>: <UInt32>
21
22
 
22
- 2) [2012-12-17 15:00:10.1-2012-12-17 15:00:10.1 (0.04463578)](0): column_create --table Comments --name title --flags COLUMN_SCALAR --type ShortText name: <column_create>
23
+ 2) [2012-12-17 15:00:10.1-2012-12-17 15:00:10.1 (0.04463578)](0): column_create --table Comments --name title --flags COLUMN_SCALAR --type ShortText
24
+ name: <column_create>
23
25
  parameters:
24
26
  <table>: <Comments>
25
27
  <name>: <title>
26
28
  <flags>: <COLUMN_SCALAR>
27
29
  <type>: <ShortText>
28
30
 
29
- 3) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
31
+ 3) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
32
+ name: <load>
30
33
  parameters:
31
34
  <table>: <Video>
32
35
 
33
- 4) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select>
36
+ 4) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
37
+ name: <select>
34
38
  parameters:
35
39
  <table>: <Users>
36
40
  <query>: <follower:@groonga>
@@ -13,7 +13,8 @@ Summary:
13
13
  Slow Operations:
14
14
 
15
15
  Slow Queries:
16
- 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
17
+ name: <load>
17
18
  parameters:
18
19
  <table>: <Video>
19
20
 
@@ -1,10 +1,12 @@
1
1
 
2
2
  Slow Queries:
3
- 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
3
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
4
+ name: <load>
4
5
  parameters:
5
6
  <table>: <Video>
6
7
 
7
- 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select>
8
+ 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
9
+ name: <select>
8
10
  parameters:
9
11
  <table>: <Users>
10
12
  <query>: <follower:@groonga>
@@ -13,11 +13,13 @@ Summary:
13
13
  Slow Operations:
14
14
 
15
15
  Slow Queries:
16
- 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
17
+ name: <load>
17
18
  parameters:
18
19
  <table>: <Video>
19
20
 
20
- 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select>
21
+ 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
22
+ name: <select>
21
23
  parameters:
22
24
  <table>: <Users>
23
25
  <query>: <follower:@groonga>
@@ -13,7 +13,8 @@ Summary:
13
13
  Slow Operations:
14
14
 
15
15
  Slow Queries:
16
- 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select>
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
17
+ name: <select>
17
18
  parameters:
18
19
  <table>: <Users>
19
20
  <query>: <follower:@groonga>
@@ -22,7 +23,8 @@ Slow Queries:
22
23
  2) 0.00002795: select( 2)
23
24
  3) 0.00019585: output( 2) _key,name
24
25
 
25
- 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
26
+ 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
27
+ name: <load>
26
28
  parameters:
27
29
  <table>: <Video>
28
30
 
@@ -13,7 +13,8 @@ Summary:
13
13
  Slow Operations:
14
14
 
15
15
  Slow Queries:
16
- 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select>
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
17
+ name: <select>
17
18
  parameters:
18
19
  <table>: <Users>
19
20
  <query>: <follower:@groonga>
@@ -22,7 +23,8 @@ Slow Queries:
22
23
  2) 0.00002795: select( 2)
23
24
  3) 0.00019585: output( 2) _key,name
24
25
 
25
- 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
26
+ 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
27
+ name: <load>
26
28
  parameters:
27
29
  <table>: <Video>
28
30
 
@@ -13,11 +13,13 @@ Summary:
13
13
  Slow Operations:
14
14
 
15
15
  Slow Queries:
16
- 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
17
+ name: <load>
17
18
  parameters:
18
19
  <table>: <Video>
19
20
 
20
- 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select>
21
+ 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
22
+ name: <select>
21
23
  parameters:
22
24
  <table>: <Users>
23
25
  <query>: <follower:@groonga>
@@ -13,11 +13,13 @@ Summary:
13
13
  Slow Operations:
14
14
 
15
15
  Slow Queries:
16
- 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video name: <load>
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
17
+ name: <load>
17
18
  parameters:
18
19
  <table>: <Video>
19
20
 
20
- 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name name: <select>
21
+ 2) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
22
+ name: <select>
21
23
  parameters:
22
24
  <table>: <Users>
23
25
  <query>: <follower:@groonga>
@@ -0,0 +1,25 @@
1
+ Summary:
2
+ Threshold:
3
+ slow response : 0.2
4
+ slow operation : 0.1
5
+ # of responses : 1
6
+ # of slow responses : 0
7
+ responses/sec : 821.5981727656638
8
+ start time : 2012-12-12 17:39:17.3
9
+ last time : 2012-12-12 17:39:17.3
10
+ period(sec) : 0.00121714
11
+ slow response ratio : 0.000%
12
+ total response time : 0.00121714
13
+ Slow Operations:
14
+
15
+ Slow Queries:
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00121714)](0): select --table Users --query follower:@groonga --output_columns _key,name
17
+ name: <select>
18
+ parameters:
19
+ <table>: <Users>
20
+ <query>: <follower:@groonga>
21
+ <output_columns>: <_key,name>
22
+ 1) 0.00084295: filter( 2) query: follower:@groonga
23
+ 2) 0.00002795: select( 2)
24
+ 3) 0.00019585: output( 2) _key,name
25
+
@@ -0,0 +1,20 @@
1
+ Summary:
2
+ Threshold:
3
+ slow response : 0.2
4
+ slow operation : 0.1
5
+ # of responses : 1
6
+ # of slow responses : 0
7
+ responses/sec : 319.6056322182932
8
+ start time : 2012-12-12 17:39:17.3
9
+ last time : 2012-12-12 17:39:17.3
10
+ period(sec) : 0.003128856
11
+ slow response ratio : 0.000%
12
+ total response time : 0.003128856
13
+ Slow Operations:
14
+
15
+ Slow Queries:
16
+ 1) [2012-12-12 17:39:17.3-2012-12-12 17:39:17.3 (0.00312886)](0): load --table Video
17
+ name: <load>
18
+ parameters:
19
+ <table>: <Video>
20
+
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2014 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2014-2016 Kouhei Sutou <kou@clear-code.com>
4
2
  # Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
5
3
  #
6
4
  # This library is free software; you can redistribute it and/or
@@ -80,6 +78,20 @@ class AnalyzerTest < Test::Unit::TestCase
80
78
  assert_equal(expected_result, actual_result)
81
79
  end
82
80
 
81
+ def test_target_commands
82
+ actual_result = run_analyzer("--target-commands=select",
83
+ @query_log_path)
84
+ expected_result = expected_analyzed_query("target-commands.expected")
85
+ assert_equal(expected_result, actual_result)
86
+ end
87
+
88
+ def test_target_tables
89
+ actual_result = run_analyzer("--target-tables=Video",
90
+ @query_log_path)
91
+ expected_result = expected_analyzed_query("target-tables.expected")
92
+ assert_equal(expected_result, actual_result)
93
+ end
94
+
83
95
  def test_no_report_summary
84
96
  actual_result = run_analyzer("--no-report-summary", @query_log_path)
85
97
  expected_result = expected_analyzed_query("no-report-summary.expected")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-query-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: groonga-command-parser
@@ -228,6 +228,8 @@ files:
228
228
  - test/fixtures/reporter/html.expected
229
229
  - test/fixtures/reporter/json-stream.expected
230
230
  - test/fixtures/reporter/json.expected
231
+ - test/fixtures/target-commands.expected
232
+ - test/fixtures/target-tables.expected
231
233
  - test/helper.rb
232
234
  - test/run-test.rb
233
235
  - test/test-analyzer.rb
@@ -255,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
257
  version: '0'
256
258
  requirements: []
257
259
  rubyforge_project:
258
- rubygems_version: 2.4.5.1
260
+ rubygems_version: 2.5.1
259
261
  signing_key:
260
262
  specification_version: 4
261
263
  summary: Groonga-query-log is a collection of library and tools to process [Groonga](http://groonga.org/)'s
@@ -265,6 +267,8 @@ summary: Groonga-query-log is a collection of library and tools to process [Groo
265
267
  test_files:
266
268
  - test/test-analyzer.rb
267
269
  - test/fixtures/multi.expected
270
+ - test/fixtures/target-tables.expected
271
+ - test/fixtures/target-commands.expected
268
272
  - test/fixtures/n_entries.expected
269
273
  - test/fixtures/query.log
270
274
  - test/fixtures/other-query.log