grntest 1.8.6 → 1.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +27 -9
- data/doc/text/news.md +7 -0
- data/lib/grntest/execution-context.rb +1 -1
- data/lib/grntest/executors/base-executor.rb +47 -15
- data/lib/grntest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c59c4eb36a3ebc1ac542ffc9bbc5f87d2756ec899c58a105976958f01821a3d
|
|
4
|
+
data.tar.gz: 17a66afc2d549cbf0234f03cca393bed5dd8c86dd6841ec26492625f4fdfe3d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b4468d6a5513043ac62d1d5b1596d093a46bfaf9709f492500bacffa2de6c384fb564c00bacfaa2de659d805c092d6bffadb53991a46d3e2aa8bf54d388972b
|
|
7
|
+
data.tar.gz: b265cd5cd7cdca7eb31477feff524fc111b2d334a2e5f19495882dc2df83e2bb3a31c0ff9a1b7ba346a39622d181314545be251cd1fabba058712fb50db9710f
|
data/README.md
CHANGED
|
@@ -561,26 +561,44 @@ select Users --query _key:User1
|
|
|
561
561
|
Usage:
|
|
562
562
|
|
|
563
563
|
```
|
|
564
|
-
#@sort-query-log-operations [
|
|
564
|
+
#@sort-query-log-operations [SORT_KEY_1 SORT_KEY_2 ...]
|
|
565
565
|
```
|
|
566
566
|
|
|
567
567
|
It changes the order of operations in the collected query log. It
|
|
568
568
|
is useful with `collect-query-log` directive.
|
|
569
569
|
|
|
570
|
-
`
|
|
570
|
+
If no `SORT_KEY_N` is specified, no operation is sorted. This is the
|
|
571
|
+
default. Operations are printed in the executed order.
|
|
571
572
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
573
|
+
Here are available `SORT_KEY_N` s:
|
|
574
|
+
|
|
575
|
+
* `shard`: Sorts sharded operations such as `select[...]` and
|
|
576
|
+
`filter[...]` by their names. Sharded operations may be executed in
|
|
577
|
+
parallel. So their order isn't stable. `shard` makes the order
|
|
578
|
+
stable.
|
|
579
|
+
* `drilldown`: Sorts drilldown operations. Labeled drilldown
|
|
580
|
+
operations such as `drilldowns[...]` are sorted by their
|
|
581
|
+
names. Plain drilldown operations such as `drilldown(...): KEY` are
|
|
582
|
+
sorted by their keys. Drilldown operations may be executed in
|
|
583
|
+
parallel. So their order isn't stable. `drilldown` makes the order
|
|
584
|
+
stable. `drilldowns[...].sort` and `drilldown.sort` operations
|
|
585
|
+
aren't sorted because they are executed after all drilldown
|
|
586
|
+
operations are finished.
|
|
587
|
+
|
|
588
|
+
Operations that aren't matched with any `SORT_KEY_N` keep the executed
|
|
589
|
+
order. You can specify multiple `SORT_KEY_N` s at once.
|
|
576
590
|
|
|
577
591
|
Example:
|
|
578
592
|
|
|
579
593
|
```
|
|
580
594
|
#@collect-query-log true
|
|
581
|
-
#@sort-query-log-operations shard
|
|
582
|
-
logical_select Logs
|
|
583
|
-
|
|
595
|
+
#@sort-query-log-operations shard drilldown
|
|
596
|
+
logical_select Logs \
|
|
597
|
+
--shard_key timestamp \
|
|
598
|
+
--query message:hello \
|
|
599
|
+
--drilldowns[host].keys host \
|
|
600
|
+
--drilldowns[path].keys path
|
|
601
|
+
#@sort-query-log-operations
|
|
584
602
|
#@collect-query-log false
|
|
585
603
|
```
|
|
586
604
|
|
data/doc/text/news.md
CHANGED
|
@@ -309,7 +309,18 @@ module Grntest
|
|
|
309
309
|
end
|
|
310
310
|
|
|
311
311
|
def execute_directive_sort_query_log_operations(line, content, options)
|
|
312
|
-
|
|
312
|
+
sort_keys = options
|
|
313
|
+
valid_sort_keys = ["shard", "drilldown"]
|
|
314
|
+
unsupported_sort_keys = sort_keys - valid_sort_keys
|
|
315
|
+
if unsupported_sort_keys.empty?
|
|
316
|
+
@context.sort_query_log_operations = sort_keys
|
|
317
|
+
else
|
|
318
|
+
valid_sort_keys_label = "[#{valid_sort_keys.join(', ')}]"
|
|
319
|
+
message = "must be one of #{valid_sort_keys_label}"
|
|
320
|
+
log_error("#|e| [sort-query-log-operations] " +
|
|
321
|
+
"#{message}: unsupported values: " +
|
|
322
|
+
unsupported_sort_keys.collect {|key| "<#{key}>"}.join(", "))
|
|
323
|
+
end
|
|
313
324
|
end
|
|
314
325
|
|
|
315
326
|
def each_generated_series_chunk(template, start, stop)
|
|
@@ -972,28 +983,49 @@ module Grntest
|
|
|
972
983
|
end
|
|
973
984
|
|
|
974
985
|
def sort_operations(statistic)
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
986
|
+
sort_keys = @context.sort_query_log_operations
|
|
987
|
+
return statistic.each_operation if sort_keys.empty?
|
|
988
|
+
|
|
989
|
+
sort_shard = sort_keys.include?("shard")
|
|
990
|
+
sort_drilldown = sort_keys.include?("drilldown")
|
|
991
|
+
first_shard_select_index = nil
|
|
992
|
+
first_shard_filter_index = nil
|
|
993
|
+
first_drilldowns_index = nil
|
|
994
|
+
first_drilldown_index = nil
|
|
995
|
+
statistic.each_operation.sort_by do |operation|
|
|
996
|
+
i = operation[:i]
|
|
997
|
+
name = operation[:name]
|
|
998
|
+
if name.start_with?("select[")
|
|
999
|
+
if sort_shard
|
|
984
1000
|
first_shard_select_index ||= i
|
|
985
1001
|
[first_shard_select_index, name]
|
|
986
|
-
|
|
1002
|
+
else
|
|
1003
|
+
[i]
|
|
1004
|
+
end
|
|
1005
|
+
elsif name.start_with?("filter[")
|
|
1006
|
+
if sort_shard
|
|
987
1007
|
first_shard_filter_index ||= i
|
|
988
1008
|
[first_shard_filter_index, name]
|
|
989
1009
|
else
|
|
990
1010
|
[i]
|
|
991
1011
|
end
|
|
1012
|
+
elsif name.start_with?("drilldowns[")
|
|
1013
|
+
if sort_drilldown and not name.end_with?(".sort")
|
|
1014
|
+
first_drilldowns_index ||= i
|
|
1015
|
+
[first_drilldowns_index, name]
|
|
1016
|
+
else
|
|
1017
|
+
[i]
|
|
1018
|
+
end
|
|
1019
|
+
elsif name.start_with?("drilldown")
|
|
1020
|
+
if sort_drilldown and not name.end_with?(".sort")
|
|
1021
|
+
first_drilldown_index ||= i
|
|
1022
|
+
[first_drilldown_index, name, operation[:extra]]
|
|
1023
|
+
else
|
|
1024
|
+
[i]
|
|
1025
|
+
end
|
|
1026
|
+
else
|
|
1027
|
+
[i]
|
|
992
1028
|
end
|
|
993
|
-
when "none"
|
|
994
|
-
statistic.each_operation
|
|
995
|
-
else
|
|
996
|
-
raise Error.nw("unsupported sort-query-log-operations: #{sort_key}")
|
|
997
1029
|
end
|
|
998
1030
|
end
|
|
999
1031
|
|
data/lib/grntest/version.rb
CHANGED