You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/01/09 06:27:23 UTC

[incubator-servicecomb-java-chassis] 12/13: SCB-85 move file output code from metrics-extension to samples

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

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git

commit 4879eceddd35e9a6cf56a10f8f1298f55665f6aa
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Mon Jan 8 11:28:03 2018 +0800

    SCB-85 move file output code from metrics-extension to samples
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
---
 .../src/test/java/TestWriteFile.java               | 158 ---------------------
 metrics/metrics-extension/pom.xml                  |  32 -----
 .../metrics-performance-test/pom.xml               |  78 ----------
 .../metrics/sample/perf/PerfApplication.java       |  31 ----
 .../metrics/sample/perf/PerfService.java           |  89 ------------
 .../src/main/resources/microservice.yaml           |  52 -------
 metrics/metrics-sample/pom.xml                     |  44 ------
 metrics/pom.xml                                    |   1 -
 .../metrics-write-file-config-log4j/pom.xml        |   6 +-
 .../samples/mwf}/Log4JMetricsFileWriter.java       |   2 +-
 .../metrics-write-file-config-log4j2/pom.xml       |   6 +-
 .../samples/mwf}/Log4J2MetricsFileWriter.java      |   2 +-
 .../metrics-write-file-config/pom.xml              |   5 +-
 .../samples/mwf}/MetricsFileWriter.java            |   2 +-
 .../metrics-write-file-log4j-springboot/pom.xml    |   2 +-
 .../metrics-write-file-log4j/pom.xml               |   2 +-
 .../metrics-write-file-log4j2-springboot/pom.xml   |   2 +-
 .../metrics-write-file-log4j2/pom.xml              |   2 +-
 .../metrics-write-file/pom.xml                     |   8 +-
 .../samples/mwf}/FileContentConvertor.java         |   2 +-
 .../samples/mwf}/FileContentFormatter.java         |   2 +-
 .../samples/mwf}/SimpleFileContentConvertor.java   |   2 +-
 .../samples/mwf}/SimpleFileContentFormatter.java   |   2 +-
 .../samples/mwf}/WriteFileInitializer.java         |   3 +-
 samples/metrics-write-file-sample/pom.xml          |  28 +++-
 25 files changed, 46 insertions(+), 517 deletions(-)

