groonga-query-log 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +14 -0
- data/lib/groonga-query-log/command/extract.rb +2 -0
- data/lib/groonga-query-log/command/format-regression-test-logs.rb +24 -2
- data/lib/groonga-query-log/formattable.rb +7 -0
- data/lib/groonga-query-log/performance-verifier.rb +15 -3
- data/lib/groonga-query-log/server-verifier.rb +34 -13
- data/lib/groonga-query-log/version.rb +1 -1
- data/test/command/test-format-regression-test-logs.rb +20 -2
- data/test/fixtures/regression-test-logs/slow-elapsed-times.log +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fc818af1a75fea77eee79dc2b7852598ef14796e67a14d043449eebd31b3a15
|
4
|
+
data.tar.gz: 6c101e1c990a46aabc47208b1625db3db90152cbba9c7163fc5ee0e201b7f7a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 942d6b83901dcc4b2bccf8c8639da85cfac8472db3bd59738a8f386b9811c7bb141a7718a3140043b68cef0c71e3434cafabd9686e18a685ca49e0918da24321
|
7
|
+
data.tar.gz: 23c25f00387e3755908222434477d487c7f5f1a707c54f4a86d2969a17c3bb2fcfffbfe88bee7e157651665956b42aa3d27b1d54f2ac9d5246361886be235028
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.6.7: 2020-05-30
|
4
|
+
|
5
|
+
### Improves
|
6
|
+
|
7
|
+
* `extract`: Added support for no command request case such as `/`.
|
8
|
+
|
9
|
+
* `server-verifier`: Reduced the number of requests for performance
|
10
|
+
verification.
|
11
|
+
|
12
|
+
* `server-verifier`: Added all elapsed times on slow.
|
13
|
+
|
14
|
+
* `format-regression-test-logs`: Added support for all elapsed times
|
15
|
+
on slow.
|
16
|
+
|
3
17
|
## 1.6.6: 2020-05-20
|
4
18
|
|
5
19
|
### Fixes
|
@@ -74,6 +74,8 @@ module GroongaQueryLog
|
|
74
74
|
elapsed_time_old = nil
|
75
75
|
elapsed_time_new = nil
|
76
76
|
elapsed_time_ratio = nil
|
77
|
+
elapsed_times_old = nil
|
78
|
+
elapsed_times_new = nil
|
77
79
|
|
78
80
|
input.each_line do |line|
|
79
81
|
unless line.valid_encoding?
|
@@ -100,11 +102,21 @@ module GroongaQueryLog
|
|
100
102
|
elapsed_time_old = Float($POSTMATCH.chomp)
|
101
103
|
when /\Aelapsed_time_new: /
|
102
104
|
elapsed_time_new = Float($POSTMATCH.chomp)
|
105
|
+
when /\Aelapsed_times_old: /
|
106
|
+
elapsed_times_old = $POSTMATCH.chomp.split.collect do |value|
|
107
|
+
Float(value)
|
108
|
+
end
|
109
|
+
when /\Aelapsed_times_new: /
|
110
|
+
elapsed_times_new = $POSTMATCH.chomp.split.collect do |value|
|
111
|
+
Float(value)
|
112
|
+
end
|
103
113
|
when /\Aelapsed_time_ratio: /
|
104
114
|
elapsed_time_ratio = Float($POSTMATCH.chomp)
|
105
115
|
report_slow(command,
|
106
116
|
elapsed_time_old,
|
107
117
|
elapsed_time_new,
|
118
|
+
elapsed_times_old,
|
119
|
+
elapsed_times_new,
|
108
120
|
elapsed_time_ratio)
|
109
121
|
end
|
110
122
|
end
|
@@ -196,11 +208,21 @@ module GroongaQueryLog
|
|
196
208
|
def report_slow(command,
|
197
209
|
elapsed_time_old,
|
198
210
|
elapsed_time_new,
|
211
|
+
elapsed_times_old,
|
212
|
+
elapsed_times_new,
|
199
213
|
elapsed_time_ratio)
|
200
214
|
report_command(command)
|
215
|
+
elapsed_times_old ||= [elapsed_time_old]
|
216
|
+
elapsed_times_new ||= [elapsed_time_new]
|
201
217
|
@output.puts("Slow:")
|
202
|
-
@output.puts(" Old: %s" %
|
203
|
-
|
218
|
+
@output.puts(" Old: %s (%s)" % [
|
219
|
+
format_elapsed_time(elapsed_time_old),
|
220
|
+
format_elapsed_times(elapsed_times_old),
|
221
|
+
])
|
222
|
+
@output.puts(" New: %s (%s)" % [
|
223
|
+
format_elapsed_time(elapsed_time_new),
|
224
|
+
format_elapsed_times(elapsed_times_new),
|
225
|
+
])
|
204
226
|
@output.puts(" Ratio: +%.1f%%" % ((elapsed_time_ratio * 100) - 100))
|
205
227
|
end
|
206
228
|
|
@@ -30,5 +30,12 @@ module GroongaQueryLog
|
|
30
30
|
"%.1fmin" % (elapsed_time / 60)
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
def format_elapsed_times(elapsed_times)
|
35
|
+
formatted_epalsed_times = elapsed_times.collect do |elapsed_time|
|
36
|
+
format_elapsed_time(elapsed_time)
|
37
|
+
end
|
38
|
+
formatted_epalsed_times.join(" ")
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|
@@ -47,10 +47,18 @@ module GroongaQueryLog
|
|
47
47
|
diff_ratio > @threshold_ratio
|
48
48
|
end
|
49
49
|
|
50
|
+
def old_sorted_elapsed_times
|
51
|
+
collect_sorted_elapsed_times(@old_responses)
|
52
|
+
end
|
53
|
+
|
50
54
|
def old_elapsed_time
|
51
55
|
choose_target_elapsed_time(@old_responses)
|
52
56
|
end
|
53
57
|
|
58
|
+
def new_sorted_elapsed_times
|
59
|
+
collect_sorted_elapsed_times(@new_responses)
|
60
|
+
end
|
61
|
+
|
54
62
|
def new_elapsed_time
|
55
63
|
choose_target_elapsed_time(@new_responses)
|
56
64
|
end
|
@@ -66,18 +74,22 @@ module GroongaQueryLog
|
|
66
74
|
end
|
67
75
|
end
|
68
76
|
|
69
|
-
def
|
77
|
+
def collect_sorted_elapsed_times(responses)
|
70
78
|
elapsed_times = responses.collect do |response|
|
71
79
|
response.elapsed_time
|
72
80
|
end
|
73
|
-
|
81
|
+
elapsed_times.sort
|
82
|
+
end
|
83
|
+
|
84
|
+
def choose_target_elapsed_time(responses)
|
85
|
+
sorted_elapsed_times = collect_sorted_elapsed_times(responses)
|
74
86
|
|
75
87
|
strategy = @options.choose_strategy
|
76
88
|
case strategy
|
77
89
|
when :fastest
|
78
90
|
sorted_elapsed_times.first
|
79
91
|
when :median
|
80
|
-
sorted_elapsed_times[
|
92
|
+
sorted_elapsed_times[sorted_elapsed_times.size / 2]
|
81
93
|
else
|
82
94
|
message =
|
83
95
|
"choose strategy must be :fastest or :median: #{strategy.inspect}"
|
@@ -187,24 +187,38 @@ module GroongaQueryLog
|
|
187
187
|
return
|
188
188
|
end
|
189
189
|
|
190
|
-
|
190
|
+
if @options.verify_performance?
|
191
|
+
verify_performance(command, response1, response2)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def verify_performance(command, response1, response2)
|
191
196
|
responses1 = [response1]
|
192
197
|
responses2 = [response2]
|
193
|
-
n_tries = 4
|
194
|
-
n_tries.times do
|
195
|
-
responses1 << groonga1_client.execute(command)
|
196
|
-
responses2 << groonga2_client.execute(command)
|
197
|
-
end
|
198
198
|
verifier = PerformanceVerifier.new(command,
|
199
199
|
responses1,
|
200
200
|
responses2,
|
201
201
|
@options.performance_verifier_options)
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
202
|
+
return unless verifier.slow?
|
203
|
+
|
204
|
+
n_tries = 4
|
205
|
+
n_tries.times do
|
206
|
+
responses1 << groonga1_client.execute(command)
|
207
|
+
responses2 << groonga2_client.execute(command)
|
208
|
+
verifier = PerformanceVerifier.new(command,
|
209
|
+
responses1,
|
210
|
+
responses2,
|
211
|
+
@options.performance_verifier_options)
|
212
|
+
if verifier.slow?
|
213
|
+
@slow = true
|
214
|
+
@events.push([:slow,
|
215
|
+
command,
|
216
|
+
verifier.old_elapsed_time,
|
217
|
+
verifier.new_elapsed_time,
|
218
|
+
verifier.old_sorted_elapsed_time,
|
219
|
+
verifier.new_sorted_elapsed_time])
|
220
|
+
return
|
221
|
+
end
|
208
222
|
end
|
209
223
|
end
|
210
224
|
|
@@ -233,11 +247,18 @@ module GroongaQueryLog
|
|
233
247
|
output.flush
|
234
248
|
end
|
235
249
|
|
236
|
-
def report_slow(output,
|
250
|
+
def report_slow(output,
|
251
|
+
command,
|
252
|
+
old_elapsed_time,
|
253
|
+
new_elapsed_time,
|
254
|
+
old_sorted_elapsed_times,
|
255
|
+
new_sorted_elapsed_times)
|
237
256
|
command_source = command.original_source || command.to_uri_format
|
238
257
|
output.puts("command: #{command_source}")
|
239
258
|
output.puts("elapsed_time_old: #{old_elapsed_time}")
|
240
259
|
output.puts("elapsed_time_new: #{new_elapsed_time}")
|
260
|
+
output.puts("elapsed_times_old: #{old_sorted_elapsed_times.join(' ')}")
|
261
|
+
output.puts("elapsed_times_new: #{new_sorted_elapsed_times.join(' ')}")
|
241
262
|
output.puts("elapsed_time_ratio: #{new_elapsed_time / old_elapsed_time}")
|
242
263
|
output.flush
|
243
264
|
end
|
@@ -109,14 +109,32 @@ Arguments:
|
|
109
109
|
query: column_create
|
110
110
|
table: Entries
|
111
111
|
Slow:
|
112
|
-
Old: 174.8usec
|
113
|
-
New: 201.7usec
|
112
|
+
Old: 174.8usec (174.8usec)
|
113
|
+
New: 201.7usec (201.7usec)
|
114
114
|
Ratio: +15.4%
|
115
115
|
OUTPUT
|
116
116
|
assert_equal([true, output],
|
117
117
|
run_command([fixture_path("slow.log")]))
|
118
118
|
end
|
119
119
|
|
120
|
+
def test_slow_elapsed_times
|
121
|
+
output = <<-OUTPUT
|
122
|
+
Command:
|
123
|
+
/d/select?match_columns=description&query=column_create&table=Entries
|
124
|
+
Name: select
|
125
|
+
Arguments:
|
126
|
+
match_columns: description
|
127
|
+
query: column_create
|
128
|
+
table: Entries
|
129
|
+
Slow:
|
130
|
+
Old: 174.8usec (174.8usec 184.8usec)
|
131
|
+
New: 201.7usec (201.7usec 211.7usec)
|
132
|
+
Ratio: +15.4%
|
133
|
+
OUTPUT
|
134
|
+
assert_equal([true, output],
|
135
|
+
run_command([fixture_path("slow-elapsed-times.log")]))
|
136
|
+
end
|
137
|
+
|
120
138
|
sub_test_case(".new") do
|
121
139
|
def setup
|
122
140
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
command: /d/select?match_columns=description&query=column_create&table=Entries
|
2
|
+
elapsed_time_old: 0.0001747608184814453
|
3
|
+
elapsed_time_new: 0.0002017021179199219
|
4
|
+
elapsed_times_old: 0.0001747608184814453 0.0001847608184814453
|
5
|
+
elapsed_times_new: 0.0002017021179199219 0.0002117021179199219
|
6
|
+
elapsed_time_ratio: 1.154160982264666
|
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.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charty
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- test/fixtures/query.log
|
273
273
|
- test/fixtures/regression-test-logs/command-format.log
|
274
274
|
- test/fixtures/regression-test-logs/error.log
|
275
|
+
- test/fixtures/regression-test-logs/slow-elapsed-times.log
|
275
276
|
- test/fixtures/regression-test-logs/slow.log
|
276
277
|
- test/fixtures/regression-test-logs/url-format.log
|
277
278
|
- test/fixtures/reporter/console.expected
|
@@ -345,6 +346,7 @@ test_files:
|
|
345
346
|
- test/fixtures/query.log
|
346
347
|
- test/fixtures/regression-test-logs/command-format.log
|
347
348
|
- test/fixtures/regression-test-logs/error.log
|
349
|
+
- test/fixtures/regression-test-logs/slow-elapsed-times.log
|
348
350
|
- test/fixtures/regression-test-logs/slow.log
|
349
351
|
- test/fixtures/regression-test-logs/url-format.log
|
350
352
|
- test/fixtures/reporter/console.expected
|