You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wa...@apache.org on 2023/03/31 08:35:21 UTC
[skywalking] branch master updated: PromQL: Remove empty values from the query result, fix `/api/v1/metadata` param `limit` could cause out of bound. (#10628)
This is an automated email from the ASF dual-hosted git repository.
wankai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 6d432c31f2 PromQL: Remove empty values from the query result, fix `/api/v1/metadata` param `limit` could cause out of bound. (#10628)
6d432c31f2 is described below
commit 6d432c31f21cb0345e3f2f3e2955506cc829bb85
Author: Wan Kai <wa...@foxmail.com>
AuthorDate: Fri Mar 31 16:35:06 2023 +0800
PromQL: Remove empty values from the query result, fix `/api/v1/metadata` param `limit` could cause out of bound. (#10628)
---
.github/workflows/skywalking.yaml | 3 +
docs/en/changes/changes.md | 1 +
.../oap/query/promql/handler/PromQLApiHandler.java | 3 +-
.../oap/query/promql/rt/PromOpUtils.java | 10 ++-
.../query/promql/rt/PromQLExprQueryVisitor.java | 8 ++-
test/e2e-v2/cases/promql/docker-compose.yml | 76 ++++++++++++++++++++++
test/e2e-v2/cases/promql/e2e.yaml | 47 +++++++++++++
.../expected/endpoint-labeled-metric-label.yml | 29 +++++++++
.../promql/expected/endpoint-metric-label.yml | 26 ++++++++
.../expected/endpoint-metric-labeled-matrix.yml | 58 +++++++++++++++++
.../promql/expected/endpoint-metric-matrix.yml | 32 +++++++++
.../expected/endpoint-metric-sort-matrix.yml | 32 +++++++++
.../promql/expected/endpoint-metric-vector.yml | 30 +++++++++
.../cases/promql/expected/endpoint-traffic.yml | 25 +++++++
.../promql/expected/instance-metric-label.yml | 27 ++++++++
.../promql/expected/instance-metric-matrix.yml | 32 +++++++++
.../expected/instance-metric-sort-matrix.yml | 32 +++++++++
.../promql/expected/instance-metric-vector.yml | 30 +++++++++
.../cases/promql/expected/instance-traffic.yml | 25 +++++++
.../cases/promql/expected/metric-metadata.yml | 27 ++++++++
.../e2e-v2/cases/promql/expected/metrics-names.yml | 20 ++++++
.../expected/service-labeled-metric-label.yml | 26 ++++++++
.../cases/promql/expected/service-metric-label.yml | 24 +++++++
.../expected/service-metric-labeled-matrix.yml | 55 ++++++++++++++++
.../expected/service-metric-labeled-vector.yml | 49 ++++++++++++++
.../promql/expected/service-metric-matrix.yml | 31 +++++++++
.../promql/expected/service-metric-sort-matrix.yml | 42 ++++++++++++
.../promql/expected/service-metric-sort-vector.yml | 38 +++++++++++
.../promql/expected/service-metric-vector.yml | 29 +++++++++
.../cases/promql/expected/service-traffic.yml | 32 +++++++++
test/e2e-v2/cases/promql/promql-cases.yaml | 76 ++++++++++++++++++++++
31 files changed, 969 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/skywalking.yaml b/.github/workflows/skywalking.yaml
index a04999c9b9..d78e29f60f 100644
--- a/.github/workflows/skywalking.yaml
+++ b/.github/workflows/skywalking.yaml
@@ -673,6 +673,9 @@ jobs:
config: test/e2e-v2/cases/aws/s3/e2e.yaml
- name: AWS Cloud DynamoDB
config: test/e2e-v2/cases/aws/dynamodb/e2e.yaml
+
+ - name: PromQL Service
+ config: test/e2e-v2/cases/promql/e2e.yaml
steps:
- uses: actions/checkout@v3
with:
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index c8b14dc984..15effe9bd5 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -25,6 +25,7 @@
* Support metrics query indicates whether value == 0 represents actually zero or no data.
* Fix `NPE` when query the not exist series indexes in ElasticSearch storage.
* Support collecting memory buff/cache metrics in VM monitoring.
+* PromQL: Remove empty values from the query result, fix `/api/v1/metadata` param `limit` could cause out of bound.
#### UI
* Revert: cpm5d function. This feature is cancelled from backend.
diff --git a/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/handler/PromQLApiHandler.java b/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/handler/PromQLApiHandler.java
index 04d612b660..3b50c3cb5a 100644
--- a/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/handler/PromQLApiHandler.java
+++ b/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/handler/PromQLApiHandler.java
@@ -111,7 +111,8 @@ public class PromQLApiHandler {
response.setStatus(ResultStatus.SUCCESS);
String regex = metric.orElse("");
List<MetricDefinition> definitionList = metricsQuery.listMetrics(regex);
- int maxNum = limit.orElse(definitionList.size());
+ int inputLimit = limit.orElse(definitionList.size());
+ int maxNum = Math.min(inputLimit, definitionList.size());
for (int i = 0; i < maxNum; i++) {
List<MetricMetadata> metadataList = new ArrayList<>();
MetricMetadata metadata = new MetricMetadata(MetricType.GAUGE, "", "");
diff --git a/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromOpUtils.java b/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromOpUtils.java
index 524f8e1666..7a19c03392 100644
--- a/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromOpUtils.java
+++ b/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromOpUtils.java
@@ -32,6 +32,7 @@ import org.apache.skywalking.oap.server.core.query.DurationUtils;
import org.apache.skywalking.oap.server.core.query.PointOfTime;
import org.apache.skywalking.oap.server.core.query.enumeration.Step;
import org.apache.skywalking.oap.server.core.query.input.Duration;
+import org.apache.skywalking.oap.server.core.query.type.KVInt;
import org.apache.skywalking.oap.server.core.query.type.MetricsValues;
import org.apache.skywalking.promql.rt.grammar.PromQLParser;
import org.joda.time.DateTime;
@@ -243,9 +244,12 @@ public class PromOpUtils {
long retTimestampSec = DurationUtils.INSTANCE.parseToDateTime(
duration.getStep(), times.get(i).getPoint())
.getMillis() / 1000;
- TimeValuePair value = new TimeValuePair(
- retTimestampSec, Long.toString(metricsValues.getValues().getValues().get(i).getValue()));
- values.add(value);
+ KVInt kvInt = metricsValues.getValues().getValues().get(i);
+ if (!kvInt.isEmptyValue()) {
+ TimeValuePair value = new TimeValuePair(
+ retTimestampSec, Long.toString(kvInt.getValue()));
+ values.add(value);
+ }
}
return values;
}
diff --git a/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromQLExprQueryVisitor.java b/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromQLExprQueryVisitor.java
index 7338f70a1a..67a633f51a 100644
--- a/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromQLExprQueryVisitor.java
+++ b/oap-server/server-query-plugin/promql-plugin/src/main/java/org/apache/skywalking/oap/query/promql/rt/PromQLExprQueryVisitor.java
@@ -492,7 +492,9 @@ public class PromQLExprQueryVisitor extends PromQLParserBaseVisitor<ParseResult>
} else if (recordName.isPresent()) {
metricInfo.getLabels().add(new LabelValuePair(LabelName.RECORD, recordName.get()));
} else {
- checkLabels(labelMap, LabelName.SERVICE_INSTANCE);
+ checkLabels(labelMap, LabelName.SERVICE, LabelName.SERVICE_INSTANCE);
+ metricInfo.getLabels()
+ .add(new LabelValuePair(LabelName.SERVICE, labelMap.get(LabelName.SERVICE)));
metricInfo.getLabels()
.add(new LabelValuePair(
LabelName.SERVICE_INSTANCE,
@@ -507,7 +509,9 @@ public class PromQLExprQueryVisitor extends PromQLParserBaseVisitor<ParseResult>
} else if (recordName.isPresent()) {
metricInfo.getLabels().add(new LabelValuePair(LabelName.RECORD, recordName.get()));
} else {
- checkLabels(labelMap, LabelName.ENDPOINT);
+ checkLabels(labelMap, LabelName.SERVICE, LabelName.ENDPOINT);
+ metricInfo.getLabels()
+ .add(new LabelValuePair(LabelName.SERVICE, labelMap.get(LabelName.SERVICE)));
metricInfo.getLabels()
.add(new LabelValuePair(LabelName.ENDPOINT, labelMap.get(LabelName.ENDPOINT)));
}
diff --git a/test/e2e-v2/cases/promql/docker-compose.yml b/test/e2e-v2/cases/promql/docker-compose.yml
new file mode 100644
index 0000000000..774d836d4c
--- /dev/null
+++ b/test/e2e-v2/cases/promql/docker-compose.yml
@@ -0,0 +1,76 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+version: '2.1'
+
+services:
+ oap:
+ extends:
+ file: ../../script/docker-compose/base-compose.yml
+ service: oap
+ environment:
+ SW_STORAGE: elasticsearch
+ SW_STORAGE_ES_CLUSTER_NODES: es:9200
+ ports:
+ - 9090
+ depends_on:
+ es:
+ condition: service_healthy
+ networks:
+ - e2e
+
+ provider:
+ extends:
+ file: ../../script/docker-compose/base-compose.yml
+ service: provider
+ ports:
+ - 9090
+ depends_on:
+ oap:
+ condition: service_healthy
+ networks:
+ - e2e
+
+ consumer:
+ extends:
+ file: ../../script/docker-compose/base-compose.yml
+ service: consumer
+ ports:
+ - 9092
+ depends_on:
+ oap:
+ condition: service_healthy
+ provider:
+ condition: service_healthy
+
+ es:
+ image: elastic/elasticsearch:7.10.2
+ ports:
+ - 9200
+ networks:
+ - e2e
+ environment:
+ - discovery.type=single-node
+ - cluster.routing.allocation.disk.threshold_enabled=false
+ - xpack.security.enabled=false
+ healthcheck:
+ test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9200"]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+
+networks:
+ e2e:
diff --git a/test/e2e-v2/cases/promql/e2e.yaml b/test/e2e-v2/cases/promql/e2e.yaml
new file mode 100644
index 0000000000..560e4ac6e6
--- /dev/null
+++ b/test/e2e-v2/cases/promql/e2e.yaml
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is used to show how to write configuration files and can be used to test.
+
+setup:
+ env: compose
+ file: docker-compose.yml
+ timeout: 20m
+ init-system-environment: ../../script/env
+ steps:
+ - name: set PATH
+ command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
+ - name: install yq
+ command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq
+ - name: install swctl
+ command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl
+
+trigger:
+ action: http
+ interval: 3s
+ times: 10
+ url: http://${consumer_host}:${consumer_9092}/users
+ method: POST
+ body: '{"id":"123","name":"skywalking"}'
+ headers:
+ "Content-Type": "application/json"
+
+verify:
+ retry:
+ count: 20
+ interval: 3s
+ cases:
+ - includes:
+ - promql-cases.yaml
diff --git a/test/e2e-v2/cases/promql/expected/endpoint-labeled-metric-label.yml b/test/e2e-v2/cases/promql/expected/endpoint-labeled-metric-label.yml
new file mode 100644
index 0000000000..d893a004ec
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/endpoint-labeled-metric-label.yml
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ "layer",
+ "service",
+ "top_n",
+ "order",
+ "labels",
+ "relabels",
+ "endpoint",
+ "parent_service"
+ ]
+}
+
diff --git a/test/e2e-v2/cases/promql/expected/endpoint-metric-label.yml b/test/e2e-v2/cases/promql/expected/endpoint-metric-label.yml
new file mode 100644
index 0000000000..b5e281d7ef
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/endpoint-metric-label.yml
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ "layer",
+ "service",
+ "top_n",
+ "order",
+ "endpoint",
+ "parent_service"
+ ]
+}
diff --git a/test/e2e-v2/cases/promql/expected/endpoint-metric-labeled-matrix.yml b/test/e2e-v2/cases/promql/expected/endpoint-metric-labeled-matrix.yml
new file mode 100644
index 0000000000..aa015278d1
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/endpoint-metric-labeled-matrix.yml
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: endpoint_percentile
+ label: P50
+ layer: GENERAL
+ scope: Endpoint
+ service: e2e-service-consumer
+ endpoint: POST:/users
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ - metric:
+ __name__: endpoint_percentile
+ label: P75
+ layer: GENERAL
+ scope: Endpoint
+ service: e2e-service-consumer
+ endpoint: POST:/users
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ - metric:
+ __name__: endpoint_percentile
+ label: P90
+ layer: GENERAL
+ scope: Endpoint
+ service: e2e-service-consumer
+ endpoint: POST:/users
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ {{- end}}
+
diff --git a/test/e2e-v2/cases/promql/expected/endpoint-metric-matrix.yml b/test/e2e-v2/cases/promql/expected/endpoint-metric-matrix.yml
new file mode 100644
index 0000000000..170429e9cc
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/endpoint-metric-matrix.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: endpoint_sla
+ layer: GENERAL
+ scope: Endpoint
+ service: e2e-service-consumer
+ endpoint: POST:/users
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - '10000'
+ {{- end}}
+ {{- end}}
diff --git a/test/e2e-v2/cases/promql/expected/endpoint-metric-sort-matrix.yml b/test/e2e-v2/cases/promql/expected/endpoint-metric-sort-matrix.yml
new file mode 100644
index 0000000000..05c04d4e9f
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/endpoint-metric-sort-matrix.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: endpoint_cpm
+ layer: GENERAL
+ scope: Endpoint
+ endpoint: POST:/users
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ {{- end}}
+
diff --git a/test/e2e-v2/cases/promql/expected/endpoint-metric-vector.yml b/test/e2e-v2/cases/promql/expected/endpoint-metric-vector.yml
new file mode 100644
index 0000000000..7c62e5cd65
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/endpoint-metric-vector.yml
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: vector
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: endpoint_sla
+ layer: GENERAL
+ scope: Endpoint
+ service: e2e-service-consumer
+ endpoint: POST:/users
+ value:
+ - "{{ index .value 0 }}"
+ - '10000'
+ {{- end}}
diff --git a/test/e2e-v2/cases/promql/expected/endpoint-traffic.yml b/test/e2e-v2/cases/promql/expected/endpoint-traffic.yml
new file mode 100644
index 0000000000..847338dfcd
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/endpoint-traffic.yml
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ {
+ "__name__": "endpoint_traffic",
+ "endpoint": "POST:/users",
+ "scope": "Endpoint"
+ }
+ ]
+}
diff --git a/test/e2e-v2/cases/promql/expected/instance-metric-label.yml b/test/e2e-v2/cases/promql/expected/instance-metric-label.yml
new file mode 100644
index 0000000000..78cd4872c0
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/instance-metric-label.yml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ "layer",
+ "service",
+ "top_n",
+ "order",
+ "service_instance",
+ "parent_service"
+ ]
+}
+
diff --git a/test/e2e-v2/cases/promql/expected/instance-metric-matrix.yml b/test/e2e-v2/cases/promql/expected/instance-metric-matrix.yml
new file mode 100644
index 0000000000..902c42da0a
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/instance-metric-matrix.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_instance_sla
+ layer: GENERAL
+ scope: ServiceInstance
+ service: e2e-service-consumer
+ service_instance: consumer1
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - '10000'
+ {{- end}}
+ {{- end}}
diff --git a/test/e2e-v2/cases/promql/expected/instance-metric-sort-matrix.yml b/test/e2e-v2/cases/promql/expected/instance-metric-sort-matrix.yml
new file mode 100644
index 0000000000..cf09889e80
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/instance-metric-sort-matrix.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_instance_cpm
+ layer: GENERAL
+ scope: ServiceInstance
+ service_instance: consumer1
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ {{- end}}
+
diff --git a/test/e2e-v2/cases/promql/expected/instance-metric-vector.yml b/test/e2e-v2/cases/promql/expected/instance-metric-vector.yml
new file mode 100644
index 0000000000..23870c6b84
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/instance-metric-vector.yml
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: vector
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_instance_sla
+ layer: GENERAL
+ scope: ServiceInstance
+ service: e2e-service-consumer
+ service_instance: consumer1
+ value:
+ - "{{ index .value 0 }}"
+ - '10000'
+ {{- end}}
diff --git a/test/e2e-v2/cases/promql/expected/instance-traffic.yml b/test/e2e-v2/cases/promql/expected/instance-traffic.yml
new file mode 100644
index 0000000000..b051b908d8
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/instance-traffic.yml
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ {
+ "__name__": "instance_traffic",
+ "service_instance": "provider1",
+ "scope": "ServiceInstance"
+ }
+ ]
+}
diff --git a/test/e2e-v2/cases/promql/expected/metric-metadata.yml b/test/e2e-v2/cases/promql/expected/metric-metadata.yml
new file mode 100644
index 0000000000..2000a49e08
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/metric-metadata.yml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": {
+ "service_cpm": [
+ {
+ "type": "gauge",
+ "help": "",
+ "unit": ""
+ }
+ ]
+ }
+}
diff --git a/test/e2e-v2/cases/promql/expected/metrics-names.yml b/test/e2e-v2/cases/promql/expected/metrics-names.yml
new file mode 100644
index 0000000000..0a7b7774e7
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/metrics-names.yml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ {{- contains .data }}
+ - "{{ index . }}"
+ {{- end}}
diff --git a/test/e2e-v2/cases/promql/expected/service-labeled-metric-label.yml b/test/e2e-v2/cases/promql/expected/service-labeled-metric-label.yml
new file mode 100644
index 0000000000..784adb18b2
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-labeled-metric-label.yml
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ "layer",
+ "service",
+ "top_n",
+ "order",
+ "labels",
+ "relabels"
+ ]
+}
diff --git a/test/e2e-v2/cases/promql/expected/service-metric-label.yml b/test/e2e-v2/cases/promql/expected/service-metric-label.yml
new file mode 100644
index 0000000000..48a28b958a
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-metric-label.yml
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ "layer",
+ "service",
+ "top_n",
+ "order"
+ ]
+}
diff --git a/test/e2e-v2/cases/promql/expected/service-metric-labeled-matrix.yml b/test/e2e-v2/cases/promql/expected/service-metric-labeled-matrix.yml
new file mode 100644
index 0000000000..2ec90f0b89
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-metric-labeled-matrix.yml
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_percentile
+ label: P50
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ - metric:
+ __name__: service_percentile
+ label: P75
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ - metric:
+ __name__: service_percentile
+ label: P90
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ {{- end}}
+
diff --git a/test/e2e-v2/cases/promql/expected/service-metric-labeled-vector.yml b/test/e2e-v2/cases/promql/expected/service-metric-labeled-vector.yml
new file mode 100644
index 0000000000..bc90ffb827
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-metric-labeled-vector.yml
@@ -0,0 +1,49 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: vector
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_percentile
+ label: P50
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ value:
+ - "{{ index .value 0 }}"
+ - "{{ index .value 1 }}"
+ - metric:
+ __name__: service_percentile
+ label: P75
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ value:
+ - "{{ index .value 0 }}"
+ - "{{ index .value 1 }}"
+ - metric:
+ __name__: service_percentile
+ label: P90
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ value:
+ - "{{ index .value 0 }}"
+ - "{{ index .value 1 }}"
+ {{- end}}
+
diff --git a/test/e2e-v2/cases/promql/expected/service-metric-matrix.yml b/test/e2e-v2/cases/promql/expected/service-metric-matrix.yml
new file mode 100644
index 0000000000..69bb99add0
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-metric-matrix.yml
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_sla
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - '10000'
+ {{- end}}
+ {{- end}}
diff --git a/test/e2e-v2/cases/promql/expected/service-metric-sort-matrix.yml b/test/e2e-v2/cases/promql/expected/service-metric-sort-matrix.yml
new file mode 100644
index 0000000000..0769936eb8
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-metric-sort-matrix.yml
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: matrix
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_cpm
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ - metric:
+ __name__: service_cpm
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-provider
+ values:
+ {{- contains .values }}
+ - - "{{ index . 0 }}"
+ - "{{ index . 1 }}"
+ {{- end}}
+ {{- end}}
+
diff --git a/test/e2e-v2/cases/promql/expected/service-metric-sort-vector.yml b/test/e2e-v2/cases/promql/expected/service-metric-sort-vector.yml
new file mode 100644
index 0000000000..25bb83abdd
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-metric-sort-vector.yml
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: vector
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_cpm
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ value:
+ - "{{ index .value 0 }}"
+ - "{{ index .value 1 }}"
+ - metric:
+ __name__: service_cpm
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-provider
+ value:
+ - "{{ index .value 0 }}"
+ - "{{ index .value 1 }}"
+ {{- end}}
+
diff --git a/test/e2e-v2/cases/promql/expected/service-metric-vector.yml b/test/e2e-v2/cases/promql/expected/service-metric-vector.yml
new file mode 100644
index 0000000000..2a7ac646b6
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-metric-vector.yml
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+status: success
+data:
+ resultType: vector
+ result:
+ {{- contains .data.result }}
+ - metric:
+ __name__: service_sla
+ layer: GENERAL
+ scope: Service
+ service: e2e-service-consumer
+ value:
+ - "{{ index .value 0 }}"
+ - '10000'
+ {{- end}}
diff --git a/test/e2e-v2/cases/promql/expected/service-traffic.yml b/test/e2e-v2/cases/promql/expected/service-traffic.yml
new file mode 100644
index 0000000000..454a5394ef
--- /dev/null
+++ b/test/e2e-v2/cases/promql/expected/service-traffic.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+ "status": "success",
+ "data": [
+ {
+ "__name__": "service_traffic",
+ "service": "e2e-service-provider",
+ "scope": "Service",
+ "layer": "GENERAL"
+ },
+ {
+ "__name__": "service_traffic",
+ "service": "e2e-service-consumer",
+ "scope": "Service",
+ "layer": "GENERAL"
+ }
+ ]
+}
diff --git a/test/e2e-v2/cases/promql/promql-cases.yaml b/test/e2e-v2/cases/promql/promql-cases.yaml
new file mode 100644
index 0000000000..d817721a4f
--- /dev/null
+++ b/test/e2e-v2/cases/promql/promql-cases.yaml
@@ -0,0 +1,76 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cases:
+ # traffics query
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/series -d 'match[]=service_traffic{layer="GENERAL"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/service-traffic.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/series -d 'match[]=instance_traffic{layer="GENERAL", service="e2e-service-provider"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/instance-traffic.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/series -d 'match[]=endpoint_traffic{layer="GENERAL", service="e2e-service-provider", keyword="POST:/users"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/endpoint-traffic.yml
+ # metrics names query
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/label/__name__/values
+ expected: expected/metrics-names.yml
+ # labels query
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/labels -d 'match[]=service_cpm'
+ expected: expected/service-metric-label.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/labels -d 'match[]=service_percentile'
+ expected: expected/service-labeled-metric-label.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/labels -d 'match[]=service_instance_cpm'
+ expected: expected/instance-metric-label.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/labels -d 'match[]=endpoint_cpm'
+ expected: expected/endpoint-metric-label.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/labels -d 'match[]=endpoint_percentile'
+ expected: expected/endpoint-labeled-metric-label.yml
+ # metadata query
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/metadata -d 'metric=service_cpm&limit=10'
+ expected: expected/metric-metadata.yml
+ # metrics query
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=service_sla{service="e2e-service-consumer", layer="GENERAL"}'
+ expected: expected/service-metric-vector.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=service_sla{service="e2e-service-consumer", layer="GENERAL"}[30m]'
+ expected: expected/service-metric-matrix.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=service_percentile{service="e2e-service-consumer", layer="GENERAL", labels="0,1,2", relabels="P50,P75,P90"}'
+ expected: expected/service-metric-labeled-vector.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=service_percentile{service="e2e-service-consumer", layer="GENERAL", labels="0,1,2", relabels="P50,P75,P90"}[30m]'
+ expected: expected/service-metric-labeled-matrix.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=service_cpm{layer="GENERAL",top_n="10", order="DES"}'
+ expected: expected/service-metric-sort-vector.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=service_cpm{layer="GENERAL",top_n="10", order="DES"}[30m]'
+ expected: expected/service-metric-sort-matrix.yml
+ ## query_range
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=service_sla{service="e2e-service-consumer", layer="GENERAL"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/service-metric-matrix.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=service_percentile{service="e2e-service-consumer", layer="GENERAL", labels="0,1,2", relabels="P50,P75,P90"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/service-metric-labeled-matrix.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=service_cpm{layer="GENERAL",top_n="10", order="DES"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/service-metric-sort-matrix.yml
+ ## instance
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=service_instance_sla{service="e2e-service-consumer", layer="GENERAL", service_instance="consumer1"}'
+ expected: expected/instance-metric-vector.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=service_instance_sla{service="e2e-service-consumer", layer="GENERAL", service_instance="consumer1"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/instance-metric-matrix.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=service_instance_cpm{parent_service="e2e-service-consumer", layer="GENERAL",top_n="10", order="DES"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/instance-metric-sort-matrix.yml
+ ## endpoint
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query -d 'query=endpoint_sla{service="e2e-service-consumer", layer="GENERAL", endpoint="POST:/users"}'
+ expected: expected/endpoint-metric-vector.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=endpoint_sla{service="e2e-service-consumer", layer="GENERAL", endpoint="POST:/users"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/endpoint-metric-matrix.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=endpoint_percentile{service="e2e-service-consumer", layer="GENERAL", labels="0,1,2", relabels="P50,P75,P90", endpoint="POST:/users"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/endpoint-metric-labeled-matrix.yml
+ - query: curl -X GET http://${oap_host}:${oap_9090}/api/v1/query_range -d 'query=endpoint_cpm{parent_service="e2e-service-consumer", layer="GENERAL",top_n="10", order="DES"}&start='$(($(date +%s)-1800))'&end='$(date +%s)
+ expected: expected/endpoint-metric-sort-matrix.yml