diff --git a/metrics/metrics-extension/metrics-write-file/src/test/java/TestWriteFile.java b/metrics/metrics-extension/metrics-write-file/src/test/java/TestWriteFile.java
deleted file mode 100644
index 37cf8b2..0000000
--- a/metrics/metrics-extension/metrics-write-file/src/test/java/TestWriteFile.java
+++ /dev/null
@@ -1,158 +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.
- */
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import io.servicecomb.metrics.common.CallMetric;
-import io.servicecomb.metrics.common.ConsumerInvocationMetric;
-import io.servicecomb.metrics.common.RegistryMetric;
-import io.servicecomb.metrics.common.SystemMetric;
-import io.servicecomb.metrics.common.TimerMetric;
-import io.servicecomb.metrics.core.publish.DataSource;
-import io.servicecomb.metrics.extension.writefile.WriteFileInitializer;
-import io.servicecomb.metrics.extension.writefile.config.MetricsFileWriter;
-import io.servicecomb.serviceregistry.Features;
-import io.servicecomb.serviceregistry.RegistryUtils;
-import io.servicecomb.serviceregistry.ServiceRegistry;
-import io.servicecomb.serviceregistry.api.registry.Microservice;
-import io.servicecomb.serviceregistry.api.registry.MicroserviceInstance;
-import io.servicecomb.serviceregistry.cache.InstanceCacheManager;
-import io.servicecomb.serviceregistry.client.ServiceRegistryClient;
-import io.servicecomb.serviceregistry.consumer.AppManager;
-import mockit.Expectations;
-
-public class TestWriteFile {
-
-  @Test
-  public void test() {
-
-    new Expectations(RegistryUtils.class) {
-      {
-        RegistryUtils.getServiceRegistry();
-        result = new ServiceRegistry() {
-          @Override
-          public void init() {
-
-          }
-
-          @Override
-          public void run() {
-
-          }
-
-          @Override
-          public void destroy() {
-
-          }
-
-          @Override
-          public Set<String> getCombinedMicroserviceNames() {
-            return null;
-          }
-
-          @Override
-          public Microservice getMicroservice() {
-            return null;
-          }
-
-          @Override
-          public MicroserviceInstance getMicroserviceInstance() {
-            return null;
-          }
-
-          @Override
-          public ServiceRegistryClient getServiceRegistryClient() {
-            return null;
-          }
-
-          @Override
-          public AppManager getAppManager() {
-            return null;
-          }
-
-          @Override
-          public InstanceCacheManager getInstanceCacheManager() {
-            return null;
-          }
-
-          @Override
-          public List<MicroserviceInstance> findServiceInstance(String appId, String microserviceName,
-              String microserviceVersionRule) {
-            return null;
-          }
-
-          @Override
-          public boolean updateMicroserviceProperties(Map<String, String> properties) {
-            return false;
-          }
-
-          @Override
-          public boolean updateInstanceProperties(Map<String, String> instanceProperties) {
-            return false;
-          }
-
-          @Override
-          public Microservice getRemoteMicroservice(String microserviceId) {
-            return null;
-          }
-
-          @Override
-          public Features getFeatures() {
-            return null;
-          }
-        };
-      }
-    };
-
-    StringBuilder builder = new StringBuilder();
-
-    MetricsFileWriter writer = (loggerName, filePrefix, content) ->
-        builder.append(loggerName).append(filePrefix).append(content);
-
-    SystemMetric systemMetric = new SystemMetric(50, 10, 1, 2, 3,
-        4, 5, 6, 7, 8);
-
-    Map<String, ConsumerInvocationMetric> consumerInvocationMetricMap = new HashMap<>();
-    consumerInvocationMetricMap.put("A", new ConsumerInvocationMetric("A", "A",
-        new TimerMetric("A1", 1, 2, 3, 4), new CallMetric("A2", 100, 999.44444)));
-
-    consumerInvocationMetricMap.put("B", new ConsumerInvocationMetric("B", "B",
-        new TimerMetric("B1", 1, 2, 3, 4), new CallMetric("B2", 100, 888.66666)));
-
-    RegistryMetric metric = new RegistryMetric(systemMetric, consumerInvocationMetricMap, new HashMap<>());
-
-    DataSource dataSource = Mockito.mock(DataSource.class);
-    Mockito.when(dataSource.getRegistryMetric()).thenReturn(metric);
-
-    WriteFileInitializer writeFileInitializer = new WriteFileInitializer(writer, dataSource,
-        "localhost", "appId.serviceName");
-
-    writeFileInitializer.run();
-
-    String sb = builder.toString();
-
-    Assert.assertTrue(sb.contains("999.4"));
-    Assert.assertTrue(sb.contains("888.7"));
-  }
-}
diff --git a/metrics/metrics-extension/pom.xml b/metrics/metrics-extension/pom.xml
index f8abb4e..bdbe4f3 100644
--- a/metrics/metrics-extension/pom.xml
+++ b/metrics/metrics-extension/pom.xml
@@ -29,36 +29,4 @@
   <artifactId>metrics-extension</artifactId>
   <packaging>pom</packaging>
 
-  <modules>
-    <module>metrics-write-file-config</module>
-    <module>metrics-write-file-config-log4j</module>
-    <module>metrics-write-file-config-log4j2</module>
-    <module>metrics-write-file</module>
-  </modules>
-
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>io.servicecomb</groupId>
-        <artifactId>metrics-write-file-config</artifactId>
-        <version>0.6.0-SNAPSHOT</version>
-      </dependency>
-      <dependency>
-        <groupId>io.servicecomb</groupId>
-        <artifactId>metrics-write-file-config-log4j</artifactId>
-        <version>0.6.0-SNAPSHOT</version>
-      </dependency>
-      <dependency>
-        <groupId>io.servicecomb</groupId>
-        <artifactId>metrics-write-file-config-log4j2</artifactId>
-        <version>0.6.0-SNAPSHOT</version>
-      </dependency>
-      <dependency>
-        <groupId>io.servicecomb</groupId>
-        <artifactId>metrics-write-file</artifactId>
-        <version>0.6.0-SNAPSHOT</version>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
 </project>
\ No newline at end of file
diff --git a/metrics/metrics-sample/metrics-performance-test/pom.xml b/metrics/metrics-sample/metrics-performance-test/pom.xml
deleted file mode 100644
index faf1510..0000000
--- a/metrics/metrics-sample/metrics-performance-test/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <artifactId>metrics-sample</artifactId>
-    <groupId>io.servicecomb</groupId>
-    <version>0.6.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>metrics-performance-test</artifactId>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>org.springframework.boot</groupId>
-          <artifactId>spring-boot-starter-logging</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter-log4j2</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>io.servicecomb</groupId>
-      <artifactId>spring-boot-starter-provider</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.hibernate</groupId>
-      <artifactId>hibernate-validator</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>repackage</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/runnable</outputDirectory>
-              <classifier>exec</classifier>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/metrics/metrics-sample/metrics-performance-test/src/main/java/io/servicecomb/metrics/sample/perf/PerfApplication.java b/metrics/metrics-sample/metrics-performance-test/src/main/java/io/servicecomb/metrics/sample/perf/PerfApplication.java
deleted file mode 100644
index 388f511..0000000
--- a/metrics/metrics-sample/metrics-performance-test/src/main/java/io/servicecomb/metrics/sample/perf/PerfApplication.java
+++ /dev/null
@@ -1,31 +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 io.servicecomb.metrics.sample.perf;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-import io.servicecomb.springboot.starter.provider.EnableServiceComb;
-
-@SpringBootApplication
-@EnableServiceComb
-public class PerfApplication {
-  public static void main(String[] args) {
-    SpringApplication.run(PerfApplication.class, args);
-  }
-}
diff --git a/metrics/metrics-sample/metrics-performance-test/src/main/java/io/servicecomb/metrics/sample/perf/PerfService.java b/metrics/metrics-sample/metrics-performance-test/src/main/java/io/servicecomb/metrics/sample/perf/PerfService.java
deleted file mode 100644
index e6651a8..0000000
--- a/metrics/metrics-sample/metrics-performance-test/src/main/java/io/servicecomb/metrics/sample/perf/PerfService.java
+++ /dev/null
@@ -1,89 +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 io.servicecomb.metrics.sample.perf;
-
-import java.util.UUID;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import io.servicecomb.metrics.core.publish.DataSource;
-import io.servicecomb.provider.rest.common.RestSchema;
-
-@RestSchema(schemaId = "demoServiceEndpoint")
-@RequestMapping(path = "/")
-public class PerfService {
-
-  private final DataSource dataSource;
-
-  @Autowired
-  public PerfService(DataSource dataSource) {
-    this.dataSource = dataSource;
-  }
-
-  @GetMapping(path = "/f0")
-  public String fun0() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f1")
-  public String fun1() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f2")
-  public String fun2() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f3")
-  public String fun3() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f4")
-  public String fun4() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f5")
-  public String fun5() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f6")
-  public String fun6() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f7")
-  public String fun7() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f8")
-  public String fun8() {
-    return UUID.randomUUID().toString();
-  }
-
-  @GetMapping(path = "/f9")
-  public String fun9() {
-    return UUID.randomUUID().toString();
-  }
-}
diff --git a/metrics/metrics-sample/metrics-performance-test/src/main/resources/microservice.yaml b/metrics/metrics-sample/metrics-performance-test/src/main/resources/microservice.yaml
deleted file mode 100644
index 3a10562..0000000
--- a/metrics/metrics-sample/metrics-performance-test/src/main/resources/microservice.yaml
+++ /dev/null
@@ -1,52 +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.
-## ---------------------------------------------------------------------------
-
-# all interconnected microservices must belong to an application wth the same ID
-APPLICATION_ID: metricsPerfTest
-service_description:
-# name of the declaring microservice
-  name: demo
-  version: 0.0.1
-cse:
-  service:
-    registry:
-      address: http://127.0.0.1:30100
-  rest:
-    address: 0.0.0.0:7777
-
-servicecomb:
-  metrics:
-    #polltime,unit is second
-    polltime: 5
-    #metrics double value round places,default value is 1
-    round_places: 1
-    file:
-      enabled: false
-      #metrics file name prefix setting,default value is "metrics"
-      name_prefix: bmi.calculator
-
-      root_path: /sample/bmi/calculator/target/metric
-      rolling:
-        max_file_count: 10
-        max_file_size : 10MB
-
-    #Version 0.5.0+ config
-    #Support Muti-WindowTime (MILLISECONDS) like 10000,60000 (10s and 60s), Use WindowTimeIndex make selection,start from 0
-    #Default value is single WindowTime : 5000 (5 second)
-    #Will direct set value of "servo.pollers"
-    #More info can be found here : https://github.com/Netflix/servo/wiki/Getting-Started -> Polling Intervals Chapter
-    window_time: 5000
\ No newline at end of file
diff --git a/metrics/metrics-sample/pom.xml b/metrics/metrics-sample/pom.xml
deleted file mode 100644
index 5b5a44a..0000000
--- a/metrics/metrics-sample/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <artifactId>metrics</artifactId>
-    <groupId>io.servicecomb</groupId>
-    <version>0.6.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>metrics-sample</artifactId>
-  <packaging>pom</packaging>
-
-  <modules>
-    <module>metrics-performance-test</module>
-  </modules>
-
-  <dependencies>
-    <dependency>
-      <groupId>io.servicecomb</groupId>
-      <artifactId>metrics-core</artifactId>
-    </dependency>
-  </dependencies>
-
-
-</project>
\ No newline at end of file
diff --git a/metrics/pom.xml b/metrics/pom.xml
index db8933f..7331a3b 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -34,6 +34,5 @@
     <module>metrics-common</module>
     <module>metrics-core</module>
     <module>metrics-extension</module>
