This is an automated email from the ASF dual-hosted git repository.

wusheng 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 154a35fa47 Apply MQE on General and Virtual-Database layer 
UI-templates. (#10913)
154a35fa47 is described below

commit 154a35fa47f81d7aca6d97c2245d4a61eaaf5e03
Author: Wan Kai <[email protected]>
AuthorDate: Mon Jun 12 11:06:34 2023 +0800

    Apply MQE on General and Virtual-Database layer UI-templates. (#10913)
---
 .gitignore                                         |   4 +
 docs/en/changes/changes.md                         |   1 +
 .../oap/query/graphql/mqe/rt/MQEVisitor.java       |  21 +-
 .../graphql/mqe/rt/operation/AggregationOp.java    |  21 +-
 .../query/graphql/mqe/rt/operation/BinaryOp.java   |  48 +--
 .../query/graphql/mqe/rt/operation/FunctionOp.java |   4 -
 .../general/general-endpoint-relation.json         |  88 +++---
 .../general/general-endpoint.json                  |  92 +++---
 .../general/general-instance-relation.json         | 186 +++++------
 .../general/general-instance.json                  | 304 ++++++++++--------
 .../general/general-root.json                      | 102 +++---
 .../general/general-service-relation.json          | 183 +++++------
 .../general/general-service.json                   | 346 +++++++++++----------
 .../virtual_database/virtual-database-root.json    |  48 ++-
 .../virtual_database/virtual-database-service.json | 101 +++---
 skywalking-ui                                      |   2 +-
 16 files changed, 760 insertions(+), 791 deletions(-)

diff --git a/.gitignore b/.gitignore
index 492dd61b87..6fd74a2458 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,10 @@ OALLexer.tokens
 .checkstyle
 .externalToolBuilders
 oap-server/oal-grammar/**/gen/
+MQELexer.tokens
+oap-server/server-query-plugin/mqe-grammar/gen/
+PromQLLexer.tokens
+oap-server/server-query-plugin/promql-plugin/gen/
 
 # This serves as a template but will ONLY be updated when building a source 
release tar,
 # so we don't track future updates of this file.
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index c08048c920..164a03fae5 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -89,6 +89,7 @@
 * Support Metrics Query Expression(MQE) and allows users to do simple 
query-stage calculation through the expression.
 * Bump up zipkin ui dependency to 2.24.1.
 * Bump up vite to 4.0.5.
+* Apply MQE on `General` and `Virtual-Database` layer UI-templates.
 
 #### Documentation
 
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 9bf42d760b..9ae57e0441 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
@@ -256,7 +256,7 @@ public class MQEVisitor extends 
MQEParserBaseVisitor<ExpressionResult> {
                 if (ctx.parent instanceof MQEParser.TopNOPContext) {
                     MQEParser.TopNOPContext parent = (MQEParser.TopNOPContext) 
ctx.parent;
                     queryRecords(metricName, 
Integer.parseInt(parent.parameter().getText()),
-                                 Order.valueOf(parent.order().getText()), 
result
+                                 
Order.valueOf(parent.order().getText().toUpperCase()), result
                     );
                 } else {
                     throw new IllegalExpressionException(
@@ -307,18 +307,13 @@ public class MQEVisitor extends 
MQEParserBaseVisitor<ExpressionResult> {
     }
 
     private void queryRecords(String metricName, int topN, Order order, 
ExpressionResult result) throws IOException {
-        List<Record> records;
-        // API `returnTypeOfMQE` not require entity and duration.
-        if (entity != null && duration != null && recordsQuery != null) {
-            RecordCondition recordCondition = new RecordCondition();
-            recordCondition.setName(metricName);
-            recordCondition.setTopN(topN);
-            recordCondition.setParentEntity(entity);
-            recordCondition.setOrder(order);
-            records = recordsQuery.readRecords(recordCondition, duration);
-        } else {
-            records = Collections.emptyList();
-        }
+        RecordCondition recordCondition = new RecordCondition();
+        recordCondition.setName(metricName);
+        recordCondition.setTopN(topN);
+        recordCondition.setParentEntity(entity);
+        recordCondition.setOrder(order);
+        List<Record> records = recordsQuery.readRecords(recordCondition, 
duration);
+
         List<MQEValue> mqeValueList = new ArrayList<>(records.size());
         records.forEach(record -> {
             MQEValue mqeValue = new MQEValue();
diff --git 
a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/AggregationOp.java
 
b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/AggregationOp.java
index 201f90e45a..45b440dd41 100644
--- 
a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/AggregationOp.java
+++ 
b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/AggregationOp.java
@@ -20,7 +20,6 @@ package 
org.apache.skywalking.oap.query.graphql.mqe.rt.operation;
 
 import com.google.common.collect.Streams;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Optional;
@@ -85,17 +84,17 @@ public class AggregationOp {
                                                     Function<MQEValues, 
OptionalDouble> aggregator) {
         for (MQEValues resultValues : result.getResults()) {
             OptionalDouble resultValue = aggregator.apply(resultValues);
+            List<MQEValue> mqeValueList = new ArrayList<>(1);
+            //no id
+            MQEValue mqeValue = new MQEValue();
             if (resultValue.isPresent()) {
-                List<MQEValue> mqeValueList = new ArrayList<>(1);
-                //no id
-                MQEValue mqeValue = new MQEValue();
                 mqeValue.setEmptyValue(false);
                 mqeValue.setDoubleValue(resultValue.getAsDouble());
-                mqeValueList.add(mqeValue);
-                resultValues.setValues(mqeValueList);
             } else {
-                resultValues.setValues(Collections.emptyList());
+                mqeValue.setEmptyValue(true);
             }
+            mqeValueList.add(mqeValue);
+            resultValues.setValues(mqeValueList);
         }
         result.setType(ExpressionResultType.SINGLE_VALUE);
         return result;
@@ -105,13 +104,15 @@ public class AggregationOp {
                                                  Function<MQEValues, 
Optional<MQEValue>> aggregator) {
         for (MQEValues resultValues : result.getResults()) {
             Optional<MQEValue> resultValue = aggregator.apply(resultValues);
+            List<MQEValue> mqeValueList = new ArrayList<>(1);
             if (resultValue.isPresent()) {
-                List<MQEValue> mqeValueList = new ArrayList<>(1);
                 mqeValueList.add(resultValue.get());
-                resultValues.setValues(mqeValueList);
             } else {
-                resultValues.setValues(Collections.emptyList());
+                MQEValue mqeValue = new MQEValue();
+                mqeValue.setEmptyValue(true);
+                mqeValueList.add(mqeValue);
             }
+            resultValues.setValues(mqeValueList);
         }
         result.setType(ExpressionResultType.SINGLE_VALUE);
         return result;
diff --git 
a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/BinaryOp.java
 
b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/BinaryOp.java
index 5c2e35e427..ad6ce003e8 100644
--- 
a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/BinaryOp.java
+++ 
b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/BinaryOp.java
@@ -34,18 +34,7 @@ public class BinaryOp {
                                               ExpressionResult right,
                                               int opType) throws 
IllegalExpressionException {
         if (left.getType() == ExpressionResultType.SINGLE_VALUE && 
right.getType() == ExpressionResultType.SINGLE_VALUE) {
-            double scalarLeft = 
left.getResults().get(0).getValues().get(0).getDoubleValue();
-            double scalarRight = 
right.getResults().get(0).getValues().get(0).getDoubleValue();
-            double value = scalarBinaryOp(scalarLeft, scalarRight, opType);
-            ExpressionResult result = new ExpressionResult();
-            MQEValue mqeValue = new MQEValue();
-            mqeValue.setDoubleValue(value);
-            mqeValue.setEmptyValue(false);
-            MQEValues mqeValues = new MQEValues();
-            mqeValues.getValues().add(mqeValue);
-            result.getResults().add(mqeValues);
-            result.setType(ExpressionResultType.SINGLE_VALUE);
-            return result;
+            return single2SingleBinaryOp(left, right, opType);
         } else if ((left.getType() == ExpressionResultType.TIME_SERIES_VALUES 
||
             left.getType() == ExpressionResultType.SORTED_LIST ||
             left.getType() == ExpressionResultType.RECORD_LIST)
@@ -106,6 +95,29 @@ public class BinaryOp {
         return result;
     }
 
+    private static ExpressionResult single2SingleBinaryOp(ExpressionResult 
singleLeft,
+                                                          ExpressionResult 
singleRight,
+                                                          int opType) {
+        ExpressionResult result = new ExpressionResult();
+        MQEValue mqeValue = new MQEValue();
+        MQEValues mqeValues = new MQEValues();
+        mqeValues.getValues().add(mqeValue);
+        result.getResults().add(mqeValues);
+        result.setType(ExpressionResultType.SINGLE_VALUE);
+
+        MQEValue left = singleLeft.getResults().get(0).getValues().get(0);
+        MQEValue right = singleRight.getResults().get(0).getValues().get(0);
+        //return null if one of them is empty
+        if (left.isEmptyValue() || right.isEmptyValue()) {
+            mqeValue.setEmptyValue(true);
+        } else {
+            double value = scalarBinaryOp(left.getDoubleValue(), 
right.getDoubleValue(), opType);
+            mqeValue.setDoubleValue(value);
+            mqeValue.setEmptyValue(false);
+        }
+        return result;
+    }
+
     //series or list with scalar
     private static ExpressionResult many2OneBinaryOp(ExpressionResult 
manyResult,
                                                      ExpressionResult 
singleResult,
@@ -127,8 +139,8 @@ public class BinaryOp {
     }
 
     private static ExpressionResult seriesNoLabeled(ExpressionResult 
seriesLeft,
-                                        ExpressionResult seriesRight,
-                                        int opType) {
+                                                    ExpressionResult 
seriesRight,
+                                                    int opType) {
         MQEValues mqeValuesL = seriesLeft.getResults().get(0);
         MQEValues mqeValuesR = seriesRight.getResults().get(0);
         mqeValuesL.setMetric(null);
@@ -150,8 +162,8 @@ public class BinaryOp {
     }
 
     private static ExpressionResult 
seriesLabeledWithNoLabeled(ExpressionResult seriesLeft,
-                                                   ExpressionResult 
seriesRight,
-                                                   int opType) {
+                                                               
ExpressionResult seriesRight,
+                                                               int opType) {
         MQEValues mqeValuesR = seriesRight.getResults().get(0);
         seriesLeft.getResults().forEach(mqeValuesL -> {
             for (int i = 0; i < mqeValuesL.getValues().size(); i++) {
@@ -172,8 +184,8 @@ public class BinaryOp {
     }
 
     private static ExpressionResult seriesLabeledWithLabeled(ExpressionResult 
seriesLeft,
-                                                 ExpressionResult seriesRight,
-                                                 int opType) throws 
IllegalExpressionException {
+                                                             ExpressionResult 
seriesRight,
+                                                             int opType) 
throws IllegalExpressionException {
         Map<KeyValue, List<MQEValue>> labelMapR = new HashMap<>();
         if (seriesLeft.getResults().size() != seriesRight.getResults().size()) 
{
             throw new IllegalExpressionException(
diff --git 
a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/FunctionOp.java
 
b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/FunctionOp.java
index 0b39fa73a8..d60380bd7a 100644
--- 
a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/FunctionOp.java
+++ 
b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/mqe/rt/operation/FunctionOp.java
@@ -65,8 +65,4 @@ public class FunctionOp {
         });
         return expResult;
     }
-
-    public static void main(String[] args) {
-        System.out.printf(String.valueOf(Math.floor(1.1112)));
-    }
 }
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 0ea05d22e5..87471f127f 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
@@ -39,18 +39,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "endpoint_relation_percentile"
-          ],
-          "metricTypes": [
-            "readLabeledMetricsValues"
-          ],
-          "metricConfig": [
-            {
-              "label": "P50, P75, P90, P95, P99",
-              "labelsIndex": "0,1,2,3,4"
-            }
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -62,14 +50,17 @@
               "widgetId": "3"
             }
           ],
-          "filters": {
-            "dataIndex": 15,
-            "sourceId": "3"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "latency": true
-          }
+          },
+          "metricMode": "Expression",
+          "expressions": [
+            
"relabels(endpoint_relation_percentile{label='0,1,2,3,4'},label='P50,P75,P90,P95,P99')"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 0,
@@ -90,15 +81,9 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "endpoint_relation_sla"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "metricConfig": [
             {
-              "calculation": "percentage"
+              "label": "success_rate"
             }
           ],
           "associate": [
@@ -112,14 +97,17 @@
               "widgetId": "3"
             }
           ],
-          "filters": {
-            "dataIndex": 15,
-            "sourceId": "3"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "status": "ERROR"
-          }
+          },
+          "metricMode": "Expression",
+          "expressions": [
+            "endpoint_relation_sla/100"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 0,
@@ -140,12 +128,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "endpoint_relation_cpm"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -157,10 +139,18 @@
               "widgetId": "3"
             }
           ],
-          "filters": {
-            "dataIndex": 15,
-            "sourceId": "3"
-          }
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "load"
+            }
+          ],
+          "expressions": [
+            "endpoint_relation_cpm"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 0,
@@ -181,12 +171,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "endpoint_relation_resp_time"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -201,7 +185,19 @@
           "relatedTrace": {
             "enableRelate": true,
             "latency": true
-          }
+          },
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "latency"
+            }
+          ],
+          "expressions": [
+            "endpoint_relation_resp_time"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         }
       ],
       "layer": "GENERAL",
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 4827aa218a..05f2a31700 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
@@ -50,18 +50,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "endpoint_percentile"
-                  ],
-                  "metricTypes": [
-                    "readLabeledMetricsValues"
-                  ],
-                  "metricConfig": [
-                    {
-                      "label": "P50, P75, P90, P95, P99",
-                      "labelsIndex": "0, 1, 2, 3, 4"
-                    }
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-5"
@@ -82,7 +70,14 @@
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    
"relabels(endpoint_percentile{label='0,1,2,3,4'},label='P50,P75,P90,P95,P99')"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 8,
@@ -103,12 +98,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "endpoint_resp_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-3"
@@ -129,7 +118,19 @@
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "latency"
+                    }
+                  ],
+                  "expressions": [
+                    "endpoint_resp_time"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 8,
@@ -151,12 +152,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "endpoint_mq_consume_latency"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-3"
@@ -173,6 +168,18 @@
                     {
                       "widgetId": "0-0-8"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "latency"
+                    }
+                  ],
+                  "expressions": [
+                    "endpoint_mq_consume_latency"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -194,12 +201,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "endpoint_sla"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-3"
@@ -223,8 +224,15 @@
                   },
                   "metricConfig": [
                     {
-                      "calculation": "percentage"
+                      "label": "success_rate"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "endpoint_sla/100"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -247,12 +255,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "endpoint_cpm"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-3"
@@ -269,6 +271,18 @@
                     {
                       "widgetId": "0-0-5"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "load"
+                    }
+                  ],
+                  "expressions": [
+                    "endpoint_cpm"
+                  ],
+                  "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 315b756ed7..ab8810aefe 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
@@ -39,19 +39,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_client_percentile"
-          ],
-          "metricTypes": [
-            "readLabeledMetricsValues"
-          ],
-          "metricConfig": [
-            {
-              "key": "P50, P75, P90, P95, P99",
-              "labelsIndex": "0,1,2,3,4",
-              "label": "P50, P75, P90, P95, P99"
-            }
-          ],
           "associate": [
             {
               "widgetId": "8"
@@ -75,14 +62,17 @@
               "widgetId": "7"
             }
           ],
-          "filters": {
-            "dataIndex": 19,
-            "sourceId": "4"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "latency": true
-          }
+          },
+          "metricMode": "Expression",
+          "expressions": [
+            
"relabels(service_instance_relation_client_percentile,label='P50,P75,P90,P95,P99')"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 0,
@@ -103,15 +93,9 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_client_call_sla"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "metricConfig": [
             {
-              "calculation": "percentage"
+              "label": "success_rate"
             }
           ],
           "associate": [
@@ -137,14 +121,17 @@
               "widgetId": "7"
             }
           ],
-          "filters": {
-            "dataIndex": 19,
-            "sourceId": "4"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "status": "ERROR"
-          }
+          },
+          "metricMode": "Expression",
+          "expressions": [
+            "service_instance_relation_client_call_sla/100"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 0,
@@ -165,12 +152,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_client_cpm"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -194,10 +175,18 @@
               "widgetId": "7"
             }
           ],
-          "filters": {
-            "dataIndex": 19,
-            "sourceId": "4"
-          }
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "load"
+            }
+          ],
+          "expressions": [
+            "service_instance_relation_client_cpm"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 0,
@@ -218,12 +207,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_client_resp_time"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -247,14 +230,22 @@
               "widgetId": "7"
             }
           ],
