Skip to content

Commit b563145

Browse files
authored
Rename METRICS command to TS (#126064)
- Rename METRICS to TS - Disable time-series tests in mixed clusters until the development stabilizes.
1 parent 552066e commit b563145

File tree

30 files changed

+946
-943
lines changed

30 files changed

+946
-943
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/TimeSeriesAggregationOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Operator get(DriverContext driverContext) {
4646

4747
@Override
4848
public String describe() {
49-
return "MetricsAggregationOperator[mode = "
49+
return "TimeSeriesAggregationOperator[mode = "
5050
+ "<not-needed>"
5151
+ ", aggs = "
5252
+ aggregators.stream().map(Describable::describe).collect(joining(", "))

x-pack/plugin/esql/qa/server/mixed-cluster/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/mixed/MixedClusterEsqlSpecIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ protected void shouldSkipTest(String testName) throws IOException {
7070
assumeTrue("Test " + testName + " is skipped on " + bwcVersion, isEnabled(testName, instructions, bwcVersion));
7171
}
7272

73+
@Override
74+
protected boolean supportTimeSeriesCommand() {
75+
return false;
76+
}
77+
7378
@Override
7479
protected boolean enableRoundingDoubleValuesOnAsserting() {
7580
return true;

x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ protected void shouldSkipTest(String testName) throws IOException {
132132
assumeFalse("UNMAPPED FIELDS not yet supported in CCS", testCase.requiredCapabilities.contains(UNMAPPED_FIELDS.capabilityName()));
133133
}
134134

135+
@Override
136+
protected boolean supportTimeSeriesCommand() {
137+
return false;
138+
}
139+
135140
private TestFeatureService remoteFeaturesService() throws IOException {
136141
if (remoteFeaturesService == null) {
137142
var remoteNodeVersions = readVersionsFromNodesInfo(remoteClusterClient());
@@ -246,7 +251,7 @@ static CsvSpecReader.CsvTestCase convertToRemoteIndices(CsvSpecReader.CsvTestCas
246251
var newFrom = "FROM " + remoteIndices + " " + commands[0].substring(fromStatement.length());
247252
testCase.query = newFrom + query.substring(first.length());
248253
}
249-
if (commands[0].toLowerCase(Locale.ROOT).startsWith("metrics")) {
254+
if (commands[0].toLowerCase(Locale.ROOT).startsWith("ts ")) {
250255
String[] parts = commands[0].split("\\s+");
251256
assert parts.length >= 2 : commands[0];
252257
String[] indices = parts[1].split(",");

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.deleteInferenceEndpoint;
7171
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.loadDataSetIntoEs;
7272
import static org.elasticsearch.xpack.esql.EsqlTestUtils.classpathResources;
73+
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.METRICS_COMMAND;
7374
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.SOURCE_FIELD_MAPPING;
7475

7576
// This test can run very long in serverless configurations
@@ -176,6 +177,16 @@ protected void shouldSkipTest(String testName) throws IOException {
176177
if (supportsSourceFieldMapping() == false) {
177178
assumeFalse("source mapping tests are muted", testCase.requiredCapabilities.contains(SOURCE_FIELD_MAPPING.capabilityName()));
178179
}
180+
if (testCase.requiredCapabilities.contains(METRICS_COMMAND.capabilityName())) {
181+
assumeTrue("Skip time-series tests in mixed clusters until the development stabilizes", supportTimeSeriesCommand());
182+
}
183+
}
184+
185+
/**
186+
* Skip time-series tests in mixed clusters until the development stabilizes
187+
*/
188+
protected boolean supportTimeSeriesCommand() {
189+
return true;
179190
}
180191

181192
protected static void checkCapabilities(RestClient client, TestFeatureService testFeatureService, String testName, CsvTestCase testCase)

x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-metrics.csv-spec renamed to x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries.csv-spec

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
metricsWithoutAggs
1+
timeseriesWithoutAggs
22
required_capability: metrics_command
3-
METRICS k8s | sort @timestamp DESC, cluster, pod | keep @timestamp,cluster,pod,network.bytes_in,network.cost | limit 5;
3+
TS k8s | sort @timestamp DESC, cluster, pod | keep @timestamp,cluster,pod,network.bytes_in,network.cost | limit 5;
44

55
@timestamp:datetime | cluster:keyword | pod: keyword| network.bytes_in:long | network.cost:double
66
2024-05-10T00:22:59.000Z | qa | one | 206 | 6.25
@@ -10,10 +10,10 @@ METRICS k8s | sort @timestamp DESC, cluster, pod | keep @timestamp,cluster,pod,n
1010
2024-05-10T00:22:49.000Z | staging | two | 3 | 1.75
1111
;
1212

13-
metricsWithAggsAndSourceQuoting
13+
timeseriesWithAggsAndSourceQuoting
1414
required_capability: metrics_command
1515
required_capability: double_quotes_source_enclosing
16-
METRICS "k8s" | STATS max_bytes=max(to_long(network.total_bytes_in)) BY cluster | SORT max_bytes DESC;
16+
TS "k8s" | STATS max_bytes=max(to_long(network.total_bytes_in)) BY cluster | SORT max_bytes DESC;
1717

1818
max_bytes:long | cluster: keyword
1919
10797 | qa
@@ -24,47 +24,47 @@ max_bytes:long | cluster: keyword
2424
maxRateAndSourceTripleQuoting
2525
required_capability: metrics_command
2626
required_capability: double_quotes_source_enclosing
27-
METRICS k8s | STATS max(rate(network.total_bytes_in, 1minute));
27+
TS k8s | STATS max(rate(network.total_bytes_in, 1minute));
2828

2929
max(rate(network.total_bytes_in, 1minute)): double
3030
790.4235090751945
3131
;
3232

3333
maxCost
3434
required_capability: metrics_command
35-
METRICS k8s | STATS max_cost=max(rate(network.total_cost));
35+
TS k8s | STATS max_cost=max(rate(network.total_cost));
3636

3737
max_cost: double
3838
0.16151685393258428
3939
;
4040

4141
maxRateAndBytes
4242
required_capability: metrics_command
43-
METRICS k8s | STATS max(rate(network.total_bytes_in, 1minute)), max(network.bytes_in);
43+
TS k8s | STATS max(rate(network.total_bytes_in, 1minute)), max(network.bytes_in);
4444

4545
max(rate(network.total_bytes_in, 1minute)): double | max(network.bytes_in): long
4646
790.4235090751945 | 1021
4747
;
4848

4949
`maxRateAndMarkupBytes`
5050
required_capability: metrics_command
51-
METRICS k8s | STATS max(rate(network.total_bytes_in, 1minute)), max(network.bytes_in * 1.05);
51+
TS k8s | STATS max(rate(network.total_bytes_in, 1minute)), max(network.bytes_in * 1.05);
5252

5353
max(rate(network.total_bytes_in, 1minute)): double | max(network.bytes_in * 1.05): double
5454
790.4235090751945 | 1072.05
5555
;
5656

5757
maxRateAndBytesAndCost
5858
required_capability: metrics_command
59-
METRICS k8s | STATS max(rate(network.total_bytes_in, 1minute)), max(network.bytes_in), max(rate(network.total_cost));
59+
TS k8s | STATS max(rate(network.total_bytes_in, 1minute)), max(network.bytes_in), max(rate(network.total_cost));
6060

6161
max(rate(network.total_bytes_in, 1minute)): double| max(network.bytes_in): long| max(rate(network.total_cost)): double
6262
790.4235090751945 | 1021 | 0.16151685393258428
6363
;
6464

6565
sumRate
6666
required_capability: metrics_command
67-
METRICS k8s | STATS bytes=sum(rate(network.total_bytes_in)), sum(rate(network.total_cost)) BY cluster | SORT cluster;
67+
TS k8s | STATS bytes=sum(rate(network.total_bytes_in)), sum(rate(network.total_cost)) BY cluster | SORT cluster;
6868

6969
bytes: double | sum(rate(network.total_cost)): double | cluster: keyword
7070
24.49149357711476 | 0.3018995503437827 | prod
@@ -74,7 +74,7 @@ bytes: double | sum(rate(network.total_cost)): double | cluster: keyword
7474

7575
oneRateWithBucket
7676
required_capability: metrics_command
77-
METRICS k8s | STATS max(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute) | SORT time_bucket DESC | LIMIT 2;
77+
TS k8s | STATS max(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute) | SORT time_bucket DESC | LIMIT 2;
7878

7979
max(rate(network.total_bytes_in)): double | time_bucket:date
8080
10.594594594594595 | 2024-05-10T00:20:00.000Z
@@ -83,7 +83,7 @@ max(rate(network.total_bytes_in)): double | time_bucket:date
8383

8484
twoRatesWithBucket
8585
required_capability: metrics_command
86-
METRICS k8s | STATS max(rate(network.total_bytes_in)), sum(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute) | SORT time_bucket DESC | LIMIT 3;
86+
TS k8s | STATS max(rate(network.total_bytes_in)), sum(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute) | SORT time_bucket DESC | LIMIT 3;
8787

8888
max(rate(network.total_bytes_in)): double | sum(rate(network.total_bytes_in)): double | time_bucket:date
8989
10.594594594594595 | 42.70864495221802 | 2024-05-10T00:20:00.000Z
@@ -94,7 +94,7 @@ max(rate(network.total_bytes_in)): double | sum(rate(network.total_bytes_in)): d
9494

9595
oneRateWithBucketAndCluster
9696
required_capability: metrics_command
97-
METRICS k8s | STATS max(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute), cluster | SORT time_bucket DESC, cluster | LIMIT 6;
97+
TS k8s | STATS max(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute), cluster | SORT time_bucket DESC, cluster | LIMIT 6;
9898

9999
max(rate(network.total_bytes_in)): double | time_bucket:date | cluster: keyword
100100
10.594594594594595 | 2024-05-10T00:20:00.000Z | prod
@@ -107,7 +107,7 @@ max(rate(network.total_bytes_in)): double | time_bucket:date | cluster:
107107

108108
BytesAndCostByBucketAndCluster
109109
required_capability: metrics_command
110-
METRICS k8s | STATS max(rate(network.total_bytes_in)), max(network.cost) BY time_bucket = bucket(@timestamp,5minute), cluster | SORT time_bucket DESC, cluster | LIMIT 6;
110+
TS k8s | STATS max(rate(network.total_bytes_in)), max(network.cost) BY time_bucket = bucket(@timestamp,5minute), cluster | SORT time_bucket DESC, cluster | LIMIT 6;
111111

112112
max(rate(network.total_bytes_in)): double | max(network.cost): double | time_bucket:date | cluster: keyword
113113
10.594594594594595 | 10.75 | 2024-05-10T00:20:00.000Z | prod
@@ -120,7 +120,7 @@ max(rate(network.total_bytes_in)): double | max(network.cost): double | time_buc
120120

121121
oneRateWithBucketAndClusterThenFilter
122122
required_capability: metrics_command
123-
METRICS k8s | WHERE cluster=="prod" | STATS max(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute), cluster | SORT time_bucket DESC | LIMIT 3;
123+
TS k8s | WHERE cluster=="prod" | STATS max(rate(network.total_bytes_in)) BY time_bucket = bucket(@timestamp,5minute), cluster | SORT time_bucket DESC | LIMIT 3;
124124

125125
max(rate(network.total_bytes_in)): double | time_bucket:date | cluster: keyword
126126
10.594594594594595 | 2024-05-10T00:20:00.000Z | prod

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TelemetryIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,16 @@ public static Iterable<Object[]> parameters() {
148148
) },
149149
new Object[] {
150150
new Test(
151-
"METRICS idx | LIMIT 10",
152-
Build.current().isSnapshot() ? Map.ofEntries(Map.entry("METRICS", 1), Map.entry("LIMIT", 1)) : Collections.emptyMap(),
151+
"TS idx | LIMIT 10",
152+
Build.current().isSnapshot() ? Map.ofEntries(Map.entry("TS", 1), Map.entry("LIMIT", 1)) : Collections.emptyMap(),
153153
Map.ofEntries(),
154154
Build.current().isSnapshot()
155155
) },
156156
new Object[] {
157157
new Test(
158-
"METRICS idx | STATS max(id) BY host | LIMIT 10",
158+
"TS idx | STATS max(id) BY host | LIMIT 10",
159159
Build.current().isSnapshot()
160-
? Map.ofEntries(Map.entry("METRICS", 1), Map.entry("STATS", 1), Map.entry("LIMIT", 1))
160+
? Map.ofEntries(Map.entry("TS", 1), Map.entry("STATS", 1), Map.entry("LIMIT", 1))
161161
: Collections.emptyMap(),
162162
Build.current().isSnapshot() ? Map.ofEntries(Map.entry("MAX", 1)) : Collections.emptyMap(),
163163
Build.current().isSnapshot()

0 commit comments

Comments
 (0)