-    <module>metrics-sample</module>
   </modules>
 </project>
\ No newline at end of file
diff --git a/metrics/metrics-extension/metrics-write-file-config-log4j/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-config-log4j/pom.xml
similarity index 90%
rename from metrics/metrics-extension/metrics-write-file-config-log4j/pom.xml
rename to samples/metrics-write-file-sample/metrics-write-file-config-log4j/pom.xml
index 7d19c96..dc58bf8 100644
--- a/metrics/metrics-extension/metrics-write-file-config-log4j/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-config-log4j/pom.xml
@@ -20,8 +20,8 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
-    <artifactId>metrics-extension</artifactId>
-    <groupId>io.servicecomb</groupId>
+    <artifactId>metrics-write-file-sample</artifactId>
+    <groupId>io.servicecomb.samples</groupId>
     <version>0.6.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -30,7 +30,7 @@
 
   <dependencies>
     <dependency>
-      <groupId>io.servicecomb</groupId>
+      <groupId>io.servicecomb.samples</groupId>
       <artifactId>metrics-write-file</artifactId>
     </dependency>
 
diff --git a/metrics/metrics-extension/metrics-write-file-config-log4j/src/main/java/io/servicecomb/metrics/extension/writefile/config/Log4JMetricsFileWriter.java b/samples/metrics-write-file-sample/metrics-write-file-config-log4j/src/main/java/io/servicecomb/samples/mwf/Log4JMetricsFileWriter.java
similarity index 98%
rename from metrics/metrics-extension/metrics-write-file-config-log4j/src/main/java/io/servicecomb/metrics/extension/writefile/config/Log4JMetricsFileWriter.java
rename to samples/metrics-write-file-sample/metrics-write-file-config-log4j/src/main/java/io/servicecomb/samples/mwf/Log4JMetricsFileWriter.java
index f605db9..716fba1 100644
--- a/metrics/metrics-extension/metrics-write-file-config-log4j/src/main/java/io/servicecomb/metrics/extension/writefile/config/Log4JMetricsFileWriter.java
+++ b/samples/metrics-write-file-sample/metrics-write-file-config-log4j/src/main/java/io/servicecomb/samples/mwf/Log4JMetricsFileWriter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile.config;
+package io.servicecomb.samples.mwf;
 
 import java.nio.file.Paths;
 import java.util.Map;
diff --git a/metrics/metrics-extension/metrics-write-file-config-log4j2/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-config-log4j2/pom.xml
similarity index 90%
rename from metrics/metrics-extension/metrics-write-file-config-log4j2/pom.xml
rename to samples/metrics-write-file-sample/metrics-write-file-config-log4j2/pom.xml
index 366906c..63a1689 100644
--- a/metrics/metrics-extension/metrics-write-file-config-log4j2/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-config-log4j2/pom.xml
@@ -20,8 +20,8 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
-    <artifactId>metrics-extension</artifactId>
-    <groupId>io.servicecomb</groupId>
+    <artifactId>metrics-write-file-sample</artifactId>
+    <groupId>io.servicecomb.samples</groupId>
     <version>0.6.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -30,7 +30,7 @@
 
   <dependencies>
     <dependency>
