Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,231 @@ TS exp_histo_sample
cnt:long
0
;

// -------------------------------------------------------------------------------

All aggs grouped by TBucket and Instance (time series mode)
required_capability: exponential_histogram_tech_preview
required_capability: ts_command_v0
required_capability: count_of_histogram_types

TS exp_histo_sample
| WHERE NOT STARTS_WITH(instance, "hand-rolled")
| WHERE TRANGE(to_datetime("2025-09-25T00:30:00Z"), to_datetime("2025-09-25T01:00:00Z"))
| STATS min = MIN(responseTime),
max = MAX(responseTime),
p90 = PERCENTILE(responseTime,90),
sum = SUM(responseTime),
avg = AVG(responseTime),
count = COUNT(responseTime)
BY instance, time=TBUCKET(10m)
| EVAL p90 = ROUND(p90, 1), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
| KEEP instance, time, min, max, p90, sum, avg, count
| SORT instance, time
;

instance:keyword | time:datetime | min:double | max:double | p90:double | sum:double | avg:double | count:long
instance-0 | 2025-09-25T00:30:00.000Z | 2.5E-4 | 1.291403 | 0.5 | 128.220162 | 0.1582965 | 810
instance-0 | 2025-09-25T00:40:00.000Z | 2.93E-4 | 1.381711 | 0.5 | 139.229386 | 0.1567898 | 888
instance-0 | 2025-09-25T00:50:00.000Z | 2.57E-4 | 1.337726 | 0.5 | 146.914416 | 0.1680943 | 874
instance-0 | 2025-09-25T01:00:00.000Z | 3.58E-4 | 1.384036 | 0.6 | 15.216617 | 0.1729161 | 88
instance-1 | 2025-09-25T00:30:00.000Z | 2.37E-4 | 0.144625 | 0.0 | 1.323601 | 0.0046119 | 287
instance-1 | 2025-09-25T00:40:00.000Z | 2.33E-4 | 0.189058 | 0.0 | 1.422738 | 0.0049746 | 286
instance-1 | 2025-09-25T00:50:00.000Z | 2.29E-4 | 0.06199 | 0.0 | 0.737455 | 0.0025695 | 287
instance-1 | 2025-09-25T01:00:00.000Z | 3.31E-4 | 0.252402 | 0.0 | 0.399745 | 0.0133248 | 30
instance-2 | 2025-09-25T00:30:00.000Z | 2.21E-4 | 0.136683 | 0.0 | 1.710478 | 0.0057982 | 295
instance-2 | 2025-09-25T00:40:00.000Z | 2.25E-4 | 0.098632 | 0.0 | 1.278917 | 0.0041255 | 310
instance-2 | 2025-09-25T00:50:00.000Z | 2.2E-4 | 0.092109 | 0.0 | 0.946027 | 0.0032622 | 290
instance-2 | 2025-09-25T01:00:00.000Z | 2.45E-4 | 0.008362 | 0.0 | 0.033433 | 0.0011529 | 29
;

// -------------------------------------------------------------------------------

All aggs grouped by Date Trunc and Instance (time series mode)
required_capability: exponential_histogram_tech_preview
required_capability: ts_command_v0
required_capability: count_of_histogram_types

TS exp_histo_sample
| WHERE NOT STARTS_WITH(instance, "hand-rolled")
| WHERE TRANGE(to_datetime("2025-09-25T00:30:00Z"), to_datetime("2025-09-25T01:00:00Z"))
| STATS min = MIN(responseTime),
max = MAX(responseTime),
p90 = PERCENTILE(responseTime,90),
sum = SUM(responseTime),
avg = AVG(responseTime),
count = COUNT(responseTime)
BY instance, time=date_trunc(10m, @timestamp)
| EVAL p90 = ROUND(p90, 1), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
| KEEP instance, time, min, max, p90, sum, avg, count
| SORT instance, time
;