-          "filters": {
-            "dataIndex": 22,
-            "sourceId": "8"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "latency": true
-          }
+          },
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "latency"
+            }
+          ],
+          "expressions": [
+            "service_instance_relation_client_resp_time"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 12,
@@ -275,19 +266,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_server_percentile"
-          ],
-          "metricTypes": [
-            "readLabeledMetricsValues"
-          ],
-          "metricConfig": [
-            {
-              "key": "P50, P75, P90, P95, P99",
-              "labelsIndex": "0,1,2,3,4",
-              "label": "P50, P75, P90, P95, P99"
-            }
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -311,14 +289,17 @@
               "widgetId": "7"
             }
           ],
-          "filters": {
-            "dataIndex": 19,
-            "sourceId": "4"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "latency": true
-          }
+          },
+          "metricMode": "Expression",
+          "expressions": [
+            
"relabels(service_instance_relation_server_percentile,label='P50,P75,P90,P95,P99')"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 12,
@@ -339,15 +320,9 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_server_call_sla"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "metricConfig": [
             {
-              "calculation": "percentage"
+              "label": "success_rate"
             }
           ],
           "associate": [
@@ -373,14 +348,17 @@
               "widgetId": "7"
             }
           ],
-          "filters": {
-            "dataIndex": 19,
-            "sourceId": "4"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "status": "ERROR"
-          }
+          },
+          "metricMode": "Expression",
+          "expressions": [
+            "service_instance_relation_server_call_sla/100"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 12,
@@ -401,12 +379,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_server_cpm"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -430,10 +402,18 @@
               "widgetId": "8"
             }
           ],