-      <groupId>io.servicecomb</groupId>
+      <groupId>io.servicecomb.samples</groupId>
       <artifactId>metrics-write-file</artifactId>
     </dependency>
 
diff --git a/metrics/metrics-extension/metrics-write-file-config-log4j2/src/main/java/io/servicecomb/metrics/extension/writefile/config/Log4J2MetricsFileWriter.java b/samples/metrics-write-file-sample/metrics-write-file-config-log4j2/src/main/java/io/servicecomb/samples/mwf/Log4J2MetricsFileWriter.java
similarity index 98%
rename from metrics/metrics-extension/metrics-write-file-config-log4j2/src/main/java/io/servicecomb/metrics/extension/writefile/config/Log4J2MetricsFileWriter.java
rename to samples/metrics-write-file-sample/metrics-write-file-config-log4j2/src/main/java/io/servicecomb/samples/mwf/Log4J2MetricsFileWriter.java
index a086266..13a5046 100644
--- a/metrics/metrics-extension/metrics-write-file-config-log4j2/src/main/java/io/servicecomb/metrics/extension/writefile/config/Log4J2MetricsFileWriter.java
+++ b/samples/metrics-write-file-sample/metrics-write-file-config-log4j2/src/main/java/io/servicecomb/samples/mwf/Log4J2MetricsFileWriter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile.config;
+package io.servicecomb.samples.mwf;
 
 import java.nio.file.Paths;
 import java.util.Map;
diff --git a/metrics/metrics-extension/metrics-write-file-config/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-config/pom.xml
similarity index 91%
rename from metrics/metrics-extension/metrics-write-file-config/pom.xml
rename to samples/metrics-write-file-sample/metrics-write-file-config/pom.xml
index 8b09963..001648d 100644
--- a/metrics/metrics-extension/metrics-write-file-config/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-config/pom.xml
@@ -20,12 +20,13 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
-    <artifactId>metrics-extension</artifactId>
-    <groupId>io.servicecomb</groupId>
+    <artifactId>metrics-write-file-sample</artifactId>
+    <groupId>io.servicecomb.samples</groupId>
     <version>0.6.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
   <artifactId>metrics-write-file-config</artifactId>
 
+
 </project>