instance:keyword | time:datetime | min:double | max:double | p90:double | sum:double | avg:double | count:long
instance-0 | 2025-09-25T00:30:00.000Z | 2.5E-4 | 1.291403 | 0.5 | 128.220162 | 0.1582965 | 810
instance-0 | 2025-09-25T00:40:00.000Z | 2.93E-4 | 1.381711 | 0.5 | 139.229386 | 0.1567898 | 888
instance-0 | 2025-09-25T00:50:00.000Z | 2.57E-4 | 1.337726 | 0.5 | 146.914416 | 0.1680943 | 874
instance-0 | 2025-09-25T01:00:00.000Z | 3.58E-4 | 1.384036 | 0.6 | 15.216617 | 0.1729161 | 88
instance-1 | 2025-09-25T00:30:00.000Z | 2.37E-4 | 0.144625 | 0.0 | 1.323601 | 0.0046119 | 287
instance-1 | 2025-09-25T00:40:00.000Z | 2.33E-4 | 0.189058 | 0.0 | 1.422738 | 0.0049746 | 286
instance-1 | 2025-09-25T00:50:00.000Z | 2.29E-4 | 0.06199 | 0.0 | 0.737455 | 0.0025695 | 287
instance-1 | 2025-09-25T01:00:00.000Z | 3.31E-4 | 0.252402 | 0.0 | 0.399745 | 0.0133248 | 30
instance-2 | 2025-09-25T00:30:00.000Z | 2.21E-4 | 0.136683 | 0.0 | 1.710478 | 0.0057982 | 295
instance-2 | 2025-09-25T00:40:00.000Z | 2.25E-4 | 0.098632 | 0.0 | 1.278917 | 0.0041255 | 310
instance-2 | 2025-09-25T00:50:00.000Z | 2.2E-4 | 0.092109 | 0.0 | 0.946027 | 0.0032622 | 290
instance-2 | 2025-09-25T01:00:00.000Z | 2.45E-4 | 0.008362 | 0.0 | 0.033433 | 0.0011529 | 29
;


// -------------------------------------------------------------------------------

All aggs grouped by Bucket and Instance (time series mode)
required_capability: exponential_histogram_tech_preview
required_capability: ts_command_v0
required_capability: count_of_histogram_types

TS exp_histo_sample
| WHERE NOT STARTS_WITH(instance, "hand-rolled")
| WHERE TRANGE(to_datetime("2025-09-25T00:30:00Z"), to_datetime("2025-09-25T01:00:00Z"))
| STATS min = MIN(responseTime),
max = MAX(responseTime),
p90 = PERCENTILE(responseTime,90),
sum = SUM(responseTime),
avg = AVG(responseTime),
count = COUNT(responseTime)
BY instance, time=Bucket(@timestamp, 10m)
| EVAL p90 = ROUND(p90, 1), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
| KEEP instance, time, min, max, p90, sum, avg, count
| SORT instance, time
;

instance:keyword | time:datetime | min:double | max:double | p90:double | sum:double | avg:double | count:long
instance-0 | 2025-09-25T00:30:00.000Z | 2.5E-4 | 1.291403 | 0.5 | 128.220162 | 0.1582965 | 810
instance-0 | 2025-09-25T00:40:00.000Z | 2.93E-4 | 1.381711 | 0.5 | 139.229386 | 0.1567898 | 888
instance-0 | 2025-09-25T00:50:00.000Z | 2.57E-4 | 1.337726 | 0.5 | 146.914416 | 0.1680943 | 874
instance-0 | 2025-09-25T01:00:00.000Z | 3.58E-4 | 1.384036 | 0.6 | 15.216617 | 0.1729161 | 88
instance-1 | 2025-09-25T00:30:00.000Z | 2.37E-4 | 0.144625 | 0.0 | 1.323601 | 0.0046119 | 287
instance-1 | 2025-09-25T00:40:00.000Z | 2.33E-4 | 0.189058 | 0.0 | 1.422738 | 0.0049746 | 286
instance-1 | 2025-09-25T00:50:00.000Z | 2.29E-4 | 0.06199 | 0.0 | 0.737455 | 0.0025695 | 287
instance-1 | 2025-09-25T01:00:00.000Z | 3.31E-4 | 0.252402 | 0.0 | 0.399745 | 0.0133248 | 30
instance-2 | 2025-09-25T00:30:00.000Z | 2.21E-4 | 0.136683 | 0.0 | 1.710478 | 0.0057982 | 295
instance-2 | 2025-09-25T00:40:00.000Z | 2.25E-4 | 0.098632 | 0.0 | 1.278917 | 0.0041255 | 310
instance-2 | 2025-09-25T00:50:00.000Z | 2.2E-4 | 0.092109 | 0.0 | 0.946027 | 0.0032622 | 290
instance-2 | 2025-09-25T01:00:00.000Z | 2.45E-4 | 0.008362 | 0.0 | 0.033433 | 0.0011529 | 29
;
// -------------------------------------------------------------------------------