-          "filters": {
-            "dataIndex": 19,
-            "sourceId": "4"
-          }
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "load"
+            }
+          ],
+          "expressions": [
+            "service_instance_relation_server_cpm"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 12,
@@ -454,12 +434,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "service_instance_relation_server_resp_time"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "associate": [
             {
               "widgetId": "1"
@@ -483,14 +457,22 @@
               "widgetId": "7"
             }
           ],
-          "filters": {
-            "dataIndex": 19,
-            "sourceId": "4"
-          },
           "relatedTrace": {
             "enableRelate": true,
             "latency": true
-          }
+          },
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "latency"
+            }
+          ],
+          "expressions": [
+            "service_instance_relation_server_resp_time"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         }
       ],
       "layer": "GENERAL",
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance.json
index c64b712af6..2194d85ac7 100644
--- 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance.json
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-instance.json
@@ -50,12 +50,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_instance_resp_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-16"
@@ -73,7 +67,19 @@
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "latency"
+                    }
+                  ],
+                  "expressions": [
+                    "service_instance_resp_time"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 12,
@@ -94,15 +100,9 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_instance_sla"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
-                      "calculation": "percentage"
+                      "label": "success_rate"
                     }
                   ],
                   "associate": [
@@ -122,7 +122,14 @@
                   "relatedTrace": {
                     "enableRelate": true,
                     "status": "ERROR"
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "service_instance_sla/100"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 0,
@@ -143,12 +150,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_instance_cpm"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -162,6 +163,18 @@
                     {
                       "widgetId": "0-0-10"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "load"
+                    }
+                  ],
+                  "expressions": [
+                    "service_instance_cpm"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -183,12 +196,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "meter_datasource"
-                  ],
-                  "metricTypes": [
-                    "readLabeledMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -202,6 +209,13 @@
                     {
                       "widgetId": "0-0-16"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "meter_datasource"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -223,12 +237,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "meter_thread_pool"
-                  ],
-                  "metricTypes": [
-                    "readLabeledMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -242,6 +250,18 @@
                     {
                       "widgetId": "0-0-10"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "thread_pool"
+                    }
+                  ],
+                  "expressions": [
+                    "meter_thread_pool"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 }
               ]
@@ -293,35 +313,32 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "instance_jvm_memory_noheap_max",
-                    "instance_jvm_memory_noheap",
-                    "instance_jvm_memory_heap",
-                    "instance_jvm_memory_heap_max"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
-                      "calculation": "byteToMB",
                       "label": "noheap_max"
                     },
                     {
-                      "calculation": "byteToMB",
                       "label": "noheap"
                     },
                     {
-                      "calculation": "byteToMB",
                       "label": "heap"
                     },
                     {
-                      "calculation": "byteToMB",
                       "label": "heap_max"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_jvm_memory_noheap_max/1048576",
+                    "instance_jvm_memory_noheap/1048576",
+                    "instance_jvm_memory_heap/1048576",
+                    "instance_jvm_memory_heap_max/1048576"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -342,16 +359,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "instance_jvm_thread_live_count",
-                    "instance_jvm_thread_daemon_count",
-                    "instance_jvm_thread_peak_count"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "live"
@@ -362,6 +369,17 @@
                     {
                       "label": "peak"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_jvm_thread_live_count",
+                    "instance_jvm_thread_daemon_count",
+                    "instance_jvm_thread_peak_count"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -378,18 +396,6 @@
                     "type": "Bar",
                     "showBackground": true
                   },
-                  "metrics": [
-                    "instance_jvm_thread_timed_waiting_state_thread_count",
-                    "instance_jvm_thread_blocked_state_thread_count",
-                    "instance_jvm_thread_waiting_state_thread_count",
-                    "instance_jvm_thread_runnable_state_thread_count"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "timed_waiting"
@@ -403,6 +409,19 @@
                     {
                       "label": "runnable"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_jvm_thread_timed_waiting_state_thread_count",
+                    "instance_jvm_thread_blocked_state_thread_count",
+                    "instance_jvm_thread_waiting_state_thread_count",
+                    "instance_jvm_thread_runnable_state_thread_count"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -423,11 +442,17 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "jvm_cpu"
+                    }
+                  ],
+                  "expressions": [
                     "instance_jvm_cpu"
                   ],
-                  "metricTypes": [
-                    "readMetricsValues"
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -446,16 +471,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "instance_jvm_class_loaded_class_count",
-                    "instance_jvm_class_total_loaded_class_count",
-                    "instance_jvm_class_total_unloaded_class_count"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "loaded"
@@ -466,6 +481,17 @@
                     {
                       "label": "total_unloaded"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_jvm_class_loaded_class_count",
+                    "instance_jvm_class_total_loaded_class_count",
+                    "instance_jvm_class_total_unloaded_class_count"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -486,16 +512,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "instance_jvm_young_gc_time",
-                    "instance_jvm_old_gc_time",
-                    "instance_jvm_normal_gc_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "young_gc"
@@ -506,6 +522,17 @@
                     {
                       "label": "normal_gc"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_jvm_young_gc_time",
+                    "instance_jvm_old_gc_time",
+                    "instance_jvm_normal_gc_time"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -522,16 +549,6 @@
                     "type": "Bar",
                     "showBackground": true
                   },
-                  "metrics": [
-                    "instance_jvm_young_gc_count",
-                    "instance_jvm_old_gc_count",
-                    "instance_jvm_normal_gc_count"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "young_gc"
@@ -542,6 +559,17 @@
                     {
                       "label": "normal_gc"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_jvm_young_gc_count",
+                    "instance_jvm_old_gc_count",
+                    "instance_jvm_normal_gc_count"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 }
               ]
@@ -567,16 +595,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "instance_clr_available_worker_threads",
-                    "instance_clr_available_completion_port_threads",
-                    "instance_clr_max_completion_port_threads"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "available_worker"
@@ -587,6 +605,17 @@
                     {
                       "label": "max_completion_port"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_clr_available_worker_threads",
+                    "instance_clr_available_completion_port_threads",
+                    "instance_clr_max_completion_port_threads"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -607,16 +636,12 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "instance_clr_heap_memory"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_clr_heap_memory/1048576"
                   ],
-                  "metricConfig": [
-                    {
-                      "calculation": "byteToMB"
-                    }
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -633,16 +658,6 @@
                     "type": "Bar",
                     "showBackground": true
                   },
-                  "metrics": [
-                    "instance_clr_gen0_collect_count",
-                    "instance_clr_gen1_collect_count",
-                    "instance_clr_gen2_collect_count"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "gen0"
@@ -653,6 +668,17 @@
                     {
                       "label": "gen2"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "instance_clr_gen0_collect_count",
+                    "instance_clr_gen1_collect_count",
+                    "instance_clr_gen2_collect_count"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 },
                 {
@@ -673,11 +699,17 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "clr_cpu"
+                    }
+                  ],
+                  "expressions": [
                     "instance_clr_cpu"
                   ],
-                  "metricTypes": [
-                    "readMetricsValues"
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
                   ]
                 }
               ]
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-root.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-root.json
index 414523c9f1..9619a8a3cc 100644
--- 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-root.json
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/general/general-root.json
@@ -27,17 +27,6 @@
           "h": 52,
           "i": "1",
           "type": "Tab",
-          "widget": {
-            "title": "Title"
-          },
-          "graph": {},
-          "metrics": [
-            ""
-          ],
-          "metricTypes": [
-            ""
-          ],
-          "activedTabIndex": 1,
           "children": [
             {
               "name": "Service",
@@ -49,9 +38,6 @@
                   "h": 48,
                   "i": "0",
                   "type": "Widget",
-                  "widget": {
-                    "title": ""
-                  },
                   "graph": {
                     "type": "ServiceList",
                     "dashboardName": "General-Service",
@@ -60,39 +46,51 @@
                     "showYAxis": false,
                     "showGroup": true
                   },
-                  "metrics": [
-                    "service_cpm",
-                    "service_sla",
-                    "service_resp_time",
-                    "service_apdex"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
-                  "moved": false,
                   "metricConfig": [
                     {
                       "label": "Load",
                       "unit": "calls / min",
-                      "calculation": "average"
+                      "detailLabel": "load"
                     },
                     {
-                      "calculation": "percentageAvg",
+                      "label": "Success Rate",
                       "unit": "%",
-                      "label": "Success Rate"
+                      "detailLabel": "success_rate"
                     },
                     {
-                      "calculation": "average",
                       "label": "Latency",
-                      "unit": "ms"
+                      "unit": "ms",
+                      "detailLabel": "latency"
                     },
                     {
-                      "calculation": "apdexAvg",
-                      "label": "Apdex"
+                      "label": "Apdex",
+                      "detailLabel": "apdex"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "avg(service_cpm)",
+                    "avg(service_sla)/100",
+                    "avg(service_resp_time)",
+                    "avg(service_apdex)/10000"
+                  ],
+                  "typesOfMQE": [
+                    "SINGLE_VALUE",
+                    "SINGLE_VALUE",
+                    "SINGLE_VALUE",
+                    "SINGLE_VALUE"
+                  ],
+                  "subExpressions": [
+                    "service_cpm",
+                    "service_sla/100",
+                    "service_resp_time",
+                    "service_apdex/10000"
+                  ],
+                  "subTypesOfMQE": [
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES",
+                    "TIME_SERIES_VALUES"
                   ]
                 }
               ]
@@ -107,19 +105,9 @@
                   "h": 48,
                   "i": "0",
                   "type": "Topology",
-                  "widget": {
-                    "title": "Title"
-                  },
                   "graph": {
                     "showDepth": true
                   },
-                  "metrics": [
-                    ""
-                  ],
-                  "metricTypes": [
-                    ""
-                  ],
-                  "moved": false,
                   "linkDashboard": "General-Service-Relation",
                   "nodeDashboard": [
                     {
@@ -211,19 +199,7 @@
                   "w": 24,
                   "h": 49,
                   "i": "0",
-                  "type": "Trace",
-                  "widget": {
-                    "title": "Title"
-                  },
-                  "graph": {},
-                  "standard": {},
-                  "metrics": [
-                    ""
-                  ],
-                  "metricTypes": [
-                    ""
-                  ],
-                  "moved": false
+                  "type": "Trace"
                 }
               ]
             },
@@ -240,8 +216,7 @@
                 }
               ]
             }
