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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e58246b338b34f388628f0a2762c405d01a2ec9e715d572a45402a09825717fe
4
- data.tar.gz: 9d2dcfb7b76374143d26bca3981614b5e242afe5bd04119ce2e8a12a5461efa3
3
+ metadata.gz: 7c59c4eb36a3ebc1ac542ffc9bbc5f87d2756ec899c58a105976958f01821a3d
4
+ data.tar.gz: 17a66afc2d549cbf0234f03cca393bed5dd8c86dd6841ec26492625f4fdfe3d8
5
5
  SHA512:
6
- metadata.gz: fcfd998dab94f51aaf683f5c9a5089bde2c9c91ad4f39fd3fe0a6803d77faa1bc9617034033d755bef21e191f90a310cb127456f80157e95d3b6e12096702ee1
7
- data.tar.gz: bd7b3cc3eb63003ce7bdc1ed93df6caa98c0d5432e6bf9139c7d6a7c595e87ac1389e1e9bcbf657cdec9df0570501b909c59d57b169b91666e7d6cdea18a625d
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 [none|shard]
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
- `none` is the default. Operations are printed in the executed order.
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
- `shard` sorts sharded operations such as `select[...]` and
573
- `filter[...]` by their names. Sharded operations may be executed in
574
- parallel. So their order isn't stable. `shard` makes the order stable.
575
- Non sharded operations keep the executed order.
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 --shard_key timestamp --query message:hello
583
- #@sort-query-log-operations none
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
@@ -1,5 +1,12 @@
1
1
  # News
2
2
 
3
+ ## 1.8.7: 2026-09-06
4
+
5
+ ### Improvements
6
+
7
+ * `#@sort-query-log-operations`: Added `drilldown` sort key. `none`
8
+ sort key is removed. Use empty sort keys instead.
9
+
3
10
  ## 1.8.6: 2026-09-05
4
11
 
5
12
  ### Improvements
@@ -70,7 +70,7 @@ module Grntest
70
70
  @omitted = false
71
71
  @suppress_backtrace = true
72
72
  @collect_query_log = false
73
- @sort_query_log_operations = "none"
73
+ @sort_query_log_operations = []
74
74
  @debug = false
75
75
  @platform = guess_platform
76
76
  @benchmarks = []
@@ -309,7 +309,18 @@ module Grntest
309
309
  end
310
310
 
311
311
  def execute_directive_sort_query_log_operations(line, content, options)
312
- @context.sort_query_log_operations = options[0]
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
- sort_key = @context.sort_query_log_operations
976
- case sort_key
977
- when "shard"
978
- first_shard_select_index = nil
979
- first_shard_filter_index = nil
980
- statistic.each_operation.sort_by do |operation|
981
- i = operation[:i]
982
- name = operation[:name]
983
- if name.start_with?("select[")
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
- elsif name.start_with?("filter[")
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
 
@@ -14,5 +14,5 @@
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module Grntest
17
- VERSION = "1.8.6"
17
+ VERSION = "1.8.7"
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grntest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.6
4
+ version: 1.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou