Repository: apache/skywalking (language: python)

Issue:
[Feature] [BREAKING] Change the default label name in MQE from `label` to `_`
### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar feature requirement.


### Description

Based on the OAL implementation, some functions(percentile mostly) have their default label.
In the current MQE implementation, it is called `label`, ref https://skywalking.apache.org/docs/main/next/en/api/metrics-query-expression/#labeled-value-metrics

This is very tricky and misleading to the users. @wankai123 Please rename it to `_`. Although it is a breaking change, but it should be sooner than later.

### Use case

_No response_

### Related issues

_No response_

### Are you willing to submit a PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)



Discussion / hints:

Fix patch:
diff --git a/docs/en/api/metrics-query-expression.md b/docs/en/api/metrics-query-expression.md
index 8eec5020f9bb..4e67a93982e3 100644
--- a/docs/en/api/metrics-query-expression.md
+++ b/docs/en/api/metrics-query-expression.md
@@ -27,19 +27,22 @@ service_sla
 The `ExpressionResultType` of the expression is `TIME_SERIES_VALUES`.
 
 ### Labeled Value Metrics
+For now, we only have a single anonymous label with multi label values in a labeled metric. 
+To be able to use it in expressions, define `_` as the anonymous label name (key).
+
 Expression:
 ```text
-<metric_name>{label='<label_1>,...'}
+<metric_name>{_='<label_value_1>,...'}
 ```
-`label` is the selected label of the metric. If `label` is not specified, all label values of the metric will be selected. 
+`{_='<label_value_1>,...'}` is the selected label value of the metric. If is not specified, all label values of the metric will be selected. 
 
 For example:
-If we want to query the `service_percentile` metric with the labels `0,1,2,3,4`, we can use the following expression:
+If we want to query the `service_percentile` metric with the label values `0,1,2,3,4`, we can use the following expression:
 ```text
-service_percentile{label='0,1,2,3,4'}
+service_percentile{_='0,1,2,3,4'}
 ```
 