-          ],
-          "moved": false
+          ]
         },
         {
           "x": 0,
@@ -250,12 +225,6 @@
           "h": 2,
           "i": "100",
           "type": "Text",
-          "metricTypes": [
-            ""
-          ],
-          "metrics": [
-            ""
-          ],
           "graph": {
             "fontColor": "blue",
             "backgroundColor": "white",
@@ -263,8 +232,7 @@
             "fontSize": 14,
             "textAlign": "left",
             "url": 
"https://skywalking.apache.org/docs/main/next/en/setup/service-agent/server-agents/";
-          },
-          "moved": false
+          }
         }
       ],
       "id": "General-Root",
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 60ce141cef..e01454100c 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
@@ -50,12 +50,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_server_cpm"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-4"
@@ -79,10 +73,18 @@
                       "widgetId": "0-0-7"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 8,
-                    "sourceId": "0-0-4"
-                  }
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "load"
+                    }
+                  ],
+                  "expressions": [
+                    "service_relation_server_cpm"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 12,
@@ -103,15 +105,9 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_server_call_sla"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
-                      "calculation": "percentage"
+                      "label": "success_rate"
                     }
                   ],
                   "associate": [
@@ -137,14 +133,17 @@
                       "widgetId": "0-0-7"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 8,
-                    "sourceId": "0-0-4"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "status": "ERROR"
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "service_relation_server_call_sla/100"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 12,
@@ -165,19 +164,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_server_percentile"
-                  ],
-                  "metricTypes": [
-                    "readLabeledMetricsValues"
-                  ],
-                  "metricConfig": [
-                    {
-                      "key": "P50, P75, P90, P95, P99",
-                      "labelsIndex": "0,1,2,3,4",
-                      "label": "P50, P75, P90, P95, P99"
-                    }
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -201,14 +187,14 @@
                       "widgetId": "0-0-7"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 8,
-                    "sourceId": "0-0-4"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    
"relabels(service_relation_server_percentile,label='P50,P75,P90,P95,P99')"
+                  ]
                 },
                 {
                   "x": 12,
@@ -229,12 +215,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_server_resp_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -258,14 +238,22 @@
                       "widgetId": "0-0-7"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 8,
-                    "sourceId": "0-0-4"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "latency"
+                    }
+                  ],
+                  "expressions": [
+                    "service_relation_server_resp_time"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 0,
@@ -286,12 +274,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_client_resp_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -315,14 +297,22 @@
                       "widgetId": "0-0-7"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 19,
-                    "sourceId": "0-0-3"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "latency"
+                    }
+                  ],
+                  "expressions": [
+                    "service_relation_client_resp_time"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 0,
@@ -343,19 +333,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_client_percentile"
-                  ],
-                  "metricTypes": [
-                    "readLabeledMetricsValues"
-                  ],
-                  "metricConfig": [
-                    {
-                      "key": "P50, P75, P90, P95, P99",
-                      "labelsIndex": "0,1,2,3,4",
-                      "label": "P50, P75, P90, P95, P99"
-                    }
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -379,14 +356,17 @@
                       "widgetId": "0-0-7"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 8,
-                    "sourceId": "0-0-4"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    
"relabels(service_relation_client_percentile,label='P50,P75,P90,P95,P99')"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 0,
@@ -407,15 +387,9 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_client_call_sla"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
-                      "calculation": "percentage"
+                      "label": "success_rate"
                     }
                   ],
                   "associate": [
@@ -441,14 +415,17 @@
                       "widgetId": "0-0-7"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 8,
-                    "sourceId": "0-0-4"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "status": "ERROR"
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "service_relation_client_call_sla/100"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 0,
@@ -469,12 +446,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_relation_client_cpm"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "0-0-0"
@@ -498,10 +469,18 @@
                       "widgetId": "0-0-4"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 8,
-                    "sourceId": "0-0-4"
-                  }
+                  "expressions": [
+                    "service_relation_client_cpm"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ],
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "load"
+                    }
+                  ]
                 }
               ]
             },
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 8c382d3db6..41016603ee 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
@@ -46,16 +46,12 @@
                     "fontSize": 14,
                     "textAlign": "center"
                   },