\ No newline at end of file
diff --git a/metrics/metrics-extension/metrics-write-file-config/src/main/java/io/servicecomb/metrics/extension/writefile/config/MetricsFileWriter.java b/samples/metrics-write-file-sample/metrics-write-file-config/src/main/java/io/servicecomb/samples/mwf/MetricsFileWriter.java
similarity index 93%
rename from metrics/metrics-extension/metrics-write-file-config/src/main/java/io/servicecomb/metrics/extension/writefile/config/MetricsFileWriter.java
rename to samples/metrics-write-file-sample/metrics-write-file-config/src/main/java/io/servicecomb/samples/mwf/MetricsFileWriter.java
index 3a82d11..5ecaba1 100644
--- a/metrics/metrics-extension/metrics-write-file-config/src/main/java/io/servicecomb/metrics/extension/writefile/config/MetricsFileWriter.java
+++ b/samples/metrics-write-file-sample/metrics-write-file-config/src/main/java/io/servicecomb/samples/mwf/MetricsFileWriter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile.config;
+package io.servicecomb.samples.mwf;
 
 public interface MetricsFileWriter {
   void write(String loggerName, String filePrefix, String content);
diff --git a/samples/metrics-write-file-sample/metrics-write-file-log4j-springboot/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-log4j-springboot/pom.xml
index bc6e7ec..447ad59 100644
--- a/samples/metrics-write-file-sample/metrics-write-file-log4j-springboot/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-log4j-springboot/pom.xml
@@ -73,7 +73,7 @@
 
     <!--metrics write file dependency-->
     <dependency>
-      <groupId>io.servicecomb</groupId>
+      <groupId>io.servicecomb.samples</groupId>
       <artifactId>metrics-write-file-config-log4j</artifactId>
     </dependency>
   </dependencies>
diff --git a/samples/metrics-write-file-sample/metrics-write-file-log4j/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-log4j/pom.xml
index 7c69871..f84ef1f 100644
--- a/samples/metrics-write-file-sample/metrics-write-file-log4j/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-log4j/pom.xml
@@ -65,7 +65,7 @@
 
     <!--metrics write file dependency-->
     <dependency>
-      <groupId>io.servicecomb</groupId>
+      <groupId>io.servicecomb.samples</groupId>
       <artifactId>metrics-write-file-config-log4j</artifactId>
     </dependency>
 
diff --git a/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml
index bfa70d6..24612e3 100644
--- a/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-log4j2-springboot/pom.xml
@@ -63,7 +63,7 @@
 
     <!--metrics write file dependency-->
     <dependency>
-      <groupId>io.servicecomb</groupId>
+      <groupId>io.servicecomb.samples</groupId>
       <artifactId>metrics-write-file-config-log4j2</artifactId>
     </dependency>
   </dependencies>
diff --git a/samples/metrics-write-file-sample/metrics-write-file-log4j2/pom.xml b/samples/metrics-write-file-sample/metrics-write-file-log4j2/pom.xml
index 436155d..863c379 100644
--- a/samples/metrics-write-file-sample/metrics-write-file-log4j2/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file-log4j2/pom.xml
@@ -65,7 +65,7 @@
 
     <!--metrics write file dependency-->
     <dependency>
-      <groupId>io.servicecomb</groupId>
+      <groupId>io.servicecomb.samples</groupId>
       <artifactId>metrics-write-file-config-log4j2</artifactId>
     </dependency>
 
diff --git a/metrics/metrics-extension/metrics-write-file/pom.xml b/samples/metrics-write-file-sample/metrics-write-file/pom.xml
similarity index 90%
rename from metrics/metrics-extension/metrics-write-file/pom.xml
rename to samples/metrics-write-file-sample/metrics-write-file/pom.xml
index df8c1c7..fc497a8 100644
--- a/metrics/metrics-extension/metrics-write-file/pom.xml
+++ b/samples/metrics-write-file-sample/metrics-write-file/pom.xml
@@ -20,8 +20,8 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
-    <artifactId>metrics-extension</artifactId>
-    <groupId>io.servicecomb</groupId>
+    <artifactId>metrics-write-file-sample</artifactId>
+    <groupId>io.servicecomb.samples</groupId>
     <version>0.6.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -30,14 +30,14 @@
 
   <dependencies>
     <dependency>
-      <groupId>io.servicecomb</groupId>
+      <groupId>io.servicecomb.samples</groupId>
       <artifactId>metrics-write-file-config</artifactId>
     </dependency>
-
     <dependency>
       <groupId>io.servicecomb</groupId>
       <artifactId>metrics-core</artifactId>
     </dependency>
   </dependencies>
 
+
 </project>
\ No newline at end of file
diff --git a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/FileContentConvertor.java b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/FileContentConvertor.java
similarity index 95%
rename from metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/FileContentConvertor.java
rename to samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/FileContentConvertor.java
index 2340ef3..16ea4ce 100644
--- a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/FileContentConvertor.java
+++ b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/FileContentConvertor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile;
+package io.servicecomb.samples.mwf;
 
 import java.util.Map;
 
diff --git a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/FileContentFormatter.java b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/FileContentFormatter.java
similarity index 94%
rename from metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/FileContentFormatter.java
rename to samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/FileContentFormatter.java
index 22009a6..83501b2 100644
--- a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/FileContentFormatter.java
+++ b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/FileContentFormatter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile;
+package io.servicecomb.samples.mwf;
 
 import java.util.Map;
 
diff --git a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/SimpleFileContentConvertor.java b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/SimpleFileContentConvertor.java
similarity index 97%
rename from metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/SimpleFileContentConvertor.java
rename to samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/SimpleFileContentConvertor.java
index 83d4554..a2bd036 100644
--- a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/SimpleFileContentConvertor.java
+++ b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/SimpleFileContentConvertor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile;
+package io.servicecomb.samples.mwf;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
diff --git a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/SimpleFileContentFormatter.java b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/SimpleFileContentFormatter.java
similarity index 98%
rename from metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/SimpleFileContentFormatter.java
rename to samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/SimpleFileContentFormatter.java
index c3fac05..0390269 100644
--- a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/SimpleFileContentFormatter.java
+++ b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/SimpleFileContentFormatter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile;
+package io.servicecomb.samples.mwf;
 
 import java.util.HashMap;
 import java.util.Map;
diff --git a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/WriteFileInitializer.java b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/WriteFileInitializer.java
similarity index 96%
rename from metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/WriteFileInitializer.java
rename to samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/WriteFileInitializer.java
index 1593ce9..487eb80 100644
--- a/metrics/metrics-extension/metrics-write-file/src/main/java/io/servicecomb/metrics/extension/writefile/WriteFileInitializer.java
+++ b/samples/metrics-write-file-sample/metrics-write-file/src/main/java/io/servicecomb/samples/mwf/WriteFileInitializer.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package io.servicecomb.metrics.extension.writefile;
+package io.servicecomb.samples.mwf;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
@@ -32,7 +32,6 @@ import io.servicecomb.foundation.common.net.NetUtils;
 import io.servicecomb.metrics.common.RegistryMetric;
 import io.servicecomb.metrics.core.MetricsConfig;
 import io.servicecomb.metrics.core.publish.DataSource;
-import io.servicecomb.metrics.extension.writefile.config.MetricsFileWriter;
 import io.servicecomb.serviceregistry.RegistryUtils;
 import io.servicecomb.serviceregistry.api.registry.Microservice;
 
diff --git a/samples/metrics-write-file-sample/pom.xml b/samples/metrics-write-file-sample/pom.xml
index ca8e29f..31f5b4b 100644
--- a/samples/metrics-write-file-sample/pom.xml
+++ b/samples/metrics-write-file-sample/pom.xml
@@ -29,37 +29,51 @@
   <artifactId>metrics-write-file-sample</artifactId>
   <packaging>pom</packaging>
   <modules>
+    <module>metrics-write-file-config</module>
+    <module>metrics-write-file</module>
+    <module>metrics-write-file-config-log4j</module>
+    <module>metrics-write-file-config-log4j2</module>
+    <module>metrics-write-file-common</module>
     <module>metrics-write-file-log4j</module>
     <module>metrics-write-file-log4j2</module>
     <module>metrics-write-file-log4j-springboot</module>
-    <module>metrics-write-file-common</module>
     <module>metrics-write-file-log4j2-springboot</module>
   </modules>
 
   <dependencyManagement>
     <dependencies>
       <dependency>
-        <groupId>io.servicecomb.samples</groupId>
-        <artifactId>metrics-write-file-common</artifactId>
+        <groupId>io.servicecomb</groupId>
+        <artifactId>metrics-core</artifactId>
         <version>0.6.0-SNAPSHOT</version>
       </dependency>
       <dependency>
-        <groupId>io.servicecomb</groupId>
+        <groupId>io.servicecomb.samples</groupId>
         <artifactId>metrics-write-file-config</artifactId>
         <version>0.6.0-SNAPSHOT</version>
       </dependency>
       <dependency>
-        <groupId>io.servicecomb</groupId>
+        <groupId>io.servicecomb.samples</groupId>
+        <artifactId>metrics-write-file</artifactId>
+        <version>0.6.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>io.servicecomb.samples</groupId>
+        <artifactId>metrics-write-file-common</artifactId>
+        <version>0.6.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>io.servicecomb.samples</groupId>
         <artifactId>metrics-write-file-config-log4j</artifactId>
         <version>0.6.0-SNAPSHOT</version>
       </dependency>
       <dependency>
-        <groupId>io.servicecomb</groupId>
+        <groupId>io.servicecomb.samples</groupId>
         <artifactId>metrics-write-file-config-log4j2</artifactId>
         <version>0.6.0-SNAPSHOT</version>
       </dependency>
       <dependency>
-        <groupId>io.servicecomb</groupId>
+        <groupId>io.servicecomb.samples</groupId>
         <artifactId>metrics-write-file</artifactId>
         <version>0.6.0-SNAPSHOT</version>
       </dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>.