-If we want to rename the labels to `P50,P75,P90,P95,P99`, see [Relabel Operation](#relabel-operation).
+If we want to rename the label values to `P50,P75,P90,P95,P99`, see [Relabel Operation](#relabel-operation).
 
 #### Result Type
 The `ExpressionResultType` of the expression is `TIME_SERIES_VALUES` and with labels.
@@ -160,20 +163,20 @@ top_n(service_instance_cpm, 10, des)
 According to the type of the metric, the `ExpressionResultType` of the expression will be `SORTED_LIST` or `RECORD_LIST`.
 
 ## Relabel Operation
-Relabel Operation takes an expression and replace the labels to new labels on its results.
+Relabel Operation takes an expression and replace the label values to new label values on its results.
 
 Expression:
 ```text
-relabel(Expression, label='<new_label_1>,...')
+relabel(Expression, _='<new_label_value_1>,...')
 ```
 
-`label` is the new labels of the metric after the label is relabeled, the order of the new labels should be the same as the order of the labels in the input expression result.
+`_` is the new label valuess of the metric after the label is relabeled, the order of the new label values should be the same as the order of the label values in the input expression result.
 
 For example:
-If we want to query the `service_percentile` metric with the labels `0,1,2,3,4`, and rename the labels to `P50,P75,P90,P95,P99`, we can use the following expression:
+If we want to query the `service_percentile` metric with the label values `0,1,2,3,4`, and rename the label values to `P50,P75,P90,P95,P99`, we can use the following expression:
 
 ```text
-relabel(service_percentile{label='0,1,2,3,4'}, label='P50,P75,P90,P95,P99')
+relabel(service_percentile{_='0,1,2,3,4'}, _='P50,P75,P90,P95,P99')
 ```
 
 ### Result Type
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 722834a4a2bb..531256b17b42 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -37,6 +37,7 @@
 * Tolerate parameter value in illegal JSON format.
 * Update BanyanDB Java Client to 0.4.0
 * Support aggregate `Labeled Value Metrics` in MQE.
+* [Breaking change] Change the default label name in MQE from `labe`l to `_`.
 
 #### UI
 
diff --git a/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQELexer.g4 b/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQELexer.g4
index 221f57a1cf77..26e0ce2cbbb5 100644
--- a/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQELexer.g4
+++ b/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQELexer.g4
@@ -20,7 +20,7 @@ lexer grammar MQELexer;
 
 // Keywords
 BOOL options { caseInsensitive=true; }: 'bool';
-LABLE:       'label';
+GENERAL_LABEL_NAME:       '_';
 
 // Constructors symbols
 DOT:         '.';
diff --git a/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQEParser.g4 b/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQEParser.g4
index 876a81d0d6a4..46e1c5f197bd 100644
--- a/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQEParser.g4
+++ b/oap-server/server-query-plugin/mqe-grammar/src/main/antlr4/org/apache/skywalking/mqe/rt/grammar/MQEParser.g4
@@ -44,8 +44,9 @@ compare:        (DEQ | NEQ | LTE | LT | GTE | GT) BOOL?;
 metricName:      NAME_STRING;
 metric:   metricName | metricName L_BRACE label? R_BRACE;
 
-// For now, we only have a single label named `label`
-labelName:       LABLE;
+//For now, we only have a single anonymous label with multi label values in a labeled metric.
+//To be able to use it in expressions, define `_` as the anonymous label name (key).
+labelName:       GENERAL_LABEL_NAME;
 labelValue:      VALUE_STRING;
 label:           labelName EQ labelValue;
 
@@ -74,4 +75,4 @@ aggregateLabels:
     AGGREGATE_LABELS;
 
 aggregateLabelsFunc:
-    AVG | SUM | MAX | MIN;
\ No newline at end of file
+    AVG | SUM | MAX | MIN;
diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/MQEVisitor.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/MQEVisitor.java
index b732d03db6a1..9195da5ee407 100644
--- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/MQEVisitor.java
+++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/MQEVisitor.java
@@ -66,7 +66,7 @@ public class MQEVisitor extends MQEParserBaseVisitor<ExpressionResult> {
     private final Entity entity;
     private final Duration duration;
 
-    private final static String LABEL = "label";
+    private final static String GENERAL_LABEL_NAME = "_";
 
     public MQEVisitor(final MetricsQuery metricsQuery,
                       final RecordsQuery recordsQuery,
@@ -217,7 +217,7 @@ public ExpressionResult visitTopNOP(MQEParser.TopNOPContext ctx) {
     public ExpressionResult visitRelablesOP(MQEParser.RelablesOPContext ctx) {
         ExpressionResult result = visit(ctx.expression());
         if (!result.isLabeledResult()) {
-            // Resever the original result type
+            // Reserve the original result type
             result.setError("The result of expression [" + ctx.expression().getText() + "] is not a labeled result.");
             return result;
         }
@@ -405,7 +405,7 @@ private void queryLabeledMetrics(String metricName,
             }
 
             Metadata metadata = new Metadata();
-            KeyValue labelValue = new KeyValue(LABEL, metricsValues.getLabel());
+            KeyValue labelValue = new KeyValue(GENERAL_LABEL_NAME, metricsValues.getLabel());
             metadata.getLabels().add(labelValue);
             MQEValues mqeValues = new MQEValues();
             mqeValues.setValues(mqeValueList);
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint-relation.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint-relation.json
index 87471f127fa9..37725ee28b12 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint-relation.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint-relation.json
@@ -56,7 +56,7 @@
           },
           "metricMode": "Expression",
           "expressions": [
-            "relabels(endpoint_relation_percentile{label='0,1,2,3,4'},label='P50,P75,P90,P95,P99')"
+            "relabels(endpoint_relation_percentile{_='0,1,2,3,4'},_='P50,P75,P90,P95,P99')"
           ],
           "typesOfMQE": [
             "TIME_SERIES_VALUES"
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint.json
index 05f2a3170072..4d04cba146bf 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-endpoint.json
@@ -73,7 +73,7 @@
                   },
                   "metricMode": "Expression",
                   "expressions": [
-                    "relabels(endpoint_percentile{label='0,1,2,3,4'},label='P50,P75,P90,P95,P99')"
+                    "relabels(endpoint_percentile{_='0,1,2,3,4'},_='P50,P75,P90,P95,P99')"
                   ],
                   "typesOfMQE": [
                     "TIME_SERIES_VALUES"
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance-relation.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance-relation.json
index ab8810aefe98..5c4afe507184 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance-relation.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance-relation.json
@@ -68,7 +68,7 @@
           },
           "metricMode": "Expression",
           "expressions": [
-            "relabels(service_instance_relation_client_percentile,label='P50,P75,P90,P95,P99')"
+            "relabels(service_instance_relation_client_percentile,_='P50,P75,P90,P95,P99')"
           ],
           "typesOfMQE": [
             "TIME_SERIES_VALUES"
@@ -295,7 +295,7 @@
           },
           "metricMode": "Expression",
           "expressions": [
-            "relabels(service_instance_relation_server_percentile,label='P50,P75,P90,P95,P99')"
+            "relabels(service_instance_relation_server_percentile,_='P50,P75,P90,P95,P99')"
           ],
           "typesOfMQE": [
             "TIME_SERIES_VALUES"
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service-relation.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service-relation.json
index e01454100cc1..93dc78d305bb 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service-relation.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service-relation.json
@@ -193,7 +193,7 @@
                   },
                   "metricMode": "Expression",
                   "expressions": [
-                    "relabels(service_relation_server_percentile,label='P50,P75,P90,P95,P99')"
+                    "relabels(service_relation_server_percentile,_='P50,P75,P90,P95,P99')"
                   ]
                 },
                 {
@@ -362,7 +362,7 @@
                   },
                   "metricMode": "Expression",
                   "expressions": [
-                    "relabels(service_relation_client_percentile,label='P50,P75,P90,P95,P99')"
+                    "relabels(service_relation_client_percentile,_='P50,P75,P90,P95,P99')"
                   ],
                   "typesOfMQE": [
                     "TIME_SERIES_VALUES"
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service.json
index 6024dafe0a37..5e95d56b29cd 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-service.json
@@ -272,7 +272,7 @@
                   },
                   "metricMode": "Expression",
                   "expressions": [
-                    "relabels(service_percentile{label=\"0,1,2,3,4\"},label=\"P50,P75,P90,P95,P99\")"
+                    "relabels(service_percentile{_=\"0,1,2,3,4\"},_=\"P50,P75,P90,P95,P99\")"
                   ],
                   "typesOfMQE": [
                     "TIME_SERIES_VALUES"
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-service.json
index 17d9e1182910..1193dc2d1db6 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-service.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-service.json
@@ -158,7 +158,7 @@
           ],
           "metricMode": "Expression",
           "expressions": [
-            "relabels(database_access_percentile{label='0,1,2,3,4'},label='P50,P75,P90,P95,P99')"
+            "relabels(database_access_percentile{_='0,1,2,3,4'},_='P50,P75,P90,P95,P99')"
           ],
           "typesOfMQE": [
             "TIME_SERIES_VALUES"


Test patch:
diff --git a/test/e2e-v2/cases/mqe/expected/relabels-OP.yml b/test/e2e-v2/cases/mqe/expected/relabels-OP.yml
index 519c21255672..202fb5904be5 100644
--- a/test/e2e-v2/cases/mqe/expected/relabels-OP.yml
+++ b/test/e2e-v2/cases/mqe/expected/relabels-OP.yml
@@ -18,7 +18,7 @@ results:
 {{- contains .results }}
   - metric:
       labels:
-        - key: label
+        - key: _
           value: "P50"
     values:
       {{- contains .values }}
@@ -31,7 +31,7 @@ results:
       {{- end}}
   - metric:
       labels:
-        - key: label
+        - key: _
           value: "P75"
     values:
       {{- contains .values }}
@@ -44,7 +44,7 @@ results:
       {{- end}}
   - metric:
       labels:
-        - key: label
+        - key: _
           value: "P90"
     values:
       {{- contains .values }}
diff --git a/test/e2e-v2/cases/mqe/expected/relabels-binary-OP.yml b/test/e2e-v2/cases/mqe/expected/relabels-binary-OP.yml
index f06594984ab2..d9888226f43f 100644
--- a/test/e2e-v2/cases/mqe/expected/relabels-binary-OP.yml
+++ b/test/e2e-v2/cases/mqe/expected/relabels-binary-OP.yml
@@ -18,7 +18,7 @@ results:
 {{- contains .results }}
   - metric:
       labels:
-        - key: label
+        - key: _
           value: "P50"
     values:
       {{- contains .values }}
@@ -31,7 +31,7 @@ results:
       {{- end}}
   - metric:
       labels:
-        - key: label
+        - key: _
           value: "P75"
     values:
       {{- contains .values }}
@@ -44,7 +44,7 @@ results:
       {{- end}}
   - metric:
       labels:
-        - key: label
+        - key: _
           value: "P90"
     values:
       {{- contains .values }}
diff --git a/test/e2e-v2/cases/mqe/mqe-cases.yaml b/test/e2e-v2/cases/mqe/mqe-cases.yaml
index 466bde52a4d3..c3f0f3d7ed8b 100644
--- a/test/e2e-v2/cases/mqe/mqe-cases.yaml
+++ b/test/e2e-v2/cases/mqe/mqe-cases.yaml
@@ -41,13 +41,13 @@ cases:
     expected: expected/topN-OP-instance.yml
 
   # select labels and relabels
-  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="relabels(service_percentile{label='0,1,2'},label='P50,P75,P90')" --service-name=e2e-service-provider
+  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="relabels(service_percentile{_='0,1,2'},_='P50,P75,P90')" --service-name=e2e-service-provider
     expected: expected/relabels-OP.yml
 
   # relabels and calculate
-  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="relabels(service_percentile{label='0,1,2'},label='P50,P75,P90')/relabels(service_percentile{label='0,1,2'},label='P50,P75,P90')" --service-name=e2e-service-provider
+  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="relabels(service_percentile{_='0,1,2'},_='P50,P75,P90')/relabels(service_percentile{_='0,1,2'},_='P50,P75,P90')" --service-name=e2e-service-provider
     expected: expected/relabels-binary-OP.yml
-  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="relabels(service_percentile{label='0,1,2'}/service_percentile{label='0,1,2'},label='P50,P75,P90')" --service-name=e2e-service-provider
+  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="relabels(service_percentile{_='0,1,2'}/service_percentile{_='0,1,2'},_='P50,P75,P90')" --service-name=e2e-service-provider
     expected: expected/relabels-binary-OP.yml
 
   # aggregateLabels-OP