-                  "metrics": [
-                    "service_apdex"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "avg(service_apdex)/10000"
                   ],
-                  "metricTypes": [
-                    "readMetricsValue"
-                  ],
-                  "metricConfig": [
-                    {
-                      "calculation": "apdex"
-                    }
+                  "typesOfMQE": [
+                    "SINGLE_VALUE"
                   ]
                 },
                 {
@@ -74,17 +70,17 @@
                     "textAlign": "center",
                     "showUnit": true
                   },
-                  "metrics": [
-                    "service_sla"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValue"
-                  ],
                   "metricConfig": [
                     {
-                      "calculation": "percentage",
                       "unit": "%"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "avg(service_sla)/100"
+                  ],
+                  "typesOfMQE": [
+                    "SINGLE_VALUE"
                   ]
                 },
                 {
@@ -95,7 +91,7 @@
                   "i": "2",
                   "type": "Widget",
                   "widget": {
-                    "title": "Service Load (calls / min)",
+                    "title": "Service Load",
                     "tips": "For HTTP 1/2, gRPC, RPC services, this means 
Calls Per Minute (calls / min)"
                   },
                   "graph": {
@@ -104,16 +100,17 @@
                     "textAlign": "center",
                     "showUnit": true
                   },
-                  "metrics": [
-                    "service_cpm"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValue"
-                  ],
                   "metricConfig": [
                     {
                       "unit": "calls / min"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "avg(service_cpm)"
+                  ],
+                  "typesOfMQE": [
+                    "SINGLE_VALUE"
                   ]
                 },
                 {
@@ -135,12 +132,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_resp_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "4-0-10"
@@ -164,7 +155,20 @@
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "unit": "ms",
+                      "label": "latency"
+                    }
+                  ],
+                  "expressions": [
+                    "service_resp_time"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 6,
@@ -185,15 +189,9 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_apdex"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
-                      "calculation": "apdex"
+                      "label": "apdex"
                     }
                   ],
                   "associate": [
@@ -216,15 +214,18 @@
                       "widgetId": "4-0-9"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 12,
-                    "sourceId": "4-0-3"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "queryOrder": "BY_DURATION",
                     "status": "ERROR"
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "service_apdex/10000"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 12,
@@ -245,18 +246,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_percentile"
-                  ],
-                  "metricTypes": [
-                    "readLabeledMetricsValues"
-                  ],
-                  "metricConfig": [
-                    {
-                      "label": "P50, P75, P90, P95, P99",
-                      "labelsIndex": "0, 1, 2, 3, 4"
-                    }
-                  ],
                   "associate": [
                     {
                       "widgetId": "4-0-3"
@@ -277,14 +266,17 @@
                       "widgetId": "4-0-9"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 12,
-                    "sourceId": "4-0-3"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "latency": true
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    
"relabels(service_percentile{label=\"0,1,2,3,4\"},label=\"P50,P75,P90,P95,P99\")"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 0,
@@ -305,15 +297,9 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_sla"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
-                      "calculation": "percentage"
+                      "label": "success_rate"
                     }
                   ],
                   "associate": [
@@ -336,14 +322,17 @@
                       "widgetId": "4-0-9"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 12,
-                    "sourceId": "4-0-3"
-                  },
                   "relatedTrace": {
                     "enableRelate": true,
                     "status": "ERROR"
-                  }
+                  },
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "service_sla/100"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 18,
@@ -365,12 +354,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_cpm"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "4-0-3"
@@ -391,10 +374,18 @@
                       "widgetId": "4-0-9"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 12,
