Merge branch 'develop' of https://github.com/panxiaojun233/incubator-dubbo-admin into panxiaojun233-develop
diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/Constants.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/Constants.java
index 6bd38ca..b10f566 100644
--- a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/Constants.java
+++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/Constants.java
@@ -55,6 +55,8 @@
     public static final String SPECIFICATION_VERSION_KEY = "release";
     public static final String GLOBAL_CONFIG = "global";
     public static final String GLOBAL_CONFIG_PATH = "config/dubbo/dubbo.properties";
+    public static final String METRICS_PORT = "metrics.port";
+    public static final String METRICS_PROTOCOL = "metrics.protocol";
     public static final Set<String> CONFIGS = new HashSet<>();
 
     static {
diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/ConvertUtil.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/ConvertUtil.java
index 2d4916a..c360e09 100644
--- a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/ConvertUtil.java
+++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/ConvertUtil.java
@@ -19,8 +19,10 @@
 import org.apache.dubbo.admin.model.dto.BaseDTO;
 import org.apache.dubbo.common.Constants;
 import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.metadata.definition.model.MethodDefinition;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 public class ConvertUtil {
@@ -63,4 +65,12 @@
             return org.apache.dubbo.admin.common.util.Constants.SERVICE;
         }
     }
+
+    public static Map methodList2Map(List<MethodDefinition> methods) {
+        Map<String, MethodDefinition> res = new HashMap<>();
+        for (int i = 0; i < methods.size(); i++) {
+            res.put(methods.get(i).getName(), methods.get(i));
+        }
+        return res;
+    }
 }
diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/MetricsCollectController.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/MetricsCollectController.java
new file mode 100644
index 0000000..9e3d62a
--- /dev/null
+++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/MetricsCollectController.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.admin.controller;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import org.apache.dubbo.admin.common.util.Constants;
+import org.apache.dubbo.admin.model.domain.Consumer;
+import org.apache.dubbo.admin.model.domain.Provider;
+import org.apache.dubbo.admin.model.dto.MetricDTO;
+import org.apache.dubbo.admin.service.ConsumerService;
+import org.apache.dubbo.admin.service.ProviderService;
+import org.apache.dubbo.admin.service.impl.MetrcisCollectServiceImpl;
+import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
+import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.PathVariable;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.Iterator;
+
+
+
+@RestController
+@RequestMapping("/api/{env}/metrics")
+public class MetricsCollectController {
+
+    @Autowired
+    private ProviderService providerService;
+
+    @Autowired
+    private ConsumerService consumerService;
+
+    @RequestMapping(method = RequestMethod.POST)
+    public String metricsCollect(@RequestParam String group, @PathVariable String env) {
+        MetrcisCollectServiceImpl service = new MetrcisCollectServiceImpl();
+        service.setUrl("dubbo://127.0.0.1:20880?scope=remote&cache=true");
+
+        return service.invoke(group).toString();
+    }
+
+    private String getOnePortMessage(String group, String ip, String port, String protocol) {
+        MetrcisCollectServiceImpl metrcisCollectService = new MetrcisCollectServiceImpl();
+        metrcisCollectService.setUrl(protocol + "://" + ip + ":" + port +"?scope=remote&cache=true");
+        String res = metrcisCollectService.invoke(group).toString();
+        return res;
+    }
+
+    @RequestMapping( value = "/ipAddr", method = RequestMethod.GET)
+    public List<MetricDTO> searchService(@RequestParam String ip, @RequestParam String group, @PathVariable String env) {
+
+        System.out.println(ip);
+        Map<String, String> configMap = new HashMap<String, String>();
+        addMetricsConfigToMap(configMap);
+
+//         default value
+        if (configMap.size() <= 0) {
+            configMap.put("20880", "dubbo");
+        }
+        List<MetricDTO> metricDTOS = new ArrayList<>();
+        for (String port : configMap.keySet()) {
+            String protocol = configMap.get(port);
+            String res = getOnePortMessage(group, ip, port, protocol);
+            metricDTOS.addAll(new Gson().fromJson(res, new TypeToken<List<MetricDTO>>(){}.getType()));
+        }
+
+        return metricDTOS;
+    }
+
+    protected void addMetricsConfigToMap(Map<String, String> configMap) {
+        Set<String> services = providerService.findServices();
+        services.addAll(consumerService.findServices());
+        Iterator<String> it = services.iterator();
+        while (it.hasNext()) {
+            String service = it.next();
+            List<Provider>  providers = providerService.findByService(service);
+            List<Consumer> consumers = consumerService.findByService(service);
+            String providerApplication = null;
+            String consumerApplication = null;
+            providerApplication = providers.get(0).getApplication();
+            consumerApplication = consumers.get(0).getApplication();
+
+            MetadataIdentifier providerMetadataIdentifier = new MetadataIdentifier(service
+                    ,null,null, Constants.PROVIDER_SIDE ,providerApplication);
+            MetadataIdentifier consumerMetadataIdentifier = new MetadataIdentifier(service
+                    ,null,null, Constants.CONSUMER_SIDE ,consumerApplication);
+
+            if (consumerApplication != null) {
+                String consumerMetadata = consumerService.getConsumerMetadata(consumerMetadataIdentifier);
+                Map<String, String> consumerParameters = new Gson().fromJson(consumerMetadata, Map.class);
+                configMap.put(consumerParameters.get(Constants.METRICS_PORT), consumerParameters.get(Constants.METRICS_PROTOCOL));
+            }
+
+            if (providerApplication != null) {
+                String providerMetaData = providerService.getProviderMetaData(providerMetadataIdentifier);
+                FullServiceDefinition providerServiceDefinition = new Gson().fromJson(providerMetaData, FullServiceDefinition.class);
+                Map<String, String> parameters = providerServiceDefinition.getParameters();
+                configMap.put(parameters.get(Constants.METRICS_PORT), parameters.get(Constants.METRICS_PROTOCOL));
+            }
+        }
+        configMap.remove(null);
+    }
+}
diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/ServiceController.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/ServiceController.java
index e1b8679..66a05b8 100644
--- a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/ServiceController.java
+++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/ServiceController.java
@@ -38,6 +38,7 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -107,7 +108,7 @@
 
     @RequestMapping(value = "/services", method = RequestMethod.GET)
     public Set<String> allServices(@PathVariable String env) {
-        return providerService.findServices();
+        return new HashSet<>(providerService.findServices());
     }
 
     @RequestMapping(value = "/applications", method = RequestMethod.GET)
diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/model/dto/MetricDTO.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/model/dto/MetricDTO.java
new file mode 100644
index 0000000..8091cb3
--- /dev/null
+++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/model/dto/MetricDTO.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.admin.model.dto;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MetricDTO {
+
+    private MetricDTO() {
+    }
+
+    private String metric;
+
+    private Long timestamp;
+
+    private Object value;
+
+    private MetricType metricType;
+
+    private Map<String, String> tags = new HashMap<String, String>();
+
+    private MetricLevel metricLevel;
+
+    private transient String meterName;
+
+
+    /**
+     * 分桶统计时间间隔,目前针对Meter/Timer/Compass有效,-1表示此项无效
+     */
+    private int interval = -1;
+
+    @Override
+    public boolean equals(Object o) {
+
+        if (o == this) {
+            return true;
+        }
+
+        if (!(o instanceof MetricDTO)) {
+            return false;
+        }
+
+        final MetricDTO rhs = (MetricDTO) o;
+
+        return equals(metric, rhs.metric) && equals(tags, rhs.tags) && equals(metricType, rhs.metricType)
+                && equals(metricLevel, rhs.metricLevel);
+    }
+
+    @Override
+    public int hashCode() {
+        return Arrays.hashCode(new Object[]{metric, tags, metricType, metricLevel});
+    }
+
+    @Override
+    public String toString() {
+        return this.getClass().getSimpleName() + "->metric: " + metric + ",value: "
+                + value + ",timestamp: " + timestamp + ",type: " + metricType
+                + ",tags: " + tags + ",level: " + metricLevel;
+    }
+
+    public String getMetric() {
+        return metric;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public Map<String, String> getTags() {
+        return tags;
+    }
+
+    public MetricLevel getMetricLevel() {
+        return metricLevel;
+    }
+
+    public MetricType getMetricType() {
+        return metricType;
+    }
+
+    public int getInterval() {
+        return interval;
+    }
+
+    public String getMeterName(){
+        return meterName;
+    }
+
+    private boolean equals(Object a, Object b) {
+        return (a == b) || (a != null && a.equals(b));
+    }
+
+    public String getService() {
+        return getTags().get("service");
+    }
+
+    public enum MetricType {
+        /**
+         * 用于累加型的数据
+         */
+        COUNTER,
+        /**
+         * 用于瞬态数据
+         */
+        GAUGE,
+        /**
+         * 用于争分整秒的计数
+         */
+        DELTA,
+        /**
+         * 用于集群分位数计算
+         */
+        PERCENTILE
+    }
+
+    public enum MetricLevel {
+
+        TRIVIAL, // 轻微指标
+
+        MINOR,   // 次要指标
+
+        NORMAL,  // 一般指标
+
+        MAJOR,   // 重要指标
+
+        CRITICAL; // 关键指标
+    }
+}
diff --git a/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/service/impl/MetrcisCollectServiceImpl.java b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/service/impl/MetrcisCollectServiceImpl.java
new file mode 100644
index 0000000..53840e1
--- /dev/null
+++ b/dubbo-admin-server/src/main/java/org/apache/dubbo/admin/service/impl/MetrcisCollectServiceImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.admin.service.impl;
+
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.monitor.MetricsService;
+
+public class MetrcisCollectServiceImpl {
+
+    private ReferenceConfig<MetricsService> referenceConfig;
+
+    public MetrcisCollectServiceImpl() {
+        referenceConfig = new ReferenceConfig<>();
+        referenceConfig.setApplication(new ApplicationConfig("dubbo-admin"));
+        referenceConfig.setInterface(MetricsService.class);
+    }
+
+    public void setUrl(String url) {
+        referenceConfig.setUrl(url);
+    }
+
+    public Object invoke(String group) {
+        MetricsService metricsService = referenceConfig.get();
+        return metricsService.getMetricsByGroup(group);
+    }
+}
diff --git a/dubbo-admin-server/src/test/java/org/apache/dubbo/admin/service/DirectConnectTest.java b/dubbo-admin-server/src/test/java/org/apache/dubbo/admin/service/DirectConnectTest.java
new file mode 100644
index 0000000..4821f1f
--- /dev/null
+++ b/dubbo-admin-server/src/test/java/org/apache/dubbo/admin/service/DirectConnectTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.admin.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+public class DirectConnectTest {
+
+    @Test
+    public void testDirectService() {
+//        MetrcisCollectServiceImpl service = new MetrcisCollectServiceImpl();
+//        service.setUrl("dubbo://admindeMacBook-Pro.local:54188/org.apache.dubbo.monitor.MetricsService");
+//        System.out.println(service.invoke("dubbo"));
+    }
+}
diff --git a/dubbo-admin-ui/src/api/chart.js b/dubbo-admin-ui/src/api/chart.js
index 4190c7b..4ab0059 100644
--- a/dubbo-admin-ui/src/api/chart.js
+++ b/dubbo-admin-ui/src/api/chart.js
@@ -17,13 +17,12 @@
 const range = (start, end) => new Array(end - start).fill(start).map((el, i) => start + i)
 
 const shortMonth = [
-  'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+  1, 2, 3, 4, 5, 6
 ]
 const monthVisitData = shortMonth.map(m => {
   return {
-    'month': m,
-    'Unique Visit': Math.floor(Math.random() * 1000) + 200,
-    'Page View': Math.floor(Math.random() * 1000) + 250
+    'time': m,
+    'Value': Math.floor(Math.random() * 1000) + 200
   }
 })
 
diff --git a/dubbo-admin-ui/src/components/metrics/ServiceMetrics.vue b/dubbo-admin-ui/src/components/metrics/ServiceMetrics.vue
index e1765a9..36416f1 100644
--- a/dubbo-admin-ui/src/components/metrics/ServiceMetrics.vue
+++ b/dubbo-admin-ui/src/components/metrics/ServiceMetrics.vue
@@ -27,72 +27,108 @@
       <v-flex lg4 sm6 xs12>
         <v-card>
           <v-card-text>
+            <h4>Provider (Total)</h4>
+            <hr style="height:3px;border:none;border-top:3px double #9D9D9D;" />
             <mini-chart
-              title="Monthly Sales"
-              sub-title="10%"
-              icon="trending_up"
+              title="qps(ms)"
+              :sub-title="majorDataMap.provider.qps"
+              :icon="majorDataMap.provider.qps_trending"
               :data="dataset.monthVisit"
               :chart-color="color.blue.base"
               type="line"
-            >
-            </mini-chart>
+            ></mini-chart>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
             <mini-chart
-              title="Monthly Sales"
-              sub-title="10%"
-              icon="trending_up"
+              title="rt(ms)"
+              :sub-title="majorDataMap.provider.rt"
+              :icon="majorDataMap.provider.rt_trending"
               :data="dataset.monthVisit"
               :chart-color="color.blue.base"
               type="line"
-            >
-            </mini-chart>
+              class="minichart"
+            ></mini-chart>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
+            <mini-chart
+              title="success rate"
+              :sub-title="majorDataMap.provider.success_rate"
+              :icon="majorDataMap.provider.success_rate_trending"
+              :data="dataset.monthVisit"
+              :chart-color="color.blue.base"
+              type="line"
+            ></mini-chart>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
           </v-card-text>
         </v-card>
       </v-flex>
       <v-flex lg4 sm6 xs12>
         <v-card>
           <v-card-text>
+            <h4>Consumer (Total)</h4>
+            <hr style="height:3px;border:none;border-top:3px double #9D9D9D;" />
             <mini-chart
-              title="Monthly Sales"
-              sub-title="10%"
-              icon="trending_up"
+              title="qps(ms)"
+              :sub-title="majorDataMap.consumer.qps"
+              :icon="majorDataMap.consumer.qps_trending"
               :data="dataset.monthVisit"
               :chart-color="color.blue.base"
               type="line"
-            >
-            </mini-chart>
+            ></mini-chart>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
             <mini-chart
-              title="Monthly Sales"
-              sub-title="10%"
-              icon="trending_up"
+              title="rt(ms)"
+              :sub-title="majorDataMap.consumer.rt"
+              :icon="majorDataMap.consumer.rt_trending"
               :data="dataset.monthVisit"
               :chart-color="color.blue.base"
               type="line"
-            >
-            </mini-chart>
+            ></mini-chart>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
+            <mini-chart
+              title="success rate"
+              :sub-title="majorDataMap.consumer.success_rate"
+              :icon="majorDataMap.consumer.success_rate_trending"
+              :data="dataset.monthVisit"
+              :chart-color="color.blue.base"
+              type="line"
+            ></mini-chart>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
           </v-card-text>
         </v-card>
       </v-flex>
       <v-flex lg4 sm6 xs12>
         <v-card>
           <v-card-text>
-            <mini-chart
-              title="Monthly Sales"
-              sub-title="10%"
-              icon="trending_up"
-              :data="dataset.monthVisit"
-              :chart-color="color.blue.base"
-              type="line"
-            >
-            </mini-chart>
-            <mini-chart
-              title="Monthly Sales"
-              sub-title="10%"
-              icon="trending_up"
-              :data="dataset.monthVisit"
-              :chart-color="color.blue.base"
-              type="line"
-            >
-            </mini-chart>
+            <h4>Thread Pool</h4>
+            <hr style="height:3px;border:none;border-top:3px double #9D9D9D;" />
+              <div class="layout row ma-0 align-center justify-space-between">
+                <div class="text-box">
+                  <div class="subheading pb-2">active count</div>
+                  <span class="grey--text">{{this.threadPoolData.active}} <v-icon small color="green">{{this.threadPoolData.active_trending}}</v-icon> </span>
+                </div>
+                <div class="chart">
+                  <v-progress-circular
+                    :size="60"
+                    :width="5"
+                    :rotate="360"
+                    :value="this.threadPoolData.activert"
+                    color="success"
+                  >
+                    {{this.threadPoolData.activert}}
+                  </v-progress-circular>
+                </div>
+              </div>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
+            <div class="layout row ma-0 align-center justify-space-between">
+              <div class="subheading pb-2">core size</div>
+              <span class="grey--text">{{this.threadPoolData.core}} </span>
+              <div class="subheading pb-2">max size</div>
+              <span class="grey--text">{{this.threadPoolData.max}} </span>
+              <div class="subheading pb-2">current size</div>
+              <span class="grey--text">{{this.threadPoolData.current}} </span>
+              <div style="height:60px"></div>
+              <v-icon small color="green">{{this.threadPoolData.current_trending}}</v-icon>
+            </div>
+            <hr style="height:1px;border:none;border-top:1px solid #ADADAD;" />
           </v-card-text>
         </v-card>
       </v-flex>
@@ -110,6 +146,7 @@
           </v-tab>
           <v-tab-item>
             <v-data-table
+              id="providerList"
               class="elevation-1"
               :headers="headers"
               :items="providerDetails"
@@ -151,13 +188,18 @@
   import Breadcrumb from '@/components/public/Breadcrumb'
   import Search from '@/components/public/Search'
   import {
-    monthVisitData,
     campaignData,
     locationData,
     StackData,
     SinData
   } from '@/api/chart'
+
+  const shortMonth = [
+    1, 2, 3, 4, 5, 6
+  ]
+
   export default {
+
     name: 'ServiceMetrics',
     components: {
       MiniChart,
@@ -167,6 +209,48 @@
     },
     data () {
       return {
+        threadPoolData: {
+          'core': 0,
+          'max': 0,
+          'current': 0,
+          'current_trending': '',
+          'active': 0,
+          'active_trending': '',
+          'activert': 0
+        },
+        echartMap: {
+          'provider': [{
+            'timestamp': 0,
+            'qps': 0,
+            'tt': 0,
+            'success_rate': 0
+          }],
+          'consumer': [{
+            'timestamp': 0,
+            'qps': 0,
+            'tt': 0,
+            'success_rate': 0
+          }]
+        },
+        majorDataMap: {
+          provider: {
+            qps: '0',
+            qps_trending: '',
+            rt: '0',
+            rt_trending: '',
+            success_rate: '0%',
+            success_rate_trending: ''
+          },
+          consumer: {
+            qps: '0',
+            qps_trending: '',
+            rt: '0',
+            rt_trending: '',
+            success_rate: '0%',
+            success_rate_trending: ''
+          },
+          threadPool: {}
+        },
         selectedTab: 'tab-1',
         filter: '',
         headers: [],
@@ -176,14 +260,14 @@
             method: 'aaaa~ICS',
             qps: '0.58',
             rt: '111',
-            successRate: '100%'
+            success_rate: '100%'
           },
           {
             service: 'a.b.c.f',
             method: 'bbbb~ICS',
             qps: '0.87',
             rt: '120',
-            successRate: '90%'
+            success_rate: '90%'
           }
 
         ],
@@ -191,7 +275,12 @@
         option: null,
         dataset: {
           sinData: SinData,
-          monthVisit: monthVisitData,
+          monthVisit: shortMonth.map(m => {
+            return {
+              'time': m,
+              'Value': Math.floor(Math.random() * 1000) + 200
+            }
+          }),
           campaign: campaignData,
           location: locationData,
           stackData: StackData
@@ -206,8 +295,138 @@
 
       }
     },
+    /*
+    * */
     methods: {
       submit: function () {
+        this.vv = 20
+        //这里变不了我就很迷了
+        this.dataset.monthVisit = [{'time': 1, 'Value': 200}]
+        this.filter = this.filter.trim()
+        this.searchByIp(this.filter)
+      },
+      setRandomValue: function (data) {
+        for (let i in data) {
+          data[i]['value'] = Math.floor(Math.random() * 1000) + 200
+        }
+        return data
+      },
+      searchByIp: function (filter) {
+        //TODO 到时候记得把filter塞进来
+        let url = '/metrics/ipAddr/?ip' + '=127.0.0.1' + '&group=dubbo'
+        this.$axios.get(url)
+          .then(response => {
+            if (!response.data) {
+              return
+            }
+            this.dealNormal(response.data)
+            this.dealMajor(response.data)
+            this.dealThreadPoolData(response.data)
+          })
+      },
+      dealThreadPoolData: function (data) {
+        for (let index in data) {
+          let metricsDTO = data[index]
+          if ((metricsDTO['metric']).indexOf('threadPool') >= -1) {
+            let metric = metricsDTO['metric'].substring(metricsDTO['metric'].lastIndexOf('.') + 1)
+            if (metric === 'active' || metric === 'current') {
+              let trending = metric + '_trending'
+              this.threadPoolData[trending] = this.dealTrending(this.threadPoolData[metric], metricsDTO['value'])
+            }
+            this.threadPoolData[metric] = metricsDTO['value']
+          }
+        }
+        this.threadPoolData.activert = (100 * this.threadPoolData.active / this.threadPoolData.current).toFixed(2)
+      },
+      dealMajor: function (data) {
+        for (let index in data) {
+          let metricsDTO = data[index]
+          if (metricsDTO['metricLevel'] === 'MAJOR' && (metricsDTO['metric']).indexOf('threadPool') === -1) {
+            let metric = metricsDTO['metric'] + ''
+            let provider = metric.split('.')[1]
+            metric = metric.substring(metric.lastIndexOf('.') + 1)
+            this.dealEchartData(metricsDTO, provider, metric)
+            if (typeof metricsDTO.value !== 'string') {
+              metricsDTO.value = metricsDTO.value.toFixed(2)
+            }
+            if (this.majorDataMap[provider][metric]) {
+              let trending = metric + '_trending'
+              this.majorDataMap[provider][trending] = this.dealTrending(this.majorDataMap[provider][metric], metricsDTO.value)
+              this.majorDataMap[provider][metric] = metricsDTO.value
+            }
+          }
+        }
+      },
+      dealEchartData: function (metricsDTO, provider, metric) {
+        //这一块
+        let timestamp = metricsDTO['timestamp']
+        let arr = this.echartMap[provider]
+        let lastTime = arr[arr.length - 1]['timestamp']
+        if (timestamp > lastTime) {
+          arr.push({
+            'timestamp': timestamp,
+            metric: metricsDTO['value']
+          })
+          if (arr.length > 10) {
+            arr.shift()
+          }
+        } else {
+          arr[arr.length - 1][metric] = metricsDTO['value']
+        }
+      },
+      dealNormal: function (data) {
+        let serviceMethodMap = {}
+        for (let index in data) {
+          let metricsDTO = data[index]
+          if (metricsDTO['metricLevel'] === 'NORMAL') {
+            let metric = metricsDTO['metric'] + ''
+            let isProvider = metric.split('.')[1]
+            metric = isProvider + '.' + metric.substring(metric.lastIndexOf('.') + 1)
+
+            let methodMap = serviceMethodMap[metricsDTO.tags.service]
+            if (!methodMap) {
+              methodMap = {}
+              serviceMethodMap[metricsDTO.tags.service] = methodMap
+            }
+            let metricMap = methodMap[metricsDTO.tags.method]
+
+            if (!metricMap) {
+              metricMap = {}
+              serviceMethodMap[metricsDTO.tags.service][metricsDTO.tags.method] = metricMap
+            }
+            metricMap[metric] = metricsDTO['value']
+          }
+        }
+        this.providerDetails = []
+        this.consumerDetails = []
+        for (let service in serviceMethodMap) {
+          for (let method in serviceMethodMap[service]) {
+            let metricsMap = serviceMethodMap[service][method]
+            this.addDataToDetails(this.providerDetails, service, method, metricsMap, 'provider')
+            this.addDataToDetails(this.consumerDetails, service, method, metricsMap, 'consumer')
+          }
+        }
+      },
+      addDataToDetails: function (sideDetails, service, method, metricsMap, side) {
+        if (metricsMap[side + '.qps'] && metricsMap[side + '.success_rate'] && metricsMap[side + '.success_bucket_count']) {
+          sideDetails.push({
+            service: service,
+            method: method,
+            qps: metricsMap[side + '.qps'].toFixed(2),
+            rt: metricsMap[side + '.rt'].toFixed(2),
+            successRate: metricsMap[side + '.success_rate'],
+            successCount: metricsMap[side + '.success_bucket_count']
+          })
+        }
+      },
+      dealTrending: function (oldValue, curValue) {
+        if (curValue > oldValue) {
+          return 'trending_up'
+        }
+        if (curValue < oldValue) {
+          return 'trending_down'
+        }
+        return ''
       },
       setHeaders: function () {
         this.headers = [
@@ -236,6 +455,9 @@
     },
     mounted: function () {
       this.setHeaders()
+      setInterval(() => {
+        this.submit()
+      }, 5000)
     }
   }
 </script>
diff --git a/dubbo-admin-ui/src/components/public/MiniChart.vue b/dubbo-admin-ui/src/components/public/MiniChart.vue
index bc087e9..cc51877 100644
--- a/dubbo-admin-ui/src/components/public/MiniChart.vue
+++ b/dubbo-admin-ui/src/components/public/MiniChart.vue
@@ -18,11 +18,11 @@
 <template>
       <div class="layout row ma-0 align-center justify-space-between">
         <div class="text-box">
-          <div class="subheading pb-2">{{title}}</div>
+          <div class="subheading pb-2">{{title}} </div>
           <span class="grey--text">{{subTitle}} <v-icon small :color="iconColor">{{icon}}</v-icon></span>
         </div>
         <div class="chart">
-          <e-chart
+          <e-chart id="hello"
             :path-option="computeChartOption"
             height="68px"
             width="100%"
@@ -76,8 +76,13 @@
         }
         return this.defaultOption
       }
-    }
+    },
 
+    watch: {
+      data (curVal, oldVal) {
+        return this.defaultOption
+      }
+    }
   }
 </script>
 
diff --git a/dubbo-admin-ui/src/util/echart.js b/dubbo-admin-ui/src/util/echart.js
index 3660f21..cf2bed3 100644
--- a/dubbo-admin-ui/src/util/echart.js
+++ b/dubbo-admin-ui/src/util/echart.js
@@ -206,9 +206,14 @@
     }
   },
   mounted () {
+    // console.log(this)
     this.init()
   },
-
+  watch: {
+    option (cur, old) {
+      // console.log("echart", cur, old)
+    }
+  },
   beforeDestroy () {
     this.clean()
   }
diff --git a/pom.xml b/pom.xml
index e153dc7..c1add06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,7 +56,7 @@
 	<properties>
 		<main.basedir>${project.basedir}</main.basedir>
         <commons-lang3-version>3.7</commons-lang3-version>
-		<dubbo-version>2.7.0</dubbo-version>
+		<dubbo-version>2.7.2-SNAPSHOT</dubbo-version>
 		<curator-version>2.12.0</curator-version>
 		<curator-test-version>4.1.0</curator-test-version>
 		<fastjson-version>1.2.46</fastjson-version>