You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/01/31 08:54:58 UTC

[GitHub] WillemJiang closed pull request #536: [SCB-147] Delete old metrics of version 0.5.0 in foundation-metrics

WillemJiang closed pull request #536: [SCB-147] Delete old metrics of version 0.5.0 in foundation-metrics
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/536
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
index 36c173938..1ce358d74 100644
--- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
+++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
@@ -41,9 +41,6 @@
 import org.apache.servicecomb.core.metrics.InvocationStartedEvent;
 import org.apache.servicecomb.foundation.common.utils.EventUtils;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
-import org.apache.servicecomb.foundation.metrics.MetricsServoRegistry;
-import org.apache.servicecomb.foundation.metrics.performance.QueueMetrics;
-import org.apache.servicecomb.foundation.metrics.performance.QueueMetricsData;
 import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx;
 import org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx;
 import org.apache.servicecomb.foundation.vertx.stream.BufferOutputStream;
@@ -113,8 +110,6 @@ protected void scheduleInvocation() {
         InvocationType.PRODUCER, System.nanoTime());
     EventUtils.triggerEvent(startedEvent);
 
-    QueueMetrics metricsData = initMetrics(operationMeta);
-
     operationMeta.getExecutor().execute(() -> {
       synchronized (this.requestEx) {
         try {
@@ -127,7 +122,7 @@ protected void scheduleInvocation() {
             return;
           }
 
-          runOnExecutor(metricsData, startedEvent);
+          runOnExecutor(startedEvent);
         } catch (Throwable e) {
           LOGGER.error("rest server onRequest error", e);
           sendFailResponse(e);
@@ -136,13 +131,10 @@ protected void scheduleInvocation() {
     });
   }
 
-  protected void runOnExecutor(QueueMetrics metricsData, InvocationStartedEvent startedEvent) {
+  protected void runOnExecutor(InvocationStartedEvent startedEvent) {
     Object[] args = RestCodec.restToArgs(requestEx, restOperationMeta);
     createInvocation(args);
 
-    this.invocation.setMetricsData(metricsData);
-    updateMetrics();
-
     //???????????Finished?????TotalTime
     invocation.setStartTime(startedEvent.getStartedTime());
     invocation.triggerStartProcessingEvent();
@@ -190,7 +182,6 @@ protected void doInvoke() throws Throwable {
       sendResponseQuietly(resp);
 
       invocation.triggerFinishedEvent(resp.getStatusCode(), resp.isSuccessed());
-      endMetrics();
     });
   }
 
@@ -245,52 +236,4 @@ protected void sendResponse(Response response) throws Exception {
       responseEx.flushBuffer();
     }
   }
-
-  /**
-   * Init the metrics. Note down the queue count and start time.
-   * @param operationMeta Operation data
-   * @return QueueMetrics
-   */
-  private QueueMetrics initMetrics(OperationMeta operationMeta) {
-    QueueMetrics metricsData = new QueueMetrics();
-    metricsData.setQueueStartTime(System.currentTimeMillis());
-    metricsData.setOperQualifiedName(operationMeta.getMicroserviceQualifiedName());
-    QueueMetricsData reqQueue = MetricsServoRegistry.getOrCreateLocalMetrics()
-        .getOrCreateQueueMetrics(operationMeta.getMicroserviceQualifiedName());
-    reqQueue.incrementCountInQueue();
-    return metricsData;
-  }
-
-  /**
-   * Update the queue metrics.
-   */
-  private void updateMetrics() {
-    QueueMetrics metricsData = (QueueMetrics) this.invocation.getMetricsData();
-    if (null != metricsData) {
-      metricsData.setQueueEndTime(System.currentTimeMillis());
-      QueueMetricsData reqQueue = MetricsServoRegistry.getOrCreateLocalMetrics()
-          .getOrCreateQueueMetrics(restOperationMeta.getOperationMeta().getMicroserviceQualifiedName());
-      reqQueue.incrementTotalCount();
-      Long timeInQueue = metricsData.getQueueEndTime() - metricsData.getQueueStartTime();
-      reqQueue.setTotalTime(reqQueue.getTotalTime() + timeInQueue);
-      reqQueue.setMinLifeTimeInQueue(timeInQueue);
-      reqQueue.setMaxLifeTimeInQueue(timeInQueue);
-      reqQueue.decrementCountInQueue();
-    }
-  }
-
-  /**
-   * Prepare the end time of queue metrics.
-   */
-  private void endMetrics() {
-    QueueMetrics metricsData = (QueueMetrics) this.invocation.getMetricsData();
-    if (null != metricsData) {
-      metricsData.setEndOperTime(System.currentTimeMillis());
-      QueueMetricsData reqQueue = MetricsServoRegistry.getOrCreateLocalMetrics()
-          .getOrCreateQueueMetrics(restOperationMeta.getOperationMeta().getMicroserviceQualifiedName());
-      reqQueue.incrementTotalServExecutionCount();
-      reqQueue.setTotalServExecutionTime(
-          reqQueue.getTotalServExecutionTime() + (metricsData.getEndOperTime() - metricsData.getQueueEndTime()));
-    }
-  }
 }
diff --git a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
index 658640331..4ff47c3d5 100644
--- a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
+++ b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/TestAbstractRestInvocation.java
@@ -44,7 +44,6 @@
 import org.apache.servicecomb.core.metrics.InvocationStartedEvent;
 import org.apache.servicecomb.core.provider.consumer.ReferenceConfig;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
-import org.apache.servicecomb.foundation.metrics.performance.QueueMetrics;
 import org.apache.servicecomb.foundation.vertx.http.AbstractHttpServletRequest;
 import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx;
 import org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx;