-                    "sourceId": "4-0-3"
-                  }
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "load"
+                    }
+                  ],
+                  "expressions": [
+                    "service_cpm"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 8,
@@ -415,12 +406,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_mq_consume_count"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "4-0-3"
@@ -441,10 +426,18 @@
                       "widgetId": "4-0-10"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 12,
-                    "sourceId": "4-0-3"
-                  }
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "consuming_count"
+                    }
+                  ],
+                  "expressions": [
+                    "service_mq_consume_count"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 16,
@@ -466,12 +459,6 @@
                     "showXAxis": true,
                     "showYAxis": true
                   },
-                  "metrics": [
-                    "service_mq_consume_latency"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues"
-                  ],
                   "associate": [
                     {
                       "widgetId": "4-0-3"
@@ -492,10 +479,18 @@
                       "widgetId": "4-0-9"
                     }
                   ],
-                  "filters": {
-                    "dataIndex": 12,
-                    "sourceId": "4-0-3"
-                  }
+                  "metricMode": "Expression",
+                  "metricConfig": [
+                    {
+                      "label": "avg_consuming_latency"
+                    }
+                  ],
+                  "expressions": [
+                    "service_mq_consume_latency"
+                  ],
+                  "typesOfMQE": [
+                    "TIME_SERIES_VALUES"
+                  ]
                 },
                 {
                   "x": 0,
@@ -511,11 +506,12 @@
                   "graph": {
                     "type": "TopList"
                   },
-                  "metrics": [
-                    "service_instance_cpm"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "top_n(service_instance_cpm,10,des)"
                   ],
-                  "metricTypes": [
-                    "sortMetrics"
+                  "typesOfMQE": [
+                    "SORTED_LIST"
                   ]
                 },
                 {
@@ -532,11 +528,12 @@
                     "type": "TopList",
                     "topN": "10"
                   },
-                  "metrics": [
-                    "service_instance_resp_time"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "top_n(service_instance_resp_time,10,des)"
                   ],
-                  "metricTypes": [
-                    "sortMetrics"
+                  "typesOfMQE": [
+                    "SORTED_LIST"
                   ]
                 },
                 {
@@ -553,17 +550,12 @@
                     "type": "TopList",
                     "topN": "10"
                   },
-                  "metrics": [
-                    "service_instance_sla"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "top_n(service_instance_sla,10,asc)/100"
                   ],
-                  "metricTypes": [
-                    "sortMetrics"
-                  ],
-                  "metricConfig": [
-                    {
-                      "sortOrder": "ASC",
-                      "calculation": "percentage"
-                    }
+                  "typesOfMQE": [
+                    "SORTED_LIST"
                   ]
                 },
                 {
@@ -580,17 +572,12 @@
                     "type": "TopList",
                     "topN": "10"
                   },
-                  "metrics": [
-                    "endpoint_sla"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "top_n(endpoint_sla,10,asc)/100"
                   ],
-                  "metricTypes": [
-                    "sortMetrics"
-                  ],
-                  "metricConfig": [
-                    {
-                      "sortOrder": "ASC",
-                      "calculation": "percentage"
-                    }
+                  "typesOfMQE": [
+                    "SORTED_LIST"
                   ]
                 },
                 {
@@ -607,11 +594,12 @@
                     "type": "TopList",
                     "topN": "10"
                   },
-                  "metrics": [
-                    "endpoint_resp_time"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "top_n(endpoint_resp_time,10,des)"
                   ],
-                  "metricTypes": [
-                    "sortMetrics"
+                  "typesOfMQE": [
+                    "SORTED_LIST"
                   ]
                 },
                 {
@@ -629,11 +617,12 @@
                     "type": "TopList",
                     "topN": "10"
                   },
-                  "metrics": [
-                    "endpoint_cpm"
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "top_n(endpoint_cpm,10,des)"
                   ],
-                  "metricTypes": [
-                    "sortMetrics"
+                  "typesOfMQE": [
+                    "SORTED_LIST"
                   ]
                 }
               ]