Group Aggs By Date_Trunc and Instance (standard mode)
required_capability: exponential_histogram_tech_preview
required_capability: count_of_histogram_types

FROM exp_histo_sample
| WHERE NOT STARTS_WITH(instance, "hand-rolled")
| WHERE TRANGE(to_datetime("2025-09-25T00:30:00Z"), to_datetime("2025-09-25T01:00:00Z"))
| STATS min = MIN(responseTime),
max = MAX(responseTime),
p90 = PERCENTILE(responseTime,90),
sum = SUM(responseTime),
avg = AVG(responseTime),
count = COUNT(responseTime)
BY instance, time=date_trunc(10m, @timestamp)
| EVAL p90 = ROUND(p90, 1), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
| KEEP instance, time, min, max, p90, sum, avg, count
| SORT instance, time
;

instance:keyword | time:datetime | min:double | max:double | p90:double | sum:double | avg:double | count:long
instance-0 | 2025-09-25T00:30:00.000Z | 2.5E-4 | 1.291403 | 0.5 | 128.220162 | 0.1582965 | 810
instance-0 | 2025-09-25T00:40:00.000Z | 2.93E-4 | 1.381711 | 0.5 | 139.229386 | 0.1567898 | 888
instance-0 | 2025-09-25T00:50:00.000Z | 2.57E-4 | 1.337726 | 0.5 | 146.914416 | 0.1680943 | 874
instance-0 | 2025-09-25T01:00:00.000Z | 3.58E-4 | 1.384036 | 0.6 | 15.216617 | 0.1729161 | 88
instance-1 | 2025-09-25T00:30:00.000Z | 2.37E-4 | 0.144625 | 0.0 | 1.323601 | 0.0046119 | 287
instance-1 | 2025-09-25T00:40:00.000Z | 2.33E-4 | 0.189058 | 0.0 | 1.422738 | 0.0049746 | 286
instance-1 | 2025-09-25T00:50:00.000Z | 2.29E-4 | 0.06199 | 0.0 | 0.737455 | 0.0025695 | 287
instance-1 | 2025-09-25T01:00:00.000Z | 3.31E-4 | 0.252402 | 0.0 | 0.399745 | 0.0133248 | 30
instance-2 | 2025-09-25T00:30:00.000Z | 2.21E-4 | 0.136683 | 0.0 | 1.710478 | 0.0057982 | 295
instance-2 | 2025-09-25T00:40:00.000Z | 2.25E-4 | 0.098632 | 0.0 | 1.278917 | 0.0041255 | 310
instance-2 | 2025-09-25T00:50:00.000Z | 2.2E-4 | 0.092109 | 0.0 | 0.946027 | 0.0032622 | 290
instance-2 | 2025-09-25T01:00:00.000Z | 2.45E-4 | 0.008362 | 0.0 | 0.033433 | 0.0011529 | 29
;

// -------------------------------------------------------------------------------

Group Aggs By Bucket and Instance (standard mode)
required_capability: exponential_histogram_tech_preview
required_capability: count_of_histogram_types

FROM exp_histo_sample
| WHERE NOT STARTS_WITH(instance, "hand-rolled")
| WHERE TRANGE(to_datetime("2025-09-25T00:30:00Z"), to_datetime("2025-09-25T01:00:00Z"))
| STATS min = MIN(responseTime),
max = MAX(responseTime),
p90 = PERCENTILE(responseTime,90),
sum = SUM(responseTime),
avg = AVG(responseTime),
count = COUNT(responseTime)
BY instance, time=bucket(@timestamp, 10m)
| EVAL p90 = ROUND(p90, 1), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
| KEEP instance, time, min, max, p90, sum, avg, count
| SORT instance, time
;

