diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-rate.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-rate.csv-spec index 25f3191caee06..edfe1cfee8d34 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-rate.csv-spec +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries-rate.csv-spec @@ -110,3 +110,99 @@ sum_bytes:double | max_bytes:double | min_bytes:double | avg_bytes:doubl 0.7751851851851852 | 0.17694444444444443 | 0.025925925925925936 | 0.08613168724279835 | 2024-05-09T23:30:00.000Z ; + +rate_of_expression +required_capability: metrics_command +TS k8s +| STATS rate_bytes_in=avg(rate(network.total_bytes_in) + 10) BY time_bucket = bucket(@timestamp,1minute) +| SORT rate_bytes_in DESC, time_bucket DESC | LIMIT 10; + +rate_bytes_in:double | time_bucket:datetime +null | 2024-05-10T00:01:00.000Z +38.80297619047619 | 2024-05-10T00:15:00.000Z +35.422222222222224 | 2024-05-10T00:04:00.000Z +34.28946078431372 | 2024-05-10T00:19:00.000Z +34.05555555555555 | 2024-05-10T00:10:00.000Z +32.54679487179487 | 2024-05-10T00:13:00.000Z +31.039819662685943 | 2024-05-10T00:17:00.000Z +30.4206673043201 | 2024-05-10T00:18:00.000Z +29.745833333333334 | 2024-05-10T00:00:00.000Z +29.4 | 2024-05-10T00:14:00.000Z +; + +rate_combined_avg +required_capability: metrics_command +TS k8s +| STATS avg_rate_bytes = avg(rate(network.total_bytes_in)), avg_rate_cost = avg(rate(network.total_cost)) BY cluster, time_bucket = bucket(@timestamp, 10minute) +| EVAL ratio = avg_rate_bytes / avg_rate_cost +| SORT time_bucket, cluster | LIMIT 10; + +avg_rate_bytes:double | avg_rate_cost:double | cluster:keyword | time_bucket:datetime | ratio:double +4.489054151267086 | 0.08727848310006986 | prod | 2024-05-10T00:00:00.000Z | 51.43368665241494 +9.933630806480615 | 0.1480786773651426 | qa | 2024-05-10T00:00:00.000Z | 67.08346524453067 +6.2165285757677635 | 0.08125606293033183 | staging | 2024-05-10T00:00:00.000Z | 76.50541204657867 +9.435761829894686 | 0.09789990135274192 | prod | 2024-05-10T00:10:00.000Z | 96.38172970059296 +11.21976172297114 | 0.13555566451825743 | qa | 2024-05-10T00:10:00.000Z | 82.76866749054221 +5.861581261551023 | 0.06909345577029162 | staging | 2024-05-10T00:10:00.000Z | 84.8355491298403 +2.8502443448121024 | 0.03328125 | prod | 2024-05-10T00:20:00.000Z | 85.6411446328519 +1.4602777777777782 | 0.03146701388888888 | qa | 2024-05-10T00:20:00.000Z | 46.4066206896552 +1.1196474788041055 | 0.026953703703703702 | staging | 2024-05-10T00:20:00.000Z | 41.53965225381086 +; + +rate_combined_sum +required_capability: metrics_command +TS k8s +| STATS sum_rate_bytes = sum(rate(network.total_bytes_in)), sum_rate_cost = sum(rate(network.total_cost)) BY cluster, time_bucket = bucket(@timestamp, 10minute) +| EVAL ratio = sum_rate_bytes / sum_rate_cost +| SORT time_bucket, cluster | LIMIT 10; + +sum_rate_bytes:double | sum_rate_cost:double | cluster:keyword | time_bucket:datetime | ratio:double +13.46716245380126 | 0.2618354493002096 | prod | 2024-05-10T00:00:00.000Z | 51.43368665241495 +29.800892419441844 | 0.44423603209542784 | qa | 2024-05-10T00:00:00.000Z | 67.08346524453067 +18.64958572730329 | 0.2437681887909955 | staging | 2024-05-10T00:00:00.000Z | 76.50541204657867 +28.307285489684055 | 0.29369970405822576 | prod | 2024-05-10T00:10:00.000Z | 96.38172970059294 +33.65928516891342 | 0.4066669935547723 | qa | 2024-05-10T00:10:00.000Z | 82.76866749054221 +17.584743784653067 | 0.20728036731087485 | staging | 2024-05-10T00:10:00.000Z | 84.8355491298403 +5.700488689624205 | 0.0665625 | prod | 2024-05-10T00:20:00.000Z | 85.6411446328519 +2.9205555555555565 | 0.06293402777777776 | qa | 2024-05-10T00:20:00.000Z | 46.4066206896552 +3.358942436412317 | 0.0808611111111111 | staging | 2024-05-10T00:20:00.000Z | 41.53965225381086 +; + +rate_of_ratio +required_capability: metrics_command +TS k8s +| STATS rate_of_ratio = sum(rate(network.total_cost) / rate(network.total_bytes_in)) BY cluster, time_bucket = bucket(@timestamp, 10minute) +| SORT time_bucket, cluster | LIMIT 10; + +rate_of_ratio:double | cluster:keyword | time_bucket:datetime +0.05729672905133547 | prod | 2024-05-10T00:00:00.000Z +0.04435305398953446 | qa | 2024-05-10T00:00:00.000Z +0.041268397742417876 | staging | 2024-05-10T00:00:00.000Z +0.030827104158756384 | prod | 2024-05-10T00:10:00.000Z +0.03694112891727294 | qa | 2024-05-10T00:10:00.000Z +0.03371556294613671 | staging | 2024-05-10T00:10:00.000Z +0.02425073340627254 | prod | 2024-05-10T00:20:00.000Z +0.05616345770915657 | qa | 2024-05-10T00:20:00.000Z +0.06756155922294359 | staging | 2024-05-10T00:20:00.000Z +; + +rate_of_long_grouping_1min_nulls +required_capability: metrics_command +TS k8s +| STATS rate_bytes_in=avg(rate(network.total_bytes_in)) BY cluster, time_bucket = bucket(@timestamp,2minute) +| SORT rate_bytes_in NULLS FIRST, time_bucket, cluster | LIMIT 10; + + rate_bytes_in:double | cluster:keyword | time_bucket:datetime + null | qa | 2024-05-10T00:00:00.000Z + null | staging | 2024-05-10T00:00:00.000Z + null | prod | 2024-05-10T00:06:00.000Z + null | prod | 2024-05-10T00:10:00.000Z + null | staging | 2024-05-10T00:10:00.000Z + null | qa | 2024-05-10T00:22:00.000Z + 0.0371323529411787 | staging | 2024-05-10T00:22:00.000Z + 0.42291666666666666 | qa | 2024-05-10T00:12:00.000Z + 2.27097222222222 | qa | 2024-05-10T00:20:00.000Z + 4.084868421052632 | staging | 2024-05-10T00:14:00.000Z + +; +