@@ -653,32 +642,38 @@
                     "dashboardName": "General-Instance",
                     "fontSize": 12
                   },
-                  "metrics": [
-                    "service_instance_cpm",
-                    "service_instance_sla",
-                    "service_instance_resp_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
                       "label": "Load",
-                      "unit": "calls / min",
-                      "calculation": "average"
+                      "detailLabel": "load",
+                      "unit": "calls / min"
                     },
                     {
-                      "calculation": "percentageAvg",
-                      "unit": "%",
-                      "label": "Success Rate"
+                      "detailLabel": "success_rate",
+                      "label": "Success Rate",
+                      "unit": "%"
                     },
                     {
-                      "calculation": "average",
                       "label": "Latency",
+                      "detailLabel": "latency",
                       "unit": "ms"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "avg(service_instance_cpm)",
+                    "avg(service_instance_sla)/100",
+                    "avg(service_instance_resp_time)"
+                  ],
+                  "subExpressions": [
+                    "service_instance_cpm",
+                    "service_instance_sla/100",
+                    "service_instance_resp_time"
+                  ],
+                  "subTypesOfMQE": [
+                    "",
+                    "",
+                    ""
                   ]
                 }
               ]
@@ -700,32 +695,43 @@
                     "showXAxis": false,
                     "showYAxis": false
                   },
-                  "metrics": [
-                    "endpoint_cpm",
-                    "endpoint_sla",
-                    "endpoint_resp_time"
-                  ],
-                  "metricTypes": [
-                    "readMetricsValues",
-                    "readMetricsValues",
-                    "readMetricsValues"
-                  ],
                   "metricConfig": [
                     {
-                      "label": "Load",
-                      "unit": "calls / min",
-                      "calculation": "average"
+                      "label": "Success Rate",
+                      "detailLabel": "success_rate",
+                      "unit": "%"
                     },
                     {
-                      "calculation": "percentageAvg",
-                      "unit": "%",
-                      "label": "Success Rate"
+                      "label": "Success Rate",
+                      "detailLabel": "success_rate",
+                      "unit": "%"
                     },
                     {
-                      "calculation": "average",
                       "label": "Latency",
+                      "detailLabel": "latency",
                       "unit": "ms"
                     }
+                  ],
+                  "metricMode": "Expression",
+                  "expressions": [
+                    "avg(endpoint_cpm)",
+                    "avg(endpoint_sla)/100",
+                    "avg(endpoint_resp_time)"
+                  ],
+                  "subExpressions": [
+                    "endpoint_cpm",
+                    "endpoint_sla/100",
+                    "endpoint_resp_time"
+                  ],
+                  "subTypesOfMQE": [
+                    "",
+                    "",
+                    ""
+                  ],
+                  "typesOfMQE": [
+                    "",
+                    "",
+                    ""
                   ]
                 }
               ]