@@ -229,7 +228,7 @@ public void invokeFilterHaveResponse(@Mocked HttpServerFilter filter) {
     Holder<Response> result = new Holder<>();
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void doInvoke() throws Throwable {
+      protected void doInvoke() {
         result.value = Response.ok("not run to here");
       }
 
@@ -258,7 +257,7 @@ public void invokeFilterNoResponse(@Mocked HttpServerFilter filter) {
     Holder<Boolean> result = new Holder<>();
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void doInvoke() throws Throwable {
+      protected void doInvoke() {
         result.value = true;
       }
     };
@@ -288,7 +287,7 @@ public void sendFailResponse(Throwable throwable) {
       }
 
       @Override
-      protected void doInvoke() throws Throwable {
+      protected void doInvoke() {
 
       }
     };
@@ -311,7 +310,7 @@ public void invokeNormal(@Mocked HttpServerFilter filter) {
 
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void doInvoke() throws Throwable {
+      protected void doInvoke() {
       }
 
       @Override
@@ -338,7 +337,7 @@ public void sendFailResponseHaveProduceProcessor() {
     Holder<Response> result = new Holder<>();
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void doInvoke() throws Throwable {
+      protected void doInvoke() {
       }
 
       @Override
@@ -360,11 +359,11 @@ public void sendResponseQuietlyNormal(@Mocked Response response) {
     Holder<Response> result = new Holder<>();
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void doInvoke() throws Throwable {
+      protected void doInvoke() {
       }
 
       @Override
-      protected void sendResponse(Response response) throws Exception {
+      protected void sendResponse(Response response) {
         result.value = response;
       }
     };
@@ -379,11 +378,11 @@ protected void sendResponse(Response response) throws Exception {
   public void sendResponseQuietlyException(@Mocked Response response) {
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void doInvoke() throws Throwable {
+      protected void doInvoke() {
       }
 
       @Override
-      protected void sendResponse(Response response) throws Exception {
+      protected void sendResponse(Response response) {
         throw new Error("");
       }
     };
@@ -623,7 +622,7 @@ public void scheduleInvocationException(@Mocked OperationMeta operationMeta) {
     Error error = new Error("run on executor");
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void runOnExecutor(QueueMetrics metricsData, InvocationStartedEvent startedEvent) {
+      protected void runOnExecutor(InvocationStartedEvent startedEvent) {
         throw error;
       }
 
@@ -660,7 +659,7 @@ public void scheduleInvocationTimeout(@Mocked OperationMeta operationMeta) {
 
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void runOnExecutor(QueueMetrics metricsData, InvocationStartedEvent startedEvent) {
+      protected void runOnExecutor(InvocationStartedEvent startedEvent) {
         throw new Error("run on executor");
       }
 
@@ -696,7 +695,7 @@ public void scheduleInvocationNormal(@Mocked OperationMeta operationMeta) {
     Holder<Boolean> result = new Holder<>();
     restInvocation = new AbstractRestInvocationForTest() {
       @Override
-      protected void runOnExecutor(QueueMetrics metricsData, InvocationStartedEvent startedEvent) {
+      protected void runOnExecutor(InvocationStartedEvent startedEvent) {
         result.value = true;
       }
     };
@@ -727,7 +726,7 @@ public void invoke() {
     restInvocation.requestEx = requestEx;
     restInvocation.restOperationMeta = restOperation;
 
-    restInvocation.runOnExecutor(null, new InvocationStartedEvent("", InvocationType.PRODUCER, System.nanoTime()));
+    restInvocation.runOnExecutor(new InvocationStartedEvent("", InvocationType.PRODUCER, System.nanoTime()));
     Assert.assertTrue(result.value);
     Assert.assertSame(invocation, restInvocation.invocation);
   }
@@ -738,7 +737,7 @@ public void doInvoke(@Mocked Endpoint endpoint, @Mocked OperationMeta operationM
     Response response = Response.ok("ok");
     Handler handler = new Handler() {
       @Override
-      public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
+      public void handle(Invocation invocation, AsyncResponse asyncResp) {
         asyncResp.complete(response);
       }
     };
diff --git a/core/src/main/java/org/apache/servicecomb/core/Invocation.java b/core/src/main/java/org/apache/servicecomb/core/Invocation.java
index 81f25f83d..96a84b901 100644
--- a/core/src/main/java/org/apache/servicecomb/core/Invocation.java
+++ b/core/src/main/java/org/apache/servicecomb/core/Invocation.java
@@ -53,17 +53,6 @@
 
   private int handlerIndex;
 
-  //start,end of queue and operation time after queue for operation level metrics.
-  private Object metricsData;
-
-  public Object getMetricsData() {
-    return metricsData;
-  }
-
-  public void setMetricsData(Object metricsData) {
-    this.metricsData = metricsData;
-  }
-
 
   // ??????
   // ??????????????????????????
diff --git a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
index 08eec9beb..71f885f32 100644
--- a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
+++ b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
@@ -89,35 +89,6 @@ public static void run() {
       testController();
     }
 
-    //0.5.0 version metrics integration test
-    try {
-      // this test class is intended for retry hanging issue JAV-127
-      String content = restTemplate.getForObject("cse://springmvc/codeFirstSpringmvc/metricsForTest", String.class);
-      @SuppressWarnings("unchecked")
-      Map<String, String> resultMap = JsonUtils.OBJ_MAPPER.readValue(content, HashMap.class);
-
-      TestMgr.check(true, resultMap.get("CPU and Memory").contains("heapUsed="));
-
-      String[] requestProviders = resultMap.get("totalRequestProvider OPERATIONAL_LEVEL")
-          .replace("{", "")
-          .replace("}", "")
-          .split(",");
-      Map<String, Integer> requests = new HashMap<>();
-      for (String requestProvider : requestProviders) {
-        String[] requestKeyAndValues = requestProvider.split("=");
-        requests.put(requestKeyAndValues[0], Integer.parseInt(requestKeyAndValues[1]));
-      }
-
-      for (Entry<String, Integer> request : requests.entrySet()) {
-        TestMgr.check(true, request.getValue() > 0);
-      }
-
-      TestMgr.check(true, resultMap.get("RequestQueueRelated").contains("springmvc.codeFirst.saySomething"));
-      TestMgr.check(true, resultMap.get("RequestQueueRelated").contains("springmvc.controller.sayHi"));
-    } catch (Exception e) {
-      TestMgr.check("true", "false");
-    }
-
     //0.5.0 later version metrics integration test
     try {
       RegistryMetric metric = metricsPublisher.metrics();
diff --git a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java
index 1251f61ec..103e37e76 100644
--- a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java
+++ b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java
@@ -20,7 +20,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -39,8 +38,6 @@
 import org.apache.servicecomb.demo.ignore.InputModelForTestIgnore;
 import org.apache.servicecomb.demo.ignore.OutputModelForTestIgnore;
 import org.apache.servicecomb.demo.server.User;
-import org.apache.servicecomb.foundation.common.utils.JsonUtils;
-import org.apache.servicecomb.foundation.metrics.MetricsServoRegistry;
 import org.apache.servicecomb.provider.rest.common.RestSchema;
 import org.apache.servicecomb.swagger.extend.annotations.RawJsonRequestBody;
 import org.apache.servicecomb.swagger.extend.annotations.ResponseHeaders;
@@ -49,7 +46,6 @@
 import org.apache.servicecomb.swagger.invocation.context.InvocationContext;
 import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
 import org.apache.servicecomb.swagger.invocation.response.Headers;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -72,9 +68,6 @@
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.netflix.servo.monitor.Monitor;
-
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
@@ -87,20 +80,12 @@
 @RequestMapping(path = "/codeFirstSpringmvc", produces = MediaType.APPLICATION_JSON_VALUE)
 public class CodeFirstSpringmvc {
 
-  private MetricsServoRegistry registry;
-
-  @Autowired
-  public CodeFirstSpringmvc(MetricsServoRegistry registry) {
-    this.registry = registry;
-  }
-
-
   private String _fileUpload(MultipartFile file1, Part file2) {
     try (InputStream is1 = file1.getInputStream(); InputStream is2 = file2.getInputStream()) {
       String content1 = IOUtils.toString(is1);
       String content2 = IOUtils.toString(is2);
       return String.format("%s:%s:%s\n"
-          + "%s:%s:%s",
+              + "%s:%s:%s",
           file1.getOriginalFilename(),
           file1.getContentType(),
           content1,
@@ -135,7 +120,7 @@ public String fileUpload(@RequestPart(name = "file1") MultipartFile file1,
     InvocationContext c2 = ContextUtils.getInvocationContext();
     headers.add("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE).toString());
 
-    return new ResponseEntity<Date>(date, headers, HttpStatus.ACCEPTED);
+    return new ResponseEntity<>(date, headers, HttpStatus.ACCEPTED);
   }
 
   @ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
@@ -148,7 +133,7 @@ public String fileUpload(@RequestPart(name = "file1") MultipartFile file1,
     InvocationContext c2 = ContextUtils.getInvocationContext();
     headers.add("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE).toString());
 
-    return new ResponseEntity<Date>(date, headers, HttpStatus.ACCEPTED);
+    return new ResponseEntity<>(date, headers, HttpStatus.ACCEPTED);
   }
 
   @ApiResponse(code = 200, response = User.class, message = "")
@@ -313,7 +298,7 @@ public OutputModelForTestIgnore testModelWithIgnoreField(@RequestBody InputModel
     return new OutputModelForTestIgnore("output_id", input.getInputId(), input.getContent(), input.getInputObject(),
         input.getInputJsonObject(), input.getInputIgnoreInterface(),
         new Person("outputSomeone"), new JsonObject("{\"OutputJsonKey\" : \"OutputJsonValue\"}"), () -> {
-        });
+    });
   }
 
   @SuppressWarnings("unchecked")
@@ -343,21 +328,6 @@ public String testform(HttpServletRequest request) {
     return form1 + form2;
   }
 
-  //Only for 0.5.0 Integration Test
-  @RequestMapping(path = "/metricsForTest", method = RequestMethod.GET)
-  public String metricsForTest() {
-    List<Monitor<?>> monitors = registry.getMetricsMonitors();
-    Map<String, String> values = new HashMap<>();
-    for (Monitor<?> monitor : monitors) {
-      values.put(monitor.getConfig().getName(), monitor.getValue().toString());
-    }
-    try {
-      return JsonUtils.writeValueAsString(values);
-    } catch (JsonProcessingException e) {
-      throw new InvocationException(500, "500", "JsonProcessingException", e);
-    }
-  }
-
   //Only for Prometheus integration test
   @RequestMapping(path = "/prometheusForTest", method = RequestMethod.GET)
   public String prometheusForTest() {
diff --git a/foundations/foundation-metrics/pom.xml b/foundations/foundation-metrics/pom.xml
index bd689861a..08dfcb4a6 100644
--- a/foundations/foundation-metrics/pom.xml
+++ b/foundations/foundation-metrics/pom.xml
@@ -31,14 +31,6 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-common</artifactId>
     </dependency>
-    <dependency>
-      <groupId>com.netflix.servo</groupId>
-      <artifactId>servo-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.netflix.hystrix</groupId>
-      <artifactId>hystrix-core</artifactId>
-    </dependency>
     <dependency>
       <groupId>com.netflix.archaius</groupId>
       <artifactId>archaius-core</artifactId>
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsServoRegistry.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsServoRegistry.java
deleted file mode 100644
index 49b40c582..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsServoRegistry.java
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryUsage;
-import java.lang.management.OperatingSystemMXBean;
-import java.lang.management.ThreadMXBean;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-
-import org.apache.servicecomb.foundation.metrics.performance.MetricsDataMonitor;
-import org.apache.servicecomb.foundation.metrics.performance.QueueMetricsData;
-import org.springframework.beans.factory.InitializingBean;
-
-import com.netflix.config.DynamicPropertyFactory;
-import com.netflix.hystrix.HystrixCommandMetrics;
-import com.netflix.hystrix.HystrixEventType;
-import com.netflix.servo.DefaultMonitorRegistry;
-import com.netflix.servo.annotations.DataSourceType;
-import com.netflix.servo.monitor.AbstractMonitor;
-import com.netflix.servo.monitor.BasicCompositeMonitor;
-import com.netflix.servo.monitor.Gauge;
-import com.netflix.servo.monitor.Informational;
-import com.netflix.servo.monitor.Monitor;
-import com.netflix.servo.monitor.MonitorConfig;
-
-import rx.functions.Func0;
-
-/**
- * Implementation of metrics preparation and servo registry.
- */
-public class MetricsServoRegistry implements InitializingBean {
-
-  public static final String METRICS_ROUND_PLACES = "servicecomb.metrics.round_places";
-
-  protected static ThreadLocal<MetricsDataMonitor> LOCAL_METRICS_MAP = new ThreadLocal<>();
-
-  private MetricsDataMonitor localMetrics = new MetricsDataMonitor();
-
-  protected static Vector<MetricsDataMonitor> metricsList = new Vector<>();
-
-  private final int doubleRoundPlaces;
-
-  private final String doubleStringFormatter;
-
-  public MetricsServoRegistry() {
-    doubleRoundPlaces = DynamicPropertyFactory.getInstance().getIntProperty(METRICS_ROUND_PLACES, 1).get();
-    doubleStringFormatter = "%." + String.valueOf(doubleRoundPlaces) + "f";
-  }
-
-  /*
-   * Added getter for unit test of local metrics.
-   *
-   * @return Local metric reference
-   */
-  public MetricsDataMonitor getLocalMetrics() {
-    return localMetrics;
-  }
-
-
-  /**
-   * Get or create local metrics.
-   * @return MetricsDataMonitor
-   */
-  public static MetricsDataMonitor getOrCreateLocalMetrics() {
-    MetricsDataMonitor metricsDataMonitor = LOCAL_METRICS_MAP.get();
-    if (metricsDataMonitor == null) {
-      metricsDataMonitor = new MetricsDataMonitor();
-      LOCAL_METRICS_MAP.set(metricsDataMonitor);
-      metricsList.add(metricsDataMonitor);
-    }
-    return metricsDataMonitor;
-  }
-
-  /**
-   * Get the initial metrics and register with servo.
-   */
-  public void initMetricsPublishing() {
-    /* list of monitors */
-    List<Monitor<?>> monitors = getMetricsMonitors();
-    MonitorConfig commandMetricsConfig = MonitorConfig.builder("metrics").build();
-    BasicCompositeMonitor commandMetricsMonitor = new BasicCompositeMonitor(commandMetricsConfig, monitors);
-    DefaultMonitorRegistry.getInstance().register(commandMetricsMonitor);
-  }
-
-  @Override
-  public void afterPropertiesSet() throws Exception {
-    initMetricsPublishing();
-  }
-
-  /**
-   * Get instance level total requests by comparing the last saved data.
-   */
-  protected final Func0<Number> getTotalReqProvider = new Func0<Number>() {
-    @Override
-    public Number call() {
-      Long totalReqProvider = 0L;
-      for (MetricsDataMonitor metricsDataMonitor : metricsList) {
-        totalReqProvider += metricsDataMonitor.getTotalReqProvider();
-      }
-      Long metricValue = totalReqProvider - localMetrics.getTotalReqProvider();
-      localMetrics.setTotalReqProvider(totalReqProvider);
-      return metricValue;
-    }
-  };
-
-  /**
-   * Get instance level total failed requests by comparing the last saved data.
-   */
-  protected final Func0<Number> getTotalFailedReqProvider = new Func0<Number>() {
-    @Override
-    public Number call() {
-      Long totalFailedReqProvider = 0L;
-      for (MetricsDataMonitor metricsDataMonitor : metricsList) {
-        totalFailedReqProvider += metricsDataMonitor.getTotalFailReqProvider();
-      }
-      Long metricValue = totalFailedReqProvider - localMetrics.getTotalFailReqProvider();
-      localMetrics.setTotalFailReqProvider(totalFailedReqProvider);
-      return metricValue;
-    }
-  };
-
-  /**
-   * Get instance level total failed requests by comparing the last saved data.
-   */
-  protected final Func0<Number> getTotalReqConsumer = new Func0<Number>() {
-    @Override
-    public Number call() {
-      Long totalReqConsumer = 0L;
-      for (MetricsDataMonitor metricsDataMonitor : metricsList) {
-        totalReqConsumer += metricsDataMonitor.getTotalReqConsumer();
-      }
-      Long metricValue = totalReqConsumer - localMetrics.getTotalReqConsumer();
-      localMetrics.setTotalReqConsumer(totalReqConsumer);
-      return metricValue;
-    }
-  };
-
-  /**
-   * Get instance level total failed requests by comparing the last saved data.
-   */
-  protected final Func0<Number> getFailedTotalReqConsumer = new Func0<Number>() {
-    @Override
-    public Number call() {
-      Long totalFailedReqConsumer = 0L;
-      for (MetricsDataMonitor metricsDataMonitor : metricsList) {
-        totalFailedReqConsumer += metricsDataMonitor.getTotalFailReqConsumer();
-      }
-      Long metricValue = totalFailedReqConsumer - localMetrics.getTotalFailReqConsumer();
-      localMetrics.setTotalFailReqConsumer(totalFailedReqConsumer);
-      return metricValue;
-    }
-  };
-
-  /**
-   * Get operational level total request and total failed requests by comparing the
-   * last saved data.
-   */
-  protected final Func0<String> getTotalReqProdOperLevel = new Func0<String>() {
-    @Override
-    public String call() {
-      Map<String, Long> totalMap = new HashMap<>();
-      Map<String, Long> oldMap = localMetrics.operMetricsTotalReq;
-      Map<String, Long> metricMap = new HashMap<>();
-      for (MetricsDataMonitor metricsDataMonitor : metricsList) {
-        Collection<String> keySet = metricsDataMonitor.operMetricsTotalReq.keySet();
-        for (String key : keySet) {
-          totalMap.merge(key, metricsDataMonitor.getOperMetTotalReq(key), (a, b) -> b + a);
-        }
-      }
-      Collection<String> keySet = totalMap.keySet();
-      for (String key : keySet) {
-        if (oldMap.containsKey(key)) {
-          metricMap.put(key, totalMap.get(key) - oldMap.get(key));
-        } else {
-          metricMap.put(key, totalMap.get(key));
-        }
-      }
-      localMetrics.operMetricsTotalReq.putAll(totalMap);
-      return metricMap.toString();
-    }
-  };
-
-  /**
-   * Get operational level total request and total failed requets by comparing the
-   * last saved data.
-   */
-  protected final Func0<String> getTotalReqFailProdOperLevel = new Func0<String>() {
-    @Override
-    public String call() {
-      Map<String, Long> totalMap = new HashMap<>();
-      Map<String, Long> oldMap = localMetrics.operMetricsTotalFailReq;
-      Map<String, Long> metricMap = new HashMap<>();
-      for (MetricsDataMonitor metricsDataMonitor : metricsList) {
-        Collection<String> keySet = metricsDataMonitor.operMetricsTotalFailReq.keySet();
-        for (String key : keySet) {
-          totalMap.merge(key, metricsDataMonitor.getOperMetTotalFailReq(key), (a, b) -> b + a);
-        }
-      }
-      Collection<String> keySet = totalMap.keySet();
-      for (String key : keySet) {
-        if (oldMap.containsKey(key)) {
-          metricMap.put(key, totalMap.get(key) - oldMap.get(key));
-        } else {
-          metricMap.put(key, totalMap.get(key));
-        }
-      }
-      localMetrics.operMetricsTotalFailReq.putAll(totalMap);
-      return metricMap.toString();
-    }
-  };
-
-  /**
-   * Get operational level/instance level queue related metrics by comparing the
-   * last saved data.
-   */
-  protected final Func0<String> getQueueMetrics = new Func0<String>() {
-    @Override
-    public String call() {
-      Map<String, QueueMetricsData> totalMap = new HashMap<>();
-
-      for (MetricsDataMonitor metricsDataMonitor : metricsList) {
-        Collection<String> keySet = metricsDataMonitor.getQueueMetrics().keySet();
-        for (String key : keySet) {
-          QueueMetricsData value = totalMap.get(key);
-          if (null == value) {
-            totalMap.put(key, metricsDataMonitor.getQueueMetrics().get(key));
-          } else {
-            QueueMetricsData newValue = metricsDataMonitor.getQueueMetrics().get(key);
-            QueueMetricsData totalValue = new QueueMetricsData();
-            totalValue.setCountInQueue(newValue.getCountInQueue() + value.getCountInQueue());
-            totalValue.setTotalTime(newValue.getTotalTime() + value.getTotalTime());
-            totalValue.setTotalCount(newValue.getTotalCount() + value.getTotalCount());
-            totalValue
-                .setTotalServExecutionTime(newValue.getTotalServExecutionTime() + value.getTotalServExecutionTime());
-            totalValue
-                .setTotalServExecutionCount(newValue.getTotalServExecutionCount() + value.getTotalServExecutionCount());
-            if ((value.getMinLifeTimeInQueue() <= 0)
-                || (newValue.getMinLifeTimeInQueue() < value.getMinLifeTimeInQueue())) {
-              totalValue.setMinLifeTimeInQueue(newValue.getMinLifeTimeInQueue());
-            }
-            newValue.resetMinLifeTimeInQueue();
-            if ((value.getMaxLifeTimeInQueue() <= 0)
-                || (newValue.getMaxLifeTimeInQueue() > value.getMaxLifeTimeInQueue())) {
-              totalValue.setMaxLifeTimeInQueue(newValue.getMaxLifeTimeInQueue());
-            }
-            newValue.resetMaxLifeTimeInQueue();
-            totalMap.put(key, totalValue);
-          }
-        }
-      }
-
-      Map<String, QueueMetricsData> oldMap = localMetrics.getQueueMetrics();
-      Map<String, QueueMetricsData> metricMap = new HashMap<>();
-      Map<String, String> result = new HashMap<>();
-      Map<String, String> resultInstancePublishMap = new HashMap<>();
-
-      QueueMetricsData totalValueInstance = new QueueMetricsData();
-
-      Collection<String> keySet = totalMap.keySet();
-      Map<String, String> resultMap;
-
-      for (String key : keySet) {
-        resultMap = new HashMap<>();
-        if (oldMap.containsKey(key)) {
-          QueueMetricsData newValue = new QueueMetricsData();
-          QueueMetricsData totalValue = totalMap.get(key);
-          QueueMetricsData oldValue = oldMap.get(key);
-          newValue.setCountInQueue(totalValue.getCountInQueue());
-          newValue.setTotalTime(totalValue.getTotalTime() - oldValue.getTotalTime());
-          newValue.setTotalCount(totalValue.getTotalCount() - oldValue.getTotalCount());
-          newValue
-              .setTotalServExecutionTime(totalValue.getTotalServExecutionTime() - oldValue.getTotalServExecutionTime());
-          newValue.setTotalServExecutionCount(
-              totalValue.getTotalServExecutionCount() - oldValue.getTotalServExecutionCount());
-          newValue.setMinLifeTimeInQueue(totalValue.getMinLifeTimeInQueue());
-          newValue.setMaxLifeTimeInQueue(totalValue.getMaxLifeTimeInQueue());
-          metricMap.put(key, newValue);
-        } else {
-          metricMap.put(key, totalMap.get(key));
-        }
-
-        resultMap.put("countInQueue", metricMap.get(key).getCountInQueue().toString());
-
-        long count = metricMap.get(key).getTotalCount();
-        double avgTimeInQueue = 0;
-        if (count > 0) {
-          avgTimeInQueue = (double) metricMap.get(key).getTotalTime() / (double) count;
-        }
-        resultMap.put("AverageTimeInQueue", String.valueOf(avgTimeInQueue));
-        long countService = metricMap.get(key).getTotalServExecutionCount();
-        double avgServiceTimeInQueue = 0;
-        if (countService > 0) {
-          avgServiceTimeInQueue = (double) metricMap.get(key).getTotalServExecutionTime() / (double) countService;
-        }
-        resultMap.put("AverageServiceExecutionTime", String.valueOf(avgServiceTimeInQueue));
-        resultMap.put("MinLifeTimeInQueue", metricMap.get(key).getMinLifeTimeInQueue().toString());
-        resultMap.put("MaxLifeTimeInQueue", metricMap.get(key).getMaxLifeTimeInQueue().toString());
-
-        result.put(key, resultMap.toString());
-
-        //get the all values for instance level.
-        totalValueInstance.setCountInQueue(metricMap.get(key).getCountInQueue());
-        totalValueInstance.setTotalTime(totalValueInstance.getTotalTime() + metricMap.get(key).getTotalTime());
-        totalValueInstance.setTotalCount(totalValueInstance.getTotalCount() + metricMap.get(key).getTotalCount());
-        totalValueInstance
-            .setTotalServExecutionTime(
-                totalValueInstance.getTotalServExecutionTime() + metricMap.get(key).getTotalServExecutionTime());
-        totalValueInstance
-            .setTotalServExecutionCount(
-                totalValueInstance.getTotalServExecutionCount() + metricMap.get(key).getTotalServExecutionCount());
-
-        if (totalValueInstance.getMinLifeTimeInQueue() <= 0
-            || metricMap.get(key).getMinLifeTimeInQueue() < totalValueInstance.getMinLifeTimeInQueue()) {
-          totalValueInstance.setMinLifeTimeInQueue(metricMap.get(key).getMinLifeTimeInQueue());
-        }
-        if (totalValueInstance.getMaxLifeTimeInQueue() <= 0
-            || totalMap.get(key).getMaxLifeTimeInQueue() > totalValueInstance.getMaxLifeTimeInQueue()) {
-          totalValueInstance.setMaxLifeTimeInQueue(metricMap.get(key).getMaxLifeTimeInQueue());
-        }
-
-        localMetrics.setQueueMetrics(new ConcurrentHashMap<>(totalMap));
-      }
-
-      //prepare the result map for instance level.
-      resultInstancePublishMap.put("countInQueue", totalValueInstance.getCountInQueue().toString());
-      long countInst = totalValueInstance.getTotalCount();
-      double avgTimeInQueueIns = 0;
-      if (countInst > 0) {
-        avgTimeInQueueIns = (double) totalValueInstance.getTotalTime() / (double) countInst;
-      }
-      resultInstancePublishMap.put("averageTimeInQueue",
-          String.format(
-              doubleStringFormatter,
-              round(avgTimeInQueueIns, doubleRoundPlaces)));
-      long countServiceInst = totalValueInstance.getTotalServExecutionCount();
-      double avgServiceTimeInQueueInst = 0;
-      if (countServiceInst > 0) {
-        avgServiceTimeInQueueInst = (double) totalValueInstance.getTotalServExecutionTime() / (double) countServiceInst;
-      }
-      resultInstancePublishMap.put("averageServiceExecutionTime",
-          String.format(
-              doubleStringFormatter,
-              round(avgServiceTimeInQueueInst, doubleRoundPlaces)));
-      resultInstancePublishMap.put("minLifeTimeInQueue", totalValueInstance.getMinLifeTimeInQueue().toString());
-      resultInstancePublishMap.put("maxLifeTimeInQueue", totalValueInstance.getMaxLifeTimeInQueue().toString());
-      result.put("InstanceLevel", resultInstancePublishMap.toString());
-
-      return result.toString();
-    }
-  };
-
-  /**
-   * Get CPU and memory information metrics.
-   */
-  protected final Func0<String> getCpuAndMemory = new Func0<String>() {
-    @Override
-    public String call() {
-      Map<String, String> memoryMap = new HashMap<>();
-      OperatingSystemMXBean osMxBean = ManagementFactory.getOperatingSystemMXBean();
-      double cpu = osMxBean.getSystemLoadAverage();
-      memoryMap.put("cpuLoad", String.format(doubleStringFormatter, round(cpu, doubleRoundPlaces)));
-
-      ThreadMXBean threadmxBean = ManagementFactory.getThreadMXBean();
-      int threadCount = threadmxBean.getThreadCount();
-      memoryMap.put("cpuRunningThreads", String.valueOf(threadCount));
-
-      MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
-      MemoryUsage memHeapUsage = memBean.getHeapMemoryUsage();
-      MemoryUsage nonHeapUsage = memBean.getNonHeapMemoryUsage();
-      memoryMap.put("heapInit", String.valueOf(memHeapUsage.getInit()));
-      memoryMap.put("heapMax", String.valueOf(memHeapUsage.getMax()));
-      memoryMap.put("heapCommit", String.valueOf(memHeapUsage.getCommitted()));
-      memoryMap.put("heapUsed", String.valueOf(memHeapUsage.getUsed()));
-      memoryMap.put("nonHeapInit", String.valueOf(nonHeapUsage.getInit()));
-      memoryMap.put("nonHeapMax", String.valueOf(nonHeapUsage.getMax()));
-      memoryMap.put("nonHeapCommit", String.valueOf(nonHeapUsage.getCommitted()));
-      memoryMap.put("nonHeapUsed", String.valueOf(nonHeapUsage.getUsed()));
-      return memoryMap.toString();
-    }
-  };
-
-  /**
-   * Get TPS and latency for operational and instance level from hystrix.
-   */
-  protected final Func0<String> getTpsAndLatency = new Func0<String>() {
-    @Override
-    public String call() {
-      List<TpsAndLatencyData> tpsAndLatencyData = HystrixCommandMetrics.getInstances()
-          .stream()
-          .map(instance -> new TpsAndLatencyData(instance.getRollingCount(HystrixEventType.SUCCESS),
-              instance.getRollingCount(HystrixEventType.FAILURE), instance.getExecutionTimeMean(),
-              instance.getProperties().metricsRollingStatisticalWindowInMilliseconds().get()))
-          .collect(Collectors.toList());
-      return calculateTpsAndLatency(tpsAndLatencyData);
-    }
-  };
-
-  protected String calculateTpsAndLatency(List<TpsAndLatencyData> tpsAndLatencyData) {
-    Map<String, String> tpsAndLatencyMap = new HashMap<>();
-    double insTotalTps = 0;
-    double insTotalLatency = 0;
-    long cumulativeTotalCount = 0;
-    for (TpsAndLatencyData data : tpsAndLatencyData) {
-      long totalCallCount = data.getSuccessCount() + data.getFailureCount();
-      cumulativeTotalCount += totalCallCount;
-      double windowTime =
-          (double) data.getWindowInMilliseconds() / (double) 1000;
-      double qpsVal = (double) (totalCallCount) / windowTime;
-      insTotalTps += qpsVal;
-      insTotalLatency += data.getOperationLatency() * totalCallCount;
-    }
-
-    double instanceLatency = insTotalLatency / (double) cumulativeTotalCount;
-    tpsAndLatencyMap.put("tps", String.format(doubleStringFormatter, round(insTotalTps, doubleRoundPlaces)));
-    tpsAndLatencyMap
-        .put("latency", String.format(doubleStringFormatter, round(instanceLatency, doubleRoundPlaces)));
-    return tpsAndLatencyMap.toString();
-  }
-
-  /**
-   * Implementation of request metrics with using servo gauge metric type.
-   */
-  protected abstract class GaugeMetric extends AbstractMonitor<Number> implements Gauge<Number> {
-
-    public GaugeMetric(MonitorConfig config) {
-      super(config.withAdditionalTag(DataSourceType.GAUGE));
-    }
-
-    @Override
-    public Number getValue(int n) {
-      return getValue();
-    }
-
-    @Override
-    public abstract Number getValue();
-  }
-
-  /**
-   * Implementation of queue average metrics with using servo information metric
-   * type.
-   */
-  protected abstract class InformationalMetric extends AbstractMonitor<String> implements Informational {
-    public InformationalMetric(MonitorConfig config) {
-      super(config.withAdditionalTag(DataSourceType.INFORMATIONAL));
-    }
-
-    @Override
-    public String getValue(int n) {
-      return getValue();
-    }
-
-    @Override
-    public abstract String getValue();
-  }
-
-  /**
-   * Get the total requests and failed requests for instance level.
-   *
-   * @param metricsName Name of the metrics
-   * @param metricToEvaluate observable method to be called for preparation of metrics.
-   * @return Guage metrics
-   */
-  protected Monitor<Number> getRequestValuesGaugeMonitor(final String metricsName,
-      final Func0<Number> metricToEvaluate) {
-    return new GaugeMetric(MonitorConfig.builder(metricsName).build()) {
-
-      @Override
-      public Number getValue() {
-        return metricToEvaluate.call();
-      }
-    };
-  }
-
-  /**
-   * Get the total requests and failed requests for each producer.
-   *
-   * @param metricsName  Name of the metrics
-   * @param metricToEvaluate observable method to be called for preparation of metrics.
-   * @return Guage metrics
-   */
-  protected Monitor<String> getInfoMetricsOperationLevel(final String metricsName,
-      final Func0<String> metricToEvaluate) {
-    return new InformationalMetric(MonitorConfig.builder(metricsName).build()) {
-      @Override
-      public String getValue() {
-        return metricToEvaluate.call();
-      }
-    };
-  }
-
-  /**
-   * Get the total requests and failed requests for each producer.
-   *
-   * @param name Name of the metrics
-   * @param metricToEvaluate observable method to be called for preparation of metrics.
-   * @return Guage metrics
-   */
-  protected Monitor<String> getInfoMetricsOperationalAndInstance(final String name,
-      final Func0<String> metricToEvaluate) {
-    return new InformationalMetric(MonitorConfig.builder(name).build()) {
-      @Override
-      public String getValue() {
-        return metricToEvaluate.call();
-      }
-    };
-  }
-
-  /**
-   * Prepare the initial metrics.
-   *
-   * @return List of monitors
-   */
-  public List<Monitor<?>> getMetricsMonitors() {
-
-    List<Monitor<?>> monitors = new ArrayList<>();
-    monitors.add(getRequestValuesGaugeMonitor("totalRequestsPerProvider INSTANCE_LEVEL",
-        getTotalReqProvider));
-
-    monitors.add(getRequestValuesGaugeMonitor("totalFailedRequestsPerProvider INSTANCE_LEVEL",
-        getTotalFailedReqProvider));
-
-    monitors.add(getRequestValuesGaugeMonitor("totalRequestsPerConsumer INSTANCE_LEVEL",
-        getTotalReqConsumer));
-
-    monitors.add(getRequestValuesGaugeMonitor("totalFailRequestsPerConsumer INSTANCE_LEVEL",
-        getFailedTotalReqConsumer));
-
-    monitors.add(getInfoMetricsOperationLevel("totalRequestProvider OPERATIONAL_LEVEL",
-        getTotalReqProdOperLevel));
-
-    monitors.add(getInfoMetricsOperationLevel("totalFailedRequestProvider OPERATIONAL_LEVEL",
-        getTotalReqFailProdOperLevel));
-
-    monitors.add(getInfoMetricsOperationalAndInstance("RequestQueueRelated", getQueueMetrics));
-
-    monitors.add(getInfoMetricsOperationalAndInstance("TPS and Latency", getTpsAndLatency));
-
-    monitors.add(getInfoMetricsOperationalAndInstance("CPU and Memory", getCpuAndMemory));
-
-    return monitors;
-  }
-
-  private double round(double value, int places) {
-    if (!Double.isNaN(value)) {
-      BigDecimal decimal = new BigDecimal(value);
-      return decimal.setScale(places, RoundingMode.HALF_UP).doubleValue();
-    }
-    return 0;
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/TpsAndLatencyData.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/TpsAndLatencyData.java
deleted file mode 100644
index 84c2a8028..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/TpsAndLatencyData.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics;
-
-public class TpsAndLatencyData {
-  private final long successCount;
-
-  private final long failureCount;
-
-  private final int operationLatency;
-
-  private final long windowInMilliseconds;
-
-  public long getSuccessCount() {
-    return successCount;
-  }
-
-  public long getFailureCount() {
-    return failureCount;
-  }
-
-  public int getOperationLatency() {
-    return operationLatency;
-  }
-
-  public long getWindowInMilliseconds() {
-    return windowInMilliseconds;
-  }
-
-  public TpsAndLatencyData(long successCount, long failureCount, int operationLatency, long windowInMilliseconds) {
-    this.successCount = successCount;
-    this.failureCount = failureCount;
-    this.operationLatency = operationLatency;
-    this.windowInMilliseconds = windowInMilliseconds;
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/MetricsFileOutput.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/MetricsFileOutput.java
deleted file mode 100644
index 68c35bdf9..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/MetricsFileOutput.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output;
-
-import java.util.Map;
-
-import com.netflix.config.DynamicPropertyFactory;
-
-public abstract class MetricsFileOutput {
-  public static final String METRICS_FILE_ROOT_PATH = "servicecomb.metrics.file.root_path";
-
-  public static final String METRICS_FILE_NAME_PREFIX = "servicecomb.metrics.file.name_prefix";
-
-  public static final String METRICS_FILE_MAX_ROLLING_SIZE = "servicecomb.metrics.file.max_rolling_size";
-
-  public static final String METRICS_FILE_MAX_ROLLING_COUNT = "servicecomb.metrics.file.max_rolling_count";
-
-
-  private final String rollingRootFilePath;
-
-  private final String maxRollingFileSize;
-
-  private final int maxRollingFileCount;
-
-  private final String namePrefix;
-
-  public String getRollingRootFilePath() {
-    return rollingRootFilePath;
-  }
-
-  public String getMaxRollingFileSize() {
-    return maxRollingFileSize;
-  }
-
-  public int getMaxRollingFileCount() {
-    return maxRollingFileCount;
-  }
-
-  public String getNamePrefix() {
-    return namePrefix;
-  }
-
-  public MetricsFileOutput() {
-    rollingRootFilePath = DynamicPropertyFactory.getInstance()
-        .getStringProperty(METRICS_FILE_ROOT_PATH, "target")
-        .get();
-    namePrefix = DynamicPropertyFactory.getInstance().getStringProperty(METRICS_FILE_NAME_PREFIX, "metrics").get();
-    maxRollingFileSize = DynamicPropertyFactory.getInstance()
-        .getStringProperty(METRICS_FILE_MAX_ROLLING_SIZE, "10MB")
-        .get();
-    maxRollingFileCount = DynamicPropertyFactory.getInstance().getIntProperty(METRICS_FILE_MAX_ROLLING_COUNT, 10).get();
-  }
-
-  public abstract void output(Map<String, String> metrics);
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/FileOutputMetricObserver.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/FileOutputMetricObserver.java
deleted file mode 100644
index bad984e93..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/FileOutputMetricObserver.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output.servo;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.servicecomb.foundation.metrics.output.MetricsFileOutput;
-
-import com.netflix.servo.Metric;
-import com.netflix.servo.publish.BaseMetricObserver;
-import com.netflix.servo.util.Preconditions;
-
-public class FileOutputMetricObserver extends BaseMetricObserver {
-  private final MetricsFileOutput metricsOutput;
-
-  private final MetricsContentConvertor convertor;
-
-  private final MetricsContentFormatter formatter;
-
-  public FileOutputMetricObserver(MetricsFileOutput metricsOutput,
-      MetricsContentConvertor convertor, MetricsContentFormatter formatter) {
-    super("fileOutputObserver");
-    this.metricsOutput = metricsOutput;
-    this.convertor = convertor;
-    this.formatter = formatter;
-  }
-
-  @Override
-  public void updateImpl(List<Metric> metrics) {
-    Preconditions.checkNotNull(metrics, "metrics");
-    //first convert metrics to Map<String,String>
-    Map<String, String> convertedMetrics = convertor.convert(metrics);
-    //second format output content style
-    Map<String, String> formattedMetrics = formatter.format(convertedMetrics);
-    //finally output to file
-    metricsOutput.output(formattedMetrics);
-  }
-}
-
-
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsContentConvertor.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsContentConvertor.java
deleted file mode 100644
index 097527192..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsContentConvertor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output.servo;
-
-import java.util.List;
-import java.util.Map;
-
-import com.netflix.servo.Metric;
-
-//convert metrics to output content
-public interface MetricsContentConvertor {
-  Map<String, String> convert(List<Metric> metrics);
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsContentFormatter.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsContentFormatter.java
deleted file mode 100644
index bfb307f56..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsContentFormatter.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output.servo;
-
-import java.util.Map;
-
-public interface MetricsContentFormatter {
-  Map<String, String> format(Map<String, String> input);
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsObserverInitializer.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsObserverInitializer.java
deleted file mode 100644
index 71629434b..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/MetricsObserverInitializer.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output.servo;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.servicecomb.foundation.metrics.output.MetricsFileOutput;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import com.netflix.config.DynamicPropertyFactory;
-import com.netflix.servo.publish.BasicMetricFilter;
-import com.netflix.servo.publish.CounterToRateMetricTransform;
-import com.netflix.servo.publish.MetricObserver;
-import com.netflix.servo.publish.MonitorRegistryMetricPoller;
-import com.netflix.servo.publish.PollRunnable;
-import com.netflix.servo.publish.PollScheduler;
-
-//manage and init ServoObservers
-@Component
-public class MetricsObserverInitializer {
-
-  public static final String METRICS_POLL_TIME = "servicecomb.metrics.polltime";
-
-  public static final String METRICS_FILE_ENABLED = "servicecomb.metrics.file.enabled";
-
-  private final int metricPoll;
-
-  private final MetricsFileOutput fileOutput;
-
-  private final MetricsContentConvertor convertor;
-
-  private final MetricsContentFormatter formatter;
-
-  @Autowired
-  public MetricsObserverInitializer(MetricsFileOutput fileOutput, MetricsContentConvertor convertor,
-      MetricsContentFormatter formatter) {
-    this(fileOutput, convertor, formatter, true);
-  }
-
-  public MetricsObserverInitializer(MetricsFileOutput fileOutput, MetricsContentConvertor convertor,
-      MetricsContentFormatter formatter, boolean autoInit) {
-    metricPoll = DynamicPropertyFactory.getInstance().getIntProperty(METRICS_POLL_TIME, 30).get();
-    this.fileOutput = fileOutput;
-    this.convertor = convertor;
-    this.formatter = formatter;
-    if (autoInit) {
-      this.init();
-    }
-  }
-
-  public void init() {
-    PollScheduler scheduler = PollScheduler.getInstance();
-    if (!scheduler.isStarted()) {
-      scheduler.start();
-    }
-
-    if (isRollingFileEnabled()) {
-      MetricObserver fileObserver = new FileOutputMetricObserver(fileOutput, convertor, formatter);
-      MetricObserver fileTransform = new CounterToRateMetricTransform(fileObserver, metricPoll, TimeUnit.SECONDS);
-      PollRunnable fileTask = new PollRunnable(new MonitorRegistryMetricPoller(), BasicMetricFilter.MATCH_ALL,
-          fileTransform);
-      scheduler.addPoller(fileTask, metricPoll, TimeUnit.SECONDS);
-    }
-  }
-
-  public boolean isRollingFileEnabled() {
-    return DynamicPropertyFactory.getInstance().getBooleanProperty(METRICS_FILE_ENABLED, false).get();
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/RollingMetricsFileOutput.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/RollingMetricsFileOutput.java
deleted file mode 100644
index e930701ec..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/RollingMetricsFileOutput.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output.servo;
-
-import java.util.Map;
-
-import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
-import org.apache.servicecomb.foundation.metrics.output.MetricsFileOutput;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-@Component
-public class RollingMetricsFileOutput extends MetricsFileOutput {
-
-  private final Map<String, Logger> allLoggers = new ConcurrentHashMapEx<>();
-
-  public RollingMetricsFileOutput() {
-  }
-
-  @Override
-  public void output(Map<String, String> metrics) {
-    for (String metricName : metrics.keySet()) {
-      Logger logger = allLoggers.computeIfAbsent(metricName, l -> LoggerFactory.getLogger(metricName));
-      logger.trace(metrics.get(metricName));
-    }
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/SimpleMetricsContentConvertor.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/SimpleMetricsContentConvertor.java
deleted file mode 100644
index 550d19c1e..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/SimpleMetricsContentConvertor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output.servo;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.stereotype.Component;
-
-import com.netflix.servo.Metric;
-
-@Component
-public class SimpleMetricsContentConvertor implements MetricsContentConvertor {
-  @Override
-  public Map<String, String> convert(List<Metric> metrics) {
-    Map<String, String> pickedMetrics = new HashMap<>();
-    for (Metric metric : metrics) {
-      if (isTotalRequestInstanceLevelMetric(metric.getConfig().getName())) {
-        pickedMetrics.put(metric.getConfig().getName().replace(" INSTANCE_LEVEL", ""), metric.getValue().toString());
-      } else if ("RequestQueueRelated".equals(metric.getConfig().getName())) {
-        String instanceContent = metric.getValue()
-            .toString()
-            .substring(metric.getValue().toString().indexOf("InstanceLevel={") + "InstanceLevel={".length());
-        instanceContent = instanceContent.substring(0, instanceContent.indexOf('}'));
-        String[] keyAndValueStrings = instanceContent.split(",");
-        for (String keyAndValueString : keyAndValueStrings) {
-          String[] keyAndValue = keyAndValueString.split("=");
-          pickedMetrics.put(keyAndValue[0].trim(), keyAndValue[1].trim());
-        }
-      } else if (isSystemOrTPSAndLatencyMetric(metric.getConfig().getName())) {
-        String instanceContent = metric.getValue().toString().substring(1, metric.getValue().toString().length() - 1);
-        String[] keyAndValueStrings = instanceContent.split(",");
-        for (String keyAndValueString : keyAndValueStrings) {
-          String[] keyAndValue = keyAndValueString.split("=");
-          pickedMetrics.put(keyAndValue[0].trim(), keyAndValue[1].trim());
-        }
-      }
-    }
-
-    return pickedMetrics;
-  }
-
-  private boolean isTotalRequestInstanceLevelMetric(String metricName) {
-    return "totalRequestsPerProvider INSTANCE_LEVEL".equals(metricName) ||
-        "totalFailedRequestsPerProvider INSTANCE_LEVEL".equals(metricName) ||
-        "totalRequestsPerConsumer INSTANCE_LEVEL".equals(metricName) ||
-        "totalFailRequestsPerConsumer INSTANCE_LEVEL".equals(metricName);
-  }
-
-  private boolean isSystemOrTPSAndLatencyMetric(String metricName) {
-    return "CPU and Memory".equals(metricName) ||
-        "TPS and Latency".equals(metricName);
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/SimpleMetricsContentFormatter.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/SimpleMetricsContentFormatter.java
deleted file mode 100644
index ab58702e9..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/output/servo/SimpleMetricsContentFormatter.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.output.servo;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-
-import org.apache.servicecomb.foundation.common.net.NetUtils;
-import org.apache.servicecomb.foundation.common.utils.JsonUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.netflix.config.DynamicPropertyFactory;
-
-@Component
-public class SimpleMetricsContentFormatter implements MetricsContentFormatter {
-
-  public static final String METRICS_FILE_NAME_PREFIX = "servicecomb.metrics.file.name_prefix";
-
-  private static final Logger logger = LoggerFactory.getLogger(SimpleMetricsContentFormatter.class);
-
-  private final String applicationName;
-
-  private String hostName;
-
-  public SimpleMetricsContentFormatter() {
-    hostName = NetUtils.getHostName();
-    if (StringUtils.isEmpty(hostName)) {
-      hostName = NetUtils.getHostAddress();
-    }
-
-    applicationName = DynamicPropertyFactory.getInstance().getStringProperty(METRICS_FILE_NAME_PREFIX, "metrics").get();
-  }
-
-  @Override
-  public Map<String, String> format(Map<String, String> input) {
-    return input.entrySet()
-        .stream()
-        .collect(Collectors.toMap(Entry::getKey, entry -> {
-          try {
-            return JsonUtils
-                .writeValueAsString(new OutputJsonObject(applicationName, hostName, entry.getKey(), entry.getValue()));
-          } catch (JsonProcessingException e) {
-            logger.error("error convert metrics data to json convert", e);
-            return "";
-          }
-        }));
-  }
-
-  class OutputJsonObject {
-    private String plugin_id;
-
-    private Map<String, Object> metric;
-
-    public String getPlugin_id() {
-      return plugin_id;
-    }
-
-    public Map<String, Object> getMetric() {
-      return metric;
-    }
-
-    public OutputJsonObject() {
-    }
-
-    public OutputJsonObject(String plugin_id, String hostName, String metricName, String metricValue) {
-      this();
-      this.plugin_id = plugin_id;
-      this.metric = new HashMap<>();
-      this.metric.put("node", hostName);
-      this.metric.put("scope_name", "");
-      this.metric.put("timestamp", System.currentTimeMillis());
-      this.metric.put("inface_name", "");
-      this.metric.put(metricName, metricValue);
-    }
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/MetricsDataMonitor.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/MetricsDataMonitor.java
deleted file mode 100644
index 8deb5817f..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/MetricsDataMonitor.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.performance;
-
-import java.util.Map;
-
-import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
-
-/**
- * Implements the collection of metrics such as total request, total fail
- * request and average times for requests.
- */
-public class MetricsDataMonitor {
-
-  // inc
-  // invocation start
-  // succ + fail
-  public Long totalReqProvider = 0L;
-
-  // inc
-  // after invocation finished
-  public Long totalFailReqProvider = 0L;
-
-  // inc
-  // after invocation start
-  public Long totalReqConsumer = 0L;
-
-  // inc
-  // after invocation finished
-  public Long totalFailReqConsumer = 0L;
-
-  // key is operQualifiedName
-  // inc
-  // after invocation finished
-  public Map<String, Long> operMetricsTotalReq = new ConcurrentHashMapEx<>();
-
-  // key is operQualifiedName
-  // inc
-  // after invocation finished
-  public Map<String, Long> operMetricsTotalFailReq = new ConcurrentHashMapEx<>();
-
-  // key is operQualifiedName
-  public Map<String, QueueMetricsData> queueMetrics = new ConcurrentHashMapEx<>();
-
-  /**
-   * default constructor.
-   */
-  public MetricsDataMonitor() {
-
-  }
-
-  /**
-   * Returns the map of average values for both instance and operational level.
-   * 
-   * @param pathId Operation path id
-   * @return QueueMetrics object based on key
-   */
-  public QueueMetricsData getOrCreateQueueMetrics(String pathId) {
-    return queueMetrics.computeIfAbsent(pathId, p -> new QueueMetricsData());
-  }
-
-  /**
-   * Returns the map of average values for both instance and operational level.
-   * 
-   * @return queue metrics map
-   */
-  public Map<String, QueueMetricsData> getQueueMetrics() {
-    return queueMetrics;
-  }
-
-  /**
-   * Returns the map of average values for both instance and operational level.
-   * 
-   * @param newMap the new map which passed to queue metrics
-   */
-  public void setQueueMetrics(Map<String, QueueMetricsData> newMap) {
-    queueMetrics = newMap;
-  }
-
-  /**
-   * Sets the map of average values for both instance and operational levels.
-   * 
-   * @param pathId Operation path id
-   * @param reqQueue RequestQueue
-   */
-  public void setQueueMetrics(String pathId, QueueMetricsData reqQueue) {
-    this.queueMetrics.put(pathId, reqQueue);
-  }
-
-  /**
-   * Returns the total requests per provider.
-   * 
-   * @return long total requests for provider
-   */
-  public long getTotalReqProvider() {
-    return totalReqProvider;
-  }
-
-  /**
-   * Increments the total requests per provider.
-   */
-  public void incrementTotalReqProvider() {
-    this.totalReqProvider++;
-  }
-
-  /**
-   * Sets the total requests per provider.
-   * @param totalReqProvider the total requests per provider
-   */
-  public void setTotalReqProvider(Long totalReqProvider) {
-    this.totalReqProvider = totalReqProvider;
-  }
-
-  /**
-   * Returns the total fail requests per provider.
-   * 
-   * @return long total failed requests for provider
-   */
-  public long getTotalFailReqProvider() {
-    return totalFailReqProvider;
-  }
-
-  /**
-   * Sets the total fail requests per provider.
-   */
-  public void incrementTotalFailReqProvider() {
-    this.totalFailReqProvider++;
-  }
-
-  /**
-   * Sets the total failed requests per provider.
-   * @param totalFailedReqProvider the total failed requests per provider
-   */
-  public void setTotalFailReqProvider(Long totalFailedReqProvider) {
-    this.totalFailReqProvider = totalFailedReqProvider;
-  }
-
-  /**
-   * Returns the total requests per consumer.
-   * 
-   * @return long total requests for consumer
-   */
-  public long getTotalReqConsumer() {
-    return totalReqConsumer;
-  }
-
-  /**
-   * Sets the total requests per consumer.
-   */
-  public void incrementTotalReqConsumer() {
-    this.totalReqConsumer++;
-  }
-
-  /**
-   * Sets the total failed requests per consumer.
-   * @param totalReqConsumer the total requests per consumer
-   */
-  public void setTotalReqConsumer(Long totalReqConsumer) {
-    this.totalReqConsumer = totalReqConsumer;
-  }
-
-  /**
-   * Returns the total fail requests per consumer.
-   * 
-   * @return long total failed request for consumer
-   */
-  public long getTotalFailReqConsumer() {
-    return totalFailReqConsumer;
-  }
-
-  /**
-   * Sets the total fail requests per consumer.
-   */
-  public void incrementTotalFailReqConsumer() {
-    this.totalFailReqConsumer++;
-  }
-
-  /**
-   * Sets the total failed requests per consumer.
-   * @param totalFailedReqConsumer the total failed requests per consumer
-   */
-  public void setTotalFailReqConsumer(Long totalFailedReqConsumer) {
-    this.totalFailReqConsumer = totalFailedReqConsumer;
-  }
-
-  /**
-   * Returns total requests per provider for operational level.
-   * 
-   * @param key Operation path id
-   * @return long total requests per provider
-   */
-  public Long getOperMetTotalReq(String key) {
-    return operMetricsTotalReq.get(key);
-  }
-
-  /**
-   * Sets total requests per provider for operational level.
-   * 
-   * @param key pathId
-   * @param val total requests per provider
-   */
-  public void setOperMetTotalReq(String key, Long val) {
-    this.operMetricsTotalReq.put(key, val);
-  }
-
-  /**
-   * Returns total fail requests per provider for operational level.
-   * 
-   * @param key Operation path id
-   * @return long total fail requests per provider
-   */
-  public Long getOperMetTotalFailReq(String key) {
-    return operMetricsTotalFailReq.get(key);
-  }
-
-  /**
-   * Sets total fail requests per provider for operational level.
-   * 
-   * @param key Operation path id
-   * @param val total fail requests per provider
-   */
-  public void setOperMetTotalFailReq(String key, Long val) {
-    this.operMetricsTotalFailReq.put(key, val);
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/MetricsDataMonitorUtil.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/MetricsDataMonitorUtil.java
deleted file mode 100644
index a7a18bd1a..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/MetricsDataMonitorUtil.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.performance;
-
-import org.apache.servicecomb.foundation.metrics.MetricsServoRegistry;
-
-/**
- * Implementation of metric util functions such as preparing average queue times
- * and total requests/fail for producer and instance level.
- */
-public final class MetricsDataMonitorUtil {
-
-  /*
-   * Sets the total requests per provider and consumer.
-   */
-  public void setAllReqProviderAndConsumer(String operationPath, String invocationType) {
-    MetricsDataMonitor metricsRef = MetricsServoRegistry.getOrCreateLocalMetrics();
-    if ("CONSUMER".equals(invocationType)) {
-      metricsRef.incrementTotalReqConsumer();
-    } else {
-      metricsRef.incrementTotalReqProvider();
-      // note down metrics for operational level.
-      metricsRef.setOperMetTotalReq(operationPath,
-          metricsRef.getOperMetTotalReq(operationPath) == null ? 1L : metricsRef.getOperMetTotalReq(operationPath) + 1);
-    }
-  }
-
-  /*
-   * Sets the total failed requests per provider and consumer.
-   */
-  public void setAllFailReqProviderAndConsumer(String operationPath, String invocationType) {
-    MetricsDataMonitor metricsRef = MetricsServoRegistry.getOrCreateLocalMetrics();
-    if ("CONSUMER".equals(invocationType)) {
-      metricsRef.incrementTotalFailReqConsumer();
-    } else {
-      metricsRef.incrementTotalFailReqProvider();
-      // note down metrics for operational level.
-      metricsRef.setOperMetTotalReq(operationPath,
-          metricsRef.getOperMetTotalReq(operationPath) == null ? 1L : metricsRef.getOperMetTotalReq(operationPath) + 1);
-    }
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/QueueMetrics.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/QueueMetrics.java
deleted file mode 100644
index e1c950119..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/QueueMetrics.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.performance;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Used to store invocation specific metrics for queue.
- */
-public class QueueMetrics {
-
-  private AtomicLong queueStartTime = new AtomicLong();
-
-  private AtomicLong endOperTime = new AtomicLong();
-
-  private AtomicLong queueEndTime = new AtomicLong();
-
-  private String operQualifiedName;
-
-  /**
-   * Returns the time when it enters the queue.
-   * @return long
-   */
-  public long getQueueStartTime() {
-    return queueStartTime.get();
-  }
-
-  /**
-   * Sets the time when it enters the queue.
-   * @param startTime Entering time in queue
-   */
-  public void setQueueStartTime(long startTime) {
-    this.queueStartTime.set(startTime);
-  }
-
-  /**
-   * Returns the time when the operation ends.
-   * @return long
-   */
-  public long getEndOperTime() {
-    return endOperTime.get();
-  }
-
-  /**
-   * Sets the time when the operation ends.
-   * @param stopOperTime Start time of operation
-   */
-  public void setEndOperTime(long stopOperTime) {
-    this.endOperTime.set(stopOperTime);
-  }
-
-  /**
-   * Returns the time when it leaves the queue.
-   * @return long
-   */
-  public long getQueueEndTime() {
-    return queueEndTime.get();
-  }
-
-  /**
-   * Sets the time when it leaves the queue.
-   * @param endTime Leaving time from queue
-   */
-  public void setQueueEndTime(long endTime) {
-    this.queueEndTime.set(endTime);
-  }
-
-  /**
-   * Get the microservice qualified name.
-   * @return microservice qualified name
-   */
-  public String getOperQualifiedName() {
-    return operQualifiedName;
-  }
-
-  /**
-   * Set the microservice qualified name.
-   * @param operQualifiedName microservice qualified name
-   */
-  public void setOperQualifiedName(String operQualifiedName) {
-    this.operQualifiedName = operQualifiedName;
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/QueueMetricsData.java b/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/QueueMetricsData.java
deleted file mode 100644
index 20c4ad63f..000000000
--- a/foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/performance/QueueMetricsData.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.performance;
-
-/**
- * Used for holding the request queue related timings like start time, operation time and end time.
- */
-public class QueueMetricsData {
-
-  // after invocation polled from queue
-  private Long totalTime = 0L;
-
-  // succ and fail
-  // after invocation polled from queue
-  private Long totalCount = 0L;
-
-  // after invocation finished
-  private Long totalServExecutionTime = 0L;
-
-  // after invocation finished
-  private Long totalServExecutionCount = 0L;
-
-  // inc and dec
-  // addToQueue inc
-  // pollFromQueue inc
-  // pollFromQueue - addToQueue = countInQueue
-  // after invocation polled from queue
-  private Long countInQueue = 0L;
-
-  // after invocation polled from queue
-  private Long minLifeTimeInQueue = 0L;
-
-  // after invocation polled from queue
-  private Long maxLifeTimeInQueue = 0L;
-
-  /**
-   * Sets total count in queue.
-   */
-  public void incrementCountInQueue() {
-    this.countInQueue++;
-  }
-
-  /**
-   * Deletes total count in queue.
-   */
-  public void decrementCountInQueue() {
-    this.countInQueue--;
-  }
-
-  /**
-   * default constructor.
-   */
-  public QueueMetricsData() {
-
-  }
-
-  /**
-   * Returns the count for calculating average count value in queue.
-   * @return Long
-   */
-  public Long getTotalTime() {
-    return totalTime;
-  }
-
-  /**
-   * Sets the total time for calculating average time in queue.
-   * @param totalTime total time value
-   */
-  public void setTotalTime(long totalTime) {
-    this.totalTime = totalTime;
-  }
-
-  /**
-   * Returns the total count for calculating average count value in queue.
-   * @return Long
-   */
-  public Long getTotalCount() {
-    return totalCount;
-  }
-
-  /**
-   * Sets the total count for calculating average count value in queue.
-   */
-  public void incrementTotalCount() {
-    this.totalCount++;
-  }
-
-  /**
-   * Sets the total count for calculating average count value in queue.
-   * @param totalCount total count
-   */
-  public void setTotalCount(long totalCount) {
-    this.totalCount = totalCount;
-  }
-
-  /**
-   * Returns the count for calculating average value of working time after queue.
-   * @return Long
-   */
-  public Long getTotalServExecutionTime() {
-    return totalServExecutionTime;
-  }
-
-  /**
-   * Sets the count for calculating average value of working time after queue.
-   * @param totalCountAfterQueue count value
-   */
-  public void setTotalServExecutionTime(long totalCountAfterQueue) {
-    this.totalServExecutionTime = totalCountAfterQueue;
-  }
-
-  /**
-   * Returns the total count for calculating average value of working time after queue.
-   * @return Long
-   */
-  public Long getTotalServExecutionCount() {
-    return totalServExecutionCount;
-  }
-
-  /**
-   * Sets the total count for calculating average value of working time after queue. 
-   */
-  public void incrementTotalServExecutionCount() {
-    this.totalServExecutionCount++;
-  }
-
-  /**
-   * Sets the total count for calculating average value of working time after queue.
-   * @param totalServExecutionCount total service execution time count
-   */
-  public void setTotalServExecutionCount(long totalServExecutionCount) {
-    this.totalServExecutionCount = totalServExecutionCount;
-  }
-
-  /** 
-   * Returns total count in queue.
-   * @return Long
-   */
-  public Long getCountInQueue() {
-    return countInQueue;
-  }
-
-  /**  
-   * Returns total count in queue.
-   * @param countInQueue queue count
-   */
-  public void setCountInQueue(long countInQueue) {
-    this.countInQueue = countInQueue;
-  }
-
-  /** 
-   * Returns the minimum lifetime in queue.
-   * @return Long
-   */
-  public Long getMinLifeTimeInQueue() {
-    return minLifeTimeInQueue;
-  }
-
-  /** 
-   * Sets the minimum lifetime in queue.
-   * @param minLifeTimeInQueue minimum lifetime
-   */
-  public void setMinLifeTimeInQueue(long minLifeTimeInQueue) {
-    if ((this.minLifeTimeInQueue <= 0) || (minLifeTimeInQueue < this.minLifeTimeInQueue)) {
-      this.minLifeTimeInQueue = minLifeTimeInQueue;
-    }
-  }
-
-  /** 
-   * Returns maximum lifetime in queue.
-   * @return Long
-   */
-  public Long getMaxLifeTimeInQueue() {
-    return maxLifeTimeInQueue;
-  }
-
-  /** 
-   * Sets maximum lifetime in queue.
-   * @param maxLifeTimeInQueue maximum lifetime
-   */
-  public void setMaxLifeTimeInQueue(long maxLifeTimeInQueue) {
-    if ((this.maxLifeTimeInQueue <= 0) || (maxLifeTimeInQueue > this.maxLifeTimeInQueue)) {
-      this.maxLifeTimeInQueue = maxLifeTimeInQueue;
-    }
-  }
-
-  /** 
-   * Resets minimum lifetime in queue.
-   */
-  public void resetMinLifeTimeInQueue() {
-    this.minLifeTimeInQueue = 0L;
-  }
-
-  /** 
-   * Resets maximum lifetime in queue.
-   */
-  public void resetMaxLifeTimeInQueue() {
-    this.maxLifeTimeInQueue = 0L;
-  }
-}
diff --git a/foundations/foundation-metrics/src/main/resources/META-INF/spring/metrics.bean.xml b/foundations/foundation-metrics/src/main/resources/META-INF/spring/metrics.bean.xml
index 49092cbc9..c0c178fff 100644
--- a/foundations/foundation-metrics/src/main/resources/META-INF/spring/metrics.bean.xml
+++ b/foundations/foundation-metrics/src/main/resources/META-INF/spring/metrics.bean.xml
@@ -17,14 +17,11 @@
   -->
 
 <beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
-	xmlns:util="http://www.springframework.org/schema/util"
-	xsi:schemaLocation="
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 
-	<bean class="org.apache.servicecomb.foundation.metrics.MetricsConfig">
-	</bean>
-	<bean class="org.apache.servicecomb.foundation.metrics.MetricsServoRegistry">
-	</bean>
+  <bean class="org.apache.servicecomb.foundation.metrics.MetricsConfig">
+  </bean>
 </beans>
diff --git a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestFileOutputMetricObserverAndContentConvertor.java b/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestFileOutputMetricObserverAndContentConvertor.java
deleted file mode 100644
index e11ad3f8c..000000000
--- a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestFileOutputMetricObserverAndContentConvertor.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.servicecomb.foundation.metrics.output.MetricsFileOutput;
-import org.apache.servicecomb.foundation.metrics.output.servo.FileOutputMetricObserver;
-import org.apache.servicecomb.foundation.metrics.output.servo.MetricsContentFormatter;
-import org.apache.servicecomb.foundation.metrics.output.servo.SimpleMetricsContentConvertor;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-
-import com.netflix.servo.Metric;
-import com.netflix.servo.monitor.MonitorConfig;
-
-public class TestFileOutputMetricObserverAndContentConvertor {
-  @SuppressWarnings("unchecked")
-  @Test
-  public void testMetricObserverUpdateImpl() {
-
-    MetricsFileOutput output = mock(MetricsFileOutput.class);
-    SimpleMetricsContentConvertor convertor = new SimpleMetricsContentConvertor();
-    MetricsContentFormatter formatter = new MetricsContentFormatter() {
-      @Override
-      public Map<String, String> format(Map<String, String> input) {
-        return input;
-      }
-    };
-
-    List<Metric> metrics = new ArrayList<>();
-    metrics.add(
-        new Metric(MonitorConfig.builder("totalRequestsPerProvider INSTANCE_LEVEL").build(), System.currentTimeMillis(),
-            "1"));
-    metrics.add(new Metric(MonitorConfig.builder("totalFailedRequestsPerProvider INSTANCE_LEVEL").build(),
-        System.currentTimeMillis(), "2"));
-    metrics.add(
-        new Metric(MonitorConfig.builder("totalRequestsPerConsumer INSTANCE_LEVEL").build(), System.currentTimeMillis(),
-            "3"));
-    metrics.add(new Metric(MonitorConfig.builder("totalFailRequestsPerConsumer INSTANCE_LEVEL").build(),
-        System.currentTimeMillis(), "4"));
-    metrics.add(
-        new Metric(MonitorConfig.builder("totalRequestProvider OPERATIONAL_LEVEL").build(), System.currentTimeMillis(),
-            "totalRequestProvider"));
-    metrics.add(new Metric(MonitorConfig.builder("totalFailedRequestProvider OPERATIONAL_LEVEL").build(),
-        System.currentTimeMillis(), "totalFailedRequestProvider"));
-    metrics.add(new Metric(MonitorConfig.builder("RequestQueueRelated").build(), System.currentTimeMillis(),
-        "{InstanceLevel={averageServiceExecutionTime=1.0, countInQueue=2, minLifeTimeInQueue=3, averageTimeInQueue=4.0, maxLifeTimeInQueue=5}}"));
-    metrics.add(new Metric(MonitorConfig.builder("TPS and Latency").build(), System.currentTimeMillis(),
-        "{latency=100, tps=200}"));
-    metrics.add(new Metric(MonitorConfig.builder("CPU and Memory").build(), System.currentTimeMillis(),
-        "{heapUsed=146120664, nonHeapUsed=55146864, cpuRunningThreads=36, heapMax=3786407936, heapCommit=472907776, nonHeapInit=2555904, nonHeapMax=-1, cpuLoad=-1.0, heapInit=266338304, nonHeapCommit=56623104}"));
-
-    FileOutputMetricObserver observer = new FileOutputMetricObserver(output, convertor, formatter);
-    observer.updateImpl(metrics);
-
-    @SuppressWarnings("rawtypes")
-    ArgumentCaptor<Map> outputMetrics = ArgumentCaptor.forClass(Map.class);
-    verify(output).output(outputMetrics.capture());
-
-    HashMap<String, String> result = (HashMap<String, String>) outputMetrics.getValue();
-
-    Assert.assertTrue(result.containsKey("totalRequestsPerProvider"));
-    Assert.assertTrue(result.get("totalRequestsPerProvider").equals("1"));
-    Assert.assertTrue(result.containsKey("totalFailedRequestsPerProvider"));
-    Assert.assertTrue(result.get("totalFailedRequestsPerProvider").equals("2"));
-    Assert.assertTrue(result.containsKey("totalRequestsPerConsumer"));
-    Assert.assertTrue(result.get("totalRequestsPerConsumer").equals("3"));
-    Assert.assertTrue(result.containsKey("totalFailRequestsPerConsumer"));
-    Assert.assertTrue(result.get("totalFailRequestsPerConsumer").equals("4"));
-
-    Assert.assertTrue(result.containsKey("averageServiceExecutionTime"));
-    Assert.assertTrue(result.get("averageServiceExecutionTime").equals("1.0"));
-    Assert.assertTrue(result.containsKey("countInQueue"));
-    Assert.assertTrue(result.get("countInQueue").equals("2"));
-    Assert.assertTrue(result.containsKey("minLifeTimeInQueue"));
-    Assert.assertTrue(result.get("minLifeTimeInQueue").equals("3"));
-    Assert.assertTrue(result.containsKey("averageTimeInQueue"));
-    Assert.assertTrue(result.get("averageTimeInQueue").equals("4.0"));
-    Assert.assertTrue(result.containsKey("maxLifeTimeInQueue"));
-    Assert.assertTrue(result.get("maxLifeTimeInQueue").equals("5"));
-
-    Assert.assertTrue(result.containsKey("latency"));
-    Assert.assertTrue(result.get("latency").equals("100"));
-    Assert.assertTrue(result.containsKey("tps"));
-    Assert.assertTrue(result.get("tps").equals("200"));
-
-    Assert.assertTrue(result.containsKey("heapUsed"));
-    Assert.assertTrue(result.get("heapUsed").equals("146120664"));
-    Assert.assertTrue(result.containsKey("nonHeapUsed"));
-    Assert.assertTrue(result.get("nonHeapUsed").equals("55146864"));
-    Assert.assertTrue(result.containsKey("cpuRunningThreads"));
-    Assert.assertTrue(result.get("cpuRunningThreads").equals("36"));
-    Assert.assertTrue(result.containsKey("heapMax"));
-    Assert.assertTrue(result.get("heapMax").equals("3786407936"));
-    Assert.assertTrue(result.containsKey("heapCommit"));
-    Assert.assertTrue(result.get("heapCommit").equals("472907776"));
-    Assert.assertTrue(result.containsKey("nonHeapInit"));
-    Assert.assertTrue(result.get("nonHeapInit").equals("2555904"));
-    Assert.assertTrue(result.containsKey("nonHeapMax"));
-    Assert.assertTrue(result.get("nonHeapMax").equals("-1"));
-    Assert.assertTrue(result.containsKey("cpuLoad"));
-    Assert.assertTrue(result.get("cpuLoad").equals("-1.0"));
-    Assert.assertTrue(result.containsKey("heapInit"));
-    Assert.assertTrue(result.get("heapInit").equals("266338304"));
-    Assert.assertTrue(result.containsKey("nonHeapCommit"));
-    Assert.assertTrue(result.get("nonHeapCommit").equals("56623104"));
-  }
-}
diff --git a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestMetricsServoRegistry.java b/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestMetricsServoRegistry.java
deleted file mode 100644
index c595ba2a1..000000000
--- a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestMetricsServoRegistry.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.configuration.BaseConfiguration;
-import org.apache.servicecomb.foundation.metrics.output.MetricsFileOutput;
-import org.apache.servicecomb.foundation.metrics.output.servo.MetricsContentConvertor;
-import org.apache.servicecomb.foundation.metrics.output.servo.MetricsContentFormatter;
-import org.apache.servicecomb.foundation.metrics.output.servo.MetricsObserverInitializer;
-import org.apache.servicecomb.foundation.metrics.output.servo.RollingMetricsFileOutput;
-import org.apache.servicecomb.foundation.metrics.output.servo.SimpleMetricsContentConvertor;
-import org.apache.servicecomb.foundation.metrics.output.servo.SimpleMetricsContentFormatter;
-import org.apache.servicecomb.foundation.metrics.performance.MetricsDataMonitor;
-import org.apache.servicecomb.foundation.metrics.performance.QueueMetricsData;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.netflix.config.DynamicPropertyFactory;
-import com.netflix.servo.publish.PollScheduler;
-
-public class TestMetricsServoRegistry {
-  MetricsDataMonitor metricsDataMonitor = null;
-
-  MetricsDataMonitor localData = null;
-
-  MetricsServoRegistry metricsRegistry = null;
-
-  MetricsFileOutput fileOutput = null;
-
-  MetricsContentConvertor convertor = null;
-
-  MetricsContentFormatter formatter = null;
-
-  MetricsObserverInitializer observerManager = null;
-
-  @BeforeClass
-  public static void staticBeforeClean() {
-    BaseConfiguration configuration = new BaseConfiguration();
-    configuration.setProperty(MetricsObserverInitializer.METRICS_FILE_ENABLED, true);
-    configuration.setProperty(MetricsObserverInitializer.METRICS_POLL_TIME, 1);
-    DynamicPropertyFactory.initWithConfigurationSource(configuration);
-    MetricsServoRegistry.metricsList.clear();
-    MetricsServoRegistry.LOCAL_METRICS_MAP = new ThreadLocal<>();
-  }
-
-  @Before
-  public void setUp() throws Exception {
-    metricsRegistry = new MetricsServoRegistry();
-    convertor = new SimpleMetricsContentConvertor();
-    formatter = new SimpleMetricsContentFormatter();
-    fileOutput = new RollingMetricsFileOutput();
-    observerManager = new MetricsObserverInitializer(fileOutput, convertor, formatter, false);
-    localData = metricsRegistry.getLocalMetrics();
-    metricsDataMonitor = MetricsServoRegistry.getOrCreateLocalMetrics();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    PollScheduler.getInstance().stop();
-    metricsRegistry = null;
-    convertor = null;
-    formatter = null;
-    observerManager = null;
-    fileOutput = null;
-    localData = null;
-    metricsDataMonitor = null;
-  }
-
-  @Test
-  public void testAllRegistryMetrics() throws Exception {
-
-    metricsDataMonitor.incrementTotalReqProvider();
-    metricsDataMonitor.incrementTotalFailReqProvider();
-    metricsDataMonitor.incrementTotalReqConsumer();
-    metricsDataMonitor.incrementTotalFailReqConsumer();
-    metricsDataMonitor.setOperMetTotalReq("sayHi", 20L);
-    metricsDataMonitor.setOperMetTotalFailReq("sayHi", 20L);
-    localData = metricsRegistry.getLocalMetrics();
-    localData.setOperMetTotalReq("sayHi", 10L);
-    localData.setOperMetTotalFailReq("sayHi", 10L);
-
-    metricsRegistry.afterPropertiesSet();
-    observerManager.init();
-    Thread.sleep(1000);
-    // get the metrics from local data and compare
-    localData = metricsRegistry.getLocalMetrics();
-    Assert.assertEquals(1, localData.getTotalReqProvider());
-    Assert.assertEquals(1, localData.getTotalFailReqProvider());
-    Assert.assertEquals(1, localData.getTotalReqConsumer());
-    Assert.assertEquals(1, localData.getTotalFailReqConsumer());
-    Assert.assertEquals(20L, localData.getOperMetTotalReq("sayHi").longValue());
-    Assert.assertEquals(20L, localData.getOperMetTotalFailReq("sayHi").longValue());
-
-    MetricsDataMonitor localData1 = metricsRegistry.getLocalMetrics();
-    Assert.assertEquals(20L, localData1.getOperMetTotalReq("sayHi").longValue());
-    Assert.assertEquals(20L, localData1.getOperMetTotalFailReq("sayHi").longValue());
-  }
-
-  @Test
-  public void testOperationalProviderMetrics() throws Exception {
-    MetricsDataMonitor metricsDataMonitor = MetricsServoRegistry.getOrCreateLocalMetrics();
-    metricsDataMonitor.setOperMetTotalReq("sayHi", 20L);
-    metricsDataMonitor.setOperMetTotalFailReq("sayHi", 20L);
-    localData = metricsRegistry.getLocalMetrics();
-
-    metricsRegistry.afterPropertiesSet();
-    observerManager.init();
-    Thread.sleep(1000);
-    // get the metrics from local data and compare
-    localData = metricsRegistry.getLocalMetrics();
-    Assert.assertEquals(1, localData.getTotalReqProvider());
-    Assert.assertEquals(1, localData.getTotalFailReqProvider());
-    Assert.assertEquals(1, localData.getTotalReqConsumer());
-    Assert.assertEquals(1, localData.getTotalFailReqConsumer());
-    Assert.assertEquals(20L, localData.getOperMetTotalReq("sayHi").longValue());
-    Assert.assertEquals(20L, localData.getOperMetTotalFailReq("sayHi").longValue());
-
-    MetricsDataMonitor localData1 = metricsRegistry.getLocalMetrics();
-    Assert.assertEquals(20L, localData1.getOperMetTotalReq("sayHi").longValue());
-    Assert.assertEquals(20L, localData1.getOperMetTotalFailReq("sayHi").longValue());
-  }
-
-  @Test
-  public void testQueueMetrics() throws Exception {
-    QueueMetricsData reqQueue1 = new QueueMetricsData();
-    reqQueue1.setCountInQueue(1);
-    reqQueue1.setMaxLifeTimeInQueue(2);
-    reqQueue1.setMinLifeTimeInQueue(1);
-    reqQueue1.setTotalCount(10);
-    reqQueue1.setTotalTime(100);
-    reqQueue1.setTotalServExecutionCount(5);
-    reqQueue1.setTotalServExecutionTime(50);
-    metricsDataMonitor.setQueueMetrics("/sayBye", reqQueue1);
-
-    metricsRegistry.afterPropertiesSet();
-    observerManager.init();
-    Thread.sleep(1000);
-    // get the metrics from local data and compare
-    Map<String, QueueMetricsData> localMap = localData.getQueueMetrics();
-    QueueMetricsData reqQueue2 = localMap.get("/sayBye");
-
-    Assert.assertEquals(1L, reqQueue2.getCountInQueue().longValue());
-    Assert.assertEquals(1L, reqQueue2.getMinLifeTimeInQueue().longValue());
-    Assert.assertEquals(2L, reqQueue2.getMaxLifeTimeInQueue().longValue());
-    Assert.assertEquals(10L, reqQueue2.getTotalCount().longValue());
-    Assert.assertEquals(100L, reqQueue2.getTotalTime().longValue());
-    Assert.assertEquals(5, reqQueue2.getTotalServExecutionCount().longValue());
-    Assert.assertEquals(50, reqQueue2.getTotalServExecutionTime().longValue());
-  }
-
-  @Test
-  public void testQueueMetrics1() throws Exception {
-    QueueMetricsData reqQueue1 = new QueueMetricsData();
-    reqQueue1.setCountInQueue(10);
-    reqQueue1.setMaxLifeTimeInQueue(2);
-    reqQueue1.setMinLifeTimeInQueue(2);
-    reqQueue1.setTotalCount(1);
-    reqQueue1.setTotalTime(10);
-    reqQueue1.setTotalServExecutionCount(1);
-    reqQueue1.setTotalServExecutionTime(1);
-    localData.setQueueMetrics("/sayBye", reqQueue1);
-
-    QueueMetricsData reqQueue2 = new QueueMetricsData();
-    reqQueue2.setCountInQueue(10);
-    reqQueue2.setMaxLifeTimeInQueue(2);
-    reqQueue2.setMinLifeTimeInQueue(2);
-    reqQueue2.setTotalCount(10);
-    reqQueue2.setTotalTime(100);
-    reqQueue2.setTotalServExecutionCount(5);
-    reqQueue2.setTotalServExecutionTime(50);
-    metricsDataMonitor.setQueueMetrics("/sayBye", reqQueue2);
-
-    metricsRegistry.afterPropertiesSet();
-    observerManager.init();
-    Thread.sleep(1000);
-    // get the metrics from local data and compare
-    Map<String, QueueMetricsData> localMap = localData.getQueueMetrics();
-    QueueMetricsData reqQueue3 = localMap.get("/sayBye");
-
-    Assert.assertEquals(10L, reqQueue3.getCountInQueue().longValue());
-    Assert.assertEquals(2L, reqQueue3.getMinLifeTimeInQueue().longValue());
-    Assert.assertEquals(2L, reqQueue3.getMaxLifeTimeInQueue().longValue());
-    Assert.assertEquals(10L, reqQueue3.getTotalCount().longValue());
-    Assert.assertEquals(100L, reqQueue3.getTotalTime().longValue());
-    Assert.assertEquals(5L, reqQueue3.getTotalServExecutionCount().longValue());
-    Assert.assertEquals(50L, reqQueue3.getTotalServExecutionTime().longValue());
-  }
-
-  @Test
-  public void testCalculateTps() {
-    observerManager.init();
-    List<TpsAndLatencyData> tpsAndLatencyData = new ArrayList<>();
-    tpsAndLatencyData.add(new TpsAndLatencyData(1, 1, 100, 100));
-    tpsAndLatencyData.add(new TpsAndLatencyData(2, 2, 200, 200));
-    String results = metricsRegistry.calculateTpsAndLatency(tpsAndLatencyData);
-    Assert.assertTrue("{tps=40.0, latency=166.7}".equals(results));
-  }
-}
diff --git a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestSimpleMetricsContentFormatter.java b/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestSimpleMetricsContentFormatter.java
deleted file mode 100644
index 9edbc2472..000000000
--- a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/TestSimpleMetricsContentFormatter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.servicecomb.foundation.metrics.output.servo.SimpleMetricsContentFormatter;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestSimpleMetricsContentFormatter {
-
-  @Test
-  public void testFormatter() {
-    SimpleMetricsContentFormatter formatter = new SimpleMetricsContentFormatter();
-
-    Map<String, String> input = new HashMap<>();
-    input.put("key", "value");
-
-    Map<String, String> output = formatter.format(input);
-
-    Assert.assertTrue(output.containsKey("key"));
-    Assert.assertTrue(output.get("key").contains("\"key\":\"value\""));
-  }
-}
diff --git a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/performance/TestMetricsDataMonitor.java b/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/performance/TestMetricsDataMonitor.java
deleted file mode 100644
index de4fc5d20..000000000
--- a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/performance/TestMetricsDataMonitor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.performance;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestMetricsDataMonitor {
-  MetricsDataMonitor metricsDataMonitor = null;
-
-  @Before
-  public void setUp() throws Exception {
-    metricsDataMonitor = new MetricsDataMonitor();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    metricsDataMonitor = null;
-  }
-
-  @Test
-  public void testReqMapValues() {
-    QueueMetricsData reqQueue = new QueueMetricsData();
-    reqQueue.setCountInQueue(1L);
-    reqQueue.setMaxLifeTimeInQueue(5L);
-    reqQueue.setMinLifeTimeInQueue(1L);
-    reqQueue.toString();
-
-    metricsDataMonitor.setQueueMetrics("/sayHi", reqQueue);
-    QueueMetricsData reqQueueTest = metricsDataMonitor.getOrCreateQueueMetrics("/sayHi");
-    QueueMetricsData reqQueueTestAbsent = metricsDataMonitor.getOrCreateQueueMetrics("");
-    Assert.assertEquals(1, reqQueueTest.getCountInQueue().longValue());
-    Assert.assertEquals(5, reqQueueTest.getMaxLifeTimeInQueue().longValue());
-    Assert.assertEquals(1, reqQueueTest.getMinLifeTimeInQueue().longValue());
-    Assert.assertEquals(0, reqQueueTestAbsent.getCountInQueue().longValue());
-  }
-
-  @Test
-  public void testOperationMetricsMap() {
-    QueueMetrics reqQueue = new QueueMetrics();
-    QueueMetricsData queueMetrics = new QueueMetricsData();
-    queueMetrics.incrementCountInQueue();
-    reqQueue.setQueueStartTime(200);
-    reqQueue.setEndOperTime(250);
-    reqQueue.setQueueEndTime(300);
-    reqQueue.setOperQualifiedName("name");
-    queueMetrics.setTotalTime(100L);
-    queueMetrics.setTotalServExecutionTime(200L);
-    queueMetrics.setTotalCount(100L);
-    queueMetrics.setTotalServExecutionCount(200L);
-
-    // increment the count to 5.
-    queueMetrics.incrementTotalCount();
-    queueMetrics.incrementTotalCount();
-    queueMetrics.incrementTotalCount();
-    queueMetrics.incrementTotalCount();
-    queueMetrics.incrementTotalCount();
-    queueMetrics.incrementTotalServExecutionCount();
-    queueMetrics.incrementTotalServExecutionCount();
-    queueMetrics.incrementTotalServExecutionCount();
-    queueMetrics.incrementTotalServExecutionCount();
-    queueMetrics.incrementTotalServExecutionCount();
-
-    queueMetrics.setMinLifeTimeInQueue(1);
-    queueMetrics.resetMinLifeTimeInQueue();
-    Assert.assertEquals(0, queueMetrics.getMinLifeTimeInQueue().longValue());
-
-    queueMetrics.setMaxLifeTimeInQueue(1);
-    queueMetrics.resetMaxLifeTimeInQueue();
-    Assert.assertEquals(0, queueMetrics.getMaxLifeTimeInQueue().longValue());
-
-    metricsDataMonitor.setQueueMetrics("/sayHi", queueMetrics);
-
-    //Assert.assertEquals(1, reqQueueTest.getConuntInQueue());
-    Assert.assertEquals(300, reqQueue.getQueueEndTime());
-    Assert.assertEquals(250, reqQueue.getEndOperTime());
-    Assert.assertEquals(200, reqQueue.getQueueStartTime());
-    Assert.assertEquals("name", reqQueue.getOperQualifiedName());
-    Assert.assertEquals(100L, queueMetrics.getTotalTime().longValue());
-    Assert.assertEquals(105L, queueMetrics.getTotalCount().longValue());
-    Assert.assertEquals(200, queueMetrics.getTotalServExecutionTime().longValue());
-    Assert.assertEquals(205L, queueMetrics.getTotalServExecutionCount().longValue());
-    queueMetrics.decrementCountInQueue();
-    Assert.assertEquals(0, queueMetrics.getCountInQueue().longValue());
-  }
-
-  @Test
-  public void testHystrixAvgTimes() {
-
-    // total request for provider
-    metricsDataMonitor.incrementTotalReqProvider();
-    metricsDataMonitor.incrementTotalFailReqProvider();
-    Assert.assertEquals(1, metricsDataMonitor.getTotalReqProvider());
-    Assert.assertEquals(1, metricsDataMonitor.getTotalFailReqProvider());
-    metricsDataMonitor.incrementTotalReqProvider();
-    metricsDataMonitor.incrementTotalFailReqProvider();
-    Assert.assertEquals(2, metricsDataMonitor.getTotalReqProvider());
-    Assert.assertEquals(2, metricsDataMonitor.getTotalFailReqProvider());
-
-    // total request for consumer
-    metricsDataMonitor.incrementTotalReqConsumer();
-    metricsDataMonitor.incrementTotalFailReqConsumer();
-    Assert.assertEquals(1, metricsDataMonitor.getTotalReqConsumer());
-    Assert.assertEquals(1, metricsDataMonitor.getTotalFailReqConsumer());
-    metricsDataMonitor.incrementTotalReqConsumer();
-    metricsDataMonitor.incrementTotalFailReqConsumer();
-    Assert.assertEquals(2, metricsDataMonitor.getTotalReqConsumer());
-    Assert.assertEquals(2, metricsDataMonitor.getTotalFailReqConsumer());
-
-    metricsDataMonitor.setOperMetTotalReq("/sayHi", 10L);
-    metricsDataMonitor.setOperMetTotalFailReq("/sayHi", 20L);
-    Assert.assertEquals(10L, metricsDataMonitor.getOperMetTotalReq("/sayHi").longValue());
-    Assert.assertEquals(20L, metricsDataMonitor.getOperMetTotalFailReq("/sayHi").longValue());
-  }
-}
diff --git a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/performance/TestMetricsDataMonitorUtil.java b/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/performance/TestMetricsDataMonitorUtil.java
deleted file mode 100644
index 327bfd5f4..000000000
--- a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/performance/TestMetricsDataMonitorUtil.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.servicecomb.foundation.metrics.performance;
-
-import org.apache.servicecomb.foundation.metrics.MetricsServoRegistry;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestMetricsDataMonitorUtil {
-  MetricsDataMonitor metricsDataMonitor = null;
-
-  MetricsDataMonitorUtil metricsDataMonitorUtil = null;
-
-  @Before
-  public void setUp() throws Exception {
-    metricsDataMonitor = MetricsServoRegistry.getOrCreateLocalMetrics();
-    metricsDataMonitorUtil = new MetricsDataMonitorUtil();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    metricsDataMonitor = null;
-  }
-
-  @Test
-  public void testAllReqConsumer() {
-    metricsDataMonitorUtil.setAllReqProviderAndConsumer("/sayHi", "CONSUMER");
-    Assert.assertNotEquals(0L, metricsDataMonitor.getTotalReqConsumer());
-    metricsDataMonitorUtil.setAllFailReqProviderAndConsumer("/sayHi", "CONSUMER");
-    Assert.assertNotEquals(0L, metricsDataMonitor.getTotalFailReqConsumer());
-  }
-
-  @Test
-  public void testAllReqProvider() {
-    metricsDataMonitorUtil.setAllReqProviderAndConsumer("/sayBye", "PRODUCER");
-    Assert.assertNotEquals(0L, metricsDataMonitor.getTotalReqProvider());
-    metricsDataMonitorUtil.setAllReqProviderAndConsumer("/sayBye", "PRODUCER");
-    Assert.assertNotEquals(0L, metricsDataMonitor.getTotalReqProvider());
-    metricsDataMonitorUtil.setAllFailReqProviderAndConsumer("/sayBye", "PRODUCER");
-    Assert.assertNotEquals(0L, metricsDataMonitor.getTotalFailReqProvider());
-    metricsDataMonitorUtil.setAllFailReqProviderAndConsumer("/sayBye", "PRODUCER");
-    Assert.assertNotEquals(0L, metricsDataMonitor.getTotalFailReqProvider());
-  }
-}
diff --git a/handlers/handler-bizkeeper/src/main/java/org/apache/servicecomb/bizkeeper/BizkeeperHandler.java b/handlers/handler-bizkeeper/src/main/java/org/apache/servicecomb/bizkeeper/BizkeeperHandler.java
index 961f7f942..bf6f91140 100644
--- a/handlers/handler-bizkeeper/src/main/java/org/apache/servicecomb/bizkeeper/BizkeeperHandler.java
+++ b/handlers/handler-bizkeeper/src/main/java/org/apache/servicecomb/bizkeeper/BizkeeperHandler.java
@@ -19,7 +19,6 @@
 
 import org.apache.servicecomb.core.Handler;
 import org.apache.servicecomb.core.Invocation;
-import org.apache.servicecomb.foundation.metrics.performance.MetricsDataMonitorUtil;
 import org.apache.servicecomb.swagger.invocation.AsyncResponse;
 import org.apache.servicecomb.swagger.invocation.Response;
 import org.slf4j.Logger;
@@ -71,22 +70,13 @@ public BizkeeperHandler(String groupname) {
   protected abstract BizkeeperCommand createBizkeeperCommand(Invocation invocation);
 
   @Override
-  public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
+  public void handle(Invocation invocation, AsyncResponse asyncResp) {
     HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation);
 
-    new MetricsDataMonitorUtil()
-        .setAllReqProviderAndConsumer(invocation.getOperationMeta().getMicroserviceQualifiedName(),
-            String.valueOf(invocation.getInvocationType()));
-
     Observable<Response> observable = command.toObservable();
     observable.subscribe(asyncResp::complete, error -> {
       LOG.warn("catch error in bizkeeper:" + error.getMessage());
       asyncResp.fail(invocation.getInvocationType(), error);
-
-      new MetricsDataMonitorUtil()
-          .setAllFailReqProviderAndConsumer(invocation.getOperationMeta().getMicroserviceQualifiedName(),
-              String.valueOf(invocation.getInvocationType()));
-
     }, () -> {
 
     });
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java
index 020c926a3..843c0fe45 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java
@@ -31,9 +31,6 @@
 import org.apache.servicecomb.core.definition.SchemaMeta;
 import org.apache.servicecomb.core.metrics.InvocationStartedEvent;
 import org.apache.servicecomb.foundation.common.utils.EventUtils;
-import org.apache.servicecomb.foundation.metrics.MetricsServoRegistry;
-import org.apache.servicecomb.foundation.metrics.performance.QueueMetrics;
-import org.apache.servicecomb.foundation.metrics.performance.QueueMetricsData;
 import org.apache.servicecomb.foundation.vertx.tcp.TcpConnection;
 import org.apache.servicecomb.swagger.invocation.InvocationType;
 import org.apache.servicecomb.swagger.invocation.Response;
@@ -110,9 +107,9 @@ private void doInit(TcpConnection connection, long msgId, RequestHeader header,
     this.bodyBuffer = bodyBuffer;
   }
 
-  private void runInExecutor(QueueMetrics metricsData, InvocationStartedEvent startedEvent) {
+  private void runInExecutor(InvocationStartedEvent startedEvent) {
     try {
-      doRunInExecutor(metricsData, startedEvent);
+      doRunInExecutor(startedEvent);
     } catch (Throwable e) {
       String msg = String.format("handle request error, %s, msgId=%d",
           operationMeta.getMicroserviceQualifiedName(),
@@ -123,17 +120,15 @@ private void runInExecutor(QueueMetrics metricsData, InvocationStartedEvent star
     }
   }
 
-  private void doRunInExecutor(QueueMetrics metricsData, InvocationStartedEvent startedEvent) throws Exception {
+  private void doRunInExecutor(InvocationStartedEvent startedEvent) throws Exception {
     Invocation invocation = HighwayCodec.decodeRequest(header, operationProtobuf, bodyBuffer, protobufFeature);
     invocation.getHandlerContext().put(Const.REMOTE_ADDRESS, this.connection.getNetSocket().remoteAddress());
-    updateMetrics(invocation);
     //???????????Finished?????TotalTime
     invocation.setStartTime(startedEvent.getStartedTime());
     invocation.triggerStartProcessingEvent();
 
     invocation.next(response -> {
       sendResponse(invocation.getContext(), response);
-      endMetrics(invocation);
       invocation.triggerFinishedEvent(response.getStatusCode(), response.isSuccessed());
     });
   }
@@ -170,55 +165,6 @@ public void execute() {
     InvocationStartedEvent startedEvent = new InvocationStartedEvent(operationMeta.getMicroserviceQualifiedName(),
         InvocationType.PRODUCER, System.nanoTime());
     EventUtils.triggerEvent(startedEvent);
-    QueueMetrics metricsData = initMetrics(operationMeta);
-    operationMeta.getExecutor().execute(() -> runInExecutor(metricsData, startedEvent));
-  }
-
-  /**
-   * Init the metrics. Note down the queue count and start time.
-   * @param operationMeta Operation data
-   * @return QueueMetrics
-   */
-  private QueueMetrics initMetrics(OperationMeta operationMeta) {
-    QueueMetrics metricsData = new QueueMetrics();
-    metricsData.setQueueStartTime(System.currentTimeMillis());
-    metricsData.setOperQualifiedName(operationMeta.getMicroserviceQualifiedName());
-    QueueMetricsData reqQueue = MetricsServoRegistry.getOrCreateLocalMetrics()
-        .getOrCreateQueueMetrics(operationMeta.getMicroserviceQualifiedName());
-    reqQueue.incrementCountInQueue();
-    return metricsData;
-  }
-
-  /**
-   * Update the queue metrics.
-   */
-  private void updateMetrics(Invocation invocation) {
-    QueueMetrics metricsData = (QueueMetrics) invocation.getMetricsData();
-    if (null != metricsData) {
-      metricsData.setQueueEndTime(System.currentTimeMillis());
-      QueueMetricsData reqQueue = MetricsServoRegistry.getOrCreateLocalMetrics()
-          .getOrCreateQueueMetrics(operationMeta.getMicroserviceQualifiedName());
-      reqQueue.incrementTotalCount();
-      Long timeInQueue = metricsData.getQueueEndTime() - metricsData.getQueueStartTime();
-      reqQueue.setTotalTime(reqQueue.getTotalTime() + timeInQueue);
-      reqQueue.setMinLifeTimeInQueue(timeInQueue);
-      reqQueue.setMaxLifeTimeInQueue(timeInQueue);
-      reqQueue.decrementCountInQueue();
-    }
-  }
-
-  /**
-   * Prepare the end time of queue metrics.
-   */
-  private void endMetrics(Invocation invocation) {
-    QueueMetrics metricsData = (QueueMetrics) invocation.getMetricsData();
-    if (null != metricsData) {
-      metricsData.setEndOperTime(System.currentTimeMillis());
-      QueueMetricsData reqQueue = MetricsServoRegistry.getOrCreateLocalMetrics()
-          .getOrCreateQueueMetrics(operationMeta.getMicroserviceQualifiedName());
-      reqQueue.incrementTotalServExecutionCount();
-      reqQueue.setTotalServExecutionTime(
-          reqQueue.getTotalServExecutionTime() + (metricsData.getEndOperTime() - metricsData.getQueueEndTime()));
-    }
+    operationMeta.getExecutor().execute(() -> runInExecutor(startedEvent));
   }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services