instance:keyword | time:datetime | min:double | max:double | p90:double | sum:double | avg:double | count:long
instance-0 | 2025-09-25T00:30:00.000Z | 2.5E-4 | 1.291403 | 0.5 | 128.220162 | 0.1582965 | 810
instance-0 | 2025-09-25T00:40:00.000Z | 2.93E-4 | 1.381711 | 0.5 | 139.229386 | 0.1567898 | 888
instance-0 | 2025-09-25T00:50:00.000Z | 2.57E-4 | 1.337726 | 0.5 | 146.914416 | 0.1680943 | 874
instance-0 | 2025-09-25T01:00:00.000Z | 3.58E-4 | 1.384036 | 0.6 | 15.216617 | 0.1729161 | 88
instance-1 | 2025-09-25T00:30:00.000Z | 2.37E-4 | 0.144625 | 0.0 | 1.323601 | 0.0046119 | 287
instance-1 | 2025-09-25T00:40:00.000Z | 2.33E-4 | 0.189058 | 0.0 | 1.422738 | 0.0049746 | 286
instance-1 | 2025-09-25T00:50:00.000Z | 2.29E-4 | 0.06199 | 0.0 | 0.737455 | 0.0025695 | 287
instance-1 | 2025-09-25T01:00:00.000Z | 3.31E-4 | 0.252402 | 0.0 | 0.399745 | 0.0133248 | 30
instance-2 | 2025-09-25T00:30:00.000Z | 2.21E-4 | 0.136683 | 0.0 | 1.710478 | 0.0057982 | 295
instance-2 | 2025-09-25T00:40:00.000Z | 2.25E-4 | 0.098632 | 0.0 | 1.278917 | 0.0041255 | 310
instance-2 | 2025-09-25T00:50:00.000Z | 2.2E-4 | 0.092109 | 0.0 | 0.946027 | 0.0032622 | 290
instance-2 | 2025-09-25T01:00:00.000Z | 2.45E-4 | 0.008362 | 0.0 | 0.033433 | 0.0011529 | 29
;

// -------------------------------------------------------------------------------

// this specifically tests the interaction with PushCountQueryAndTagsToSource rule
Top level date group with no other groups (standard index)
required_capability: exponential_histogram_tech_preview
required_capability: count_of_histogram_types

FROM exp_histo_sample
| WHERE NOT STARTS_WITH(instance, "hand-rolled")
| WHERE TRANGE(to_datetime("2025-09-25T00:30:00Z"), to_datetime("2025-09-25T01:00:00Z"))
| STATS count = Count(responseTime) by time = Bucket(@timestamp, 10m)
| KEEP time, count
;
ignoreOrder:true

time:datetime | count:long
2025-09-25T00:30:00.000Z | 1392
2025-09-25T00:40:00.000Z | 1484
2025-09-25T00:50:00.000Z | 1451
2025-09-25T01:00:00.000Z | 147
;

// -------------------------------------------------------------------------------

// this specifically tests the interaction with PushCountQueryAndTagsToSource rule
Top level date group with no other groups (timeseries index)
required_capability: ts_command_v0
required_capability: exponential_histogram_tech_preview
required_capability: count_of_histogram_types

TS exp_histo_sample
| WHERE NOT STARTS_WITH(instance, "hand-rolled")
| WHERE TRANGE(to_datetime("2025-09-25T00:30:00Z"), to_datetime("2025-09-25T01:00:00Z"))
| STATS count = Count(responseTime) by time = Bucket(@timestamp, 10m)
| KEEP time, count
;
ignoreOrder:true

time:datetime | count:long
2025-09-25T00:30:00.000Z | 1392
2025-09-25T00:40:00.000Z | 1484
2025-09-25T00:50:00.000Z | 1451
2025-09-25T01:00:00.000Z | 147
;
Loading