diff --git 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-root.json
 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-root.json
index 6f237383bf..2fb61f61a8 100644
--- 
a/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-root.json
+++ 
b/oap-server/server-starter/src/main/resources/ui-initialized-templates/virtual_database/virtual-database-root.json
@@ -38,33 +38,38 @@
             "showYAxis": false,
             "showGroup": false
           },
-          "metrics": [
-            "database_access_resp_time",
-            "database_access_sla",
-            "database_access_cpm"
-          ],
-          "metricTypes": [
-            "readMetricsValues",
-            "readMetricsValues",
-            "readMetricsValues"
-          ],
-          "moved": false,
           "metricConfig": [
             {
-              "unit": "ms",
               "label": "Latency",
-              "calculation": "average"
+              "detailLabel": "latency",
+              "unit": "ms"
             },
             {
               "label": "Successful Rate",
-              "unit": "%",
-              "calculation": "percentageAvg"
+              "detailLabel": "successful_rate",
+              "unit": "%"
             },
             {
               "label": "Traffic",
-              "unit": "calls / min",
-              "calculation": "average"
+              "detailLabel": "traffic",
+              "unit": "calls / min"
             }
+          ],
+          "metricMode": "Expression",
+          "expressions": [
+            "avg(database_access_resp_time)",
+            "avg(database_access_sla)/100",
+            "avg(database_access_cpm)"
+          ],
+          "subExpressions": [
+            "database_access_resp_time",
+            "database_access_sla/100",
+            "database_access_cpm"
+          ],
+          "subTypesOfMQE": [
+            "",
+            "",
+            ""
           ]
         },
         {
@@ -74,12 +79,6 @@
           "h": 2,
           "i": "100",
           "type": "Text",
-          "metricTypes": [
-            ""
-          ],
-          "metrics": [
-            ""
-          ],
           "graph": {
             "fontColor": "blue",
             "backgroundColor": "white",
@@ -87,8 +86,7 @@
             "fontSize": 14,
             "textAlign": "left",
             "url": 
"https://skywalking.apache.org/docs/main/next/en/setup/service-agent/virtual-database/";
-          },
-          "moved": false
+          }
         }
       ],
       "id": "Virtual-Database-Root",
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 d4bf97bf6d..17d9e11829 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
@@ -34,14 +34,11 @@
             "type": "TopList",
             "color": "purple"
           },
-          "metrics": [
-            "top_n_database_statement"
+          "metricMode": "Expression",
+          "expressions": [
+            "top_n(top_n_database_statement,10,des)"
           ],
-          "metricTypes": [
-            "readRecords"
-          ],
-          "value": "2",
-          "label": "2"
+          "typesOfMQE": []
         },
         {
           "x": 6,
@@ -62,19 +59,11 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "database_access_sla"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
           "metricConfig": [
             {
-              "calculation": "percentage"
+              "label": "success_rate"
             }
           ],
-          "value": "3",
-          "label": "Successful_Rate",
           "associate": [
             {
               "widgetId": "5"
@@ -86,10 +75,13 @@
               "widgetId": "6"
             }
           ],
-          "filters": {
-            "dataIndex": 17,
-            "sourceId": "4"
-          }
+          "metricMode": "Expression",
+          "expressions": [
+            "database_access_sla/100"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 12,
@@ -110,14 +102,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "database_access_cpm"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
-          "value": "4",
-          "label": "Database_Traffic",
           "associate": [
             {
               "widgetId": "3"
@@ -128,6 +112,18 @@
             {
               "widgetId": "6"
             }
+          ],
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "traffic"
+            }
+          ],
+          "expressions": [
+            "database_access_cpm"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
           ]
         },
         {
@@ -149,20 +145,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "database_access_percentile"
-          ],
-          "metricTypes": [
-            "readLabeledMetricsValues"
-          ],
-          "metricConfig": [
-            {
-              "label": "P50, P75, P90, P95, P99",
-              "labelsIndex": "0,1,2,3,4"
-            }
-          ],
-          "value": "5",
-          "label": "5",
           "associate": [
             {
               "widgetId": "3"
@@ -174,10 +156,13 @@
               "widgetId": "6"
             }
           ],
-          "filters": {
-            "dataIndex": 17,
-            "sourceId": "4"
-          }
+          "metricMode": "Expression",
+          "expressions": [
+            
"relabels(database_access_percentile{label='0,1,2,3,4'},label='P50,P75,P90,P95,P99')"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         },
         {
           "x": 0,
@@ -198,14 +183,6 @@
             "showXAxis": true,
             "showYAxis": true
           },
-          "metrics": [
-            "database_access_resp_time"
-          ],
-          "metricTypes": [
-            "readMetricsValues"
-          ],
-          "value": "6",
-          "label": "Database_Avg_Response",
           "associate": [
             {
               "widgetId": "3"
@@ -217,10 +194,18 @@
               "widgetId": "5"
             }
           ],
-          "filters": {
-            "dataIndex": 17,
-            "sourceId": "4"
-          }
+          "metricMode": "Expression",
+          "metricConfig": [
+            {
+              "label": "latency"
+            }
+          ],
+          "expressions": [
+            "database_access_resp_time"
+          ],
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ]
         }
       ],
       "layer": "VIRTUAL_DATABASE",
diff --git a/skywalking-ui b/skywalking-ui
index d662a0fb54..7738695601 160000
--- a/skywalking-ui
+++ b/skywalking-ui
@@ -1 +1 @@
-Subproject commit d662a0fb546cb85da8ed1809b79f0de36adb366c
+Subproject commit 7738695601af5a16542ad44f9e307f79bb13b01b